mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-11 15:51:26 +00:00
Compare commits
648 Commits
native-syn
...
1.5.0-gith
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6b7a38bc0 | ||
|
|
25386aa0e0 | ||
|
|
e6ec318425 | ||
|
|
3cdad07fe4 | ||
|
|
572f93de06 | ||
|
|
d0fa40cc5f | ||
|
|
bd2d6c8083 | ||
|
|
5b6a57be15 | ||
|
|
dd2a9e11c0 | ||
|
|
a7592b93f2 | ||
|
|
d88bb951a4 | ||
|
|
22e6c88fba | ||
|
|
efa79b3519 | ||
|
|
98aced50ef | ||
|
|
9c571af0d4 | ||
|
|
08bc150a56 | ||
|
|
8663fe580a | ||
|
|
bba22e8330 | ||
|
|
892b597041 | ||
|
|
ef6102565d | ||
|
|
60ef5b385a | ||
|
|
aa09f7ba03 | ||
|
|
7514aced27 | ||
|
|
a118653e35 | ||
|
|
2cae6756ce | ||
|
|
e84e667929 | ||
|
|
952f11287d | ||
|
|
eea18585b9 | ||
|
|
275f8fcf63 | ||
|
|
8f80deefc3 | ||
|
|
7fe4eb767c | ||
|
|
db7649d635 | ||
|
|
89d7383365 | ||
|
|
36c788b57c | ||
|
|
0a9d6ad30e | ||
|
|
cc23d0bad9 | ||
|
|
c57f367040 | ||
|
|
2027fff626 | ||
|
|
aef884efe1 | ||
|
|
c81ce8637a | ||
|
|
52846e7722 | ||
|
|
1902be18a1 | ||
|
|
97399e5269 | ||
|
|
8c2f1a5fc9 | ||
|
|
ff223a4901 | ||
|
|
44a18616b0 | ||
|
|
a77ddbe6d8 | ||
|
|
6c7d4b1905 | ||
|
|
6a2da4bb4b | ||
|
|
c62d099d60 | ||
|
|
9e4ff58aac | ||
|
|
9e2a1a404d | ||
|
|
991afb382f | ||
|
|
376b250482 | ||
|
|
28d469aeec | ||
|
|
4673fd1e90 | ||
|
|
ab24019e40 | ||
|
|
a95d69a9a8 | ||
|
|
b273bc17fe | ||
|
|
809e85f9b4 | ||
|
|
dc7d6021b6 | ||
|
|
5c82d8cd33 | ||
|
|
b3e556e662 | ||
|
|
c14039cd37 | ||
|
|
58d5b1bd26 | ||
|
|
46c68b4d1e | ||
|
|
c8dfb1d6f5 | ||
|
|
ee5d677b19 | ||
|
|
ea394f4de4 | ||
|
|
86b9fbbc14 | ||
|
|
81733beb6a | ||
|
|
607742de8c | ||
|
|
01f095adbc | ||
|
|
0e28db28f3 | ||
|
|
6de5c408ff | ||
|
|
f4b464c126 | ||
|
|
8d06261a9d | ||
|
|
c8e0f3399a | ||
|
|
31ae15d19b | ||
|
|
f4cb821f08 | ||
|
|
59cd8c5c5d | ||
|
|
33eb57043e | ||
|
|
65b7365684 | ||
|
|
880c628a69 | ||
|
|
c56025572c | ||
|
|
712c79c270 | ||
|
|
117a88f7ba | ||
|
|
113ff90c5b | ||
|
|
7145b524bf | ||
|
|
d41652b42b | ||
|
|
8f877b33ba | ||
|
|
0cfbeffaeb | ||
|
|
0bc77f90dd | ||
|
|
fd9b5f8c27 | ||
|
|
e9e62622b6 | ||
|
|
f45a471457 | ||
|
|
9d5b1dcd7a | ||
|
|
73147a7422 | ||
|
|
86f8c2ec5d | ||
|
|
68f1925726 | ||
|
|
b116597fd7 | ||
|
|
40d6d16b96 | ||
|
|
6a2a1d7472 | ||
|
|
488d2206ef | ||
|
|
10ba85d8c8 | ||
|
|
68554a0e93 | ||
|
|
f641288fbe | ||
|
|
a2d90ba39b | ||
|
|
6ed1fe28d0 | ||
|
|
3ccf8e5aa5 | ||
|
|
86cdbf2328 | ||
|
|
c0ca5160ed | ||
|
|
55e3ea9cfd | ||
|
|
8b36ad6132 | ||
|
|
91cd685616 | ||
|
|
eacbe16965 | ||
|
|
36859d7eb1 | ||
|
|
953b4880d5 | ||
|
|
007e78100f | ||
|
|
e33ecf0126 | ||
|
|
25cb98e0d7 | ||
|
|
035726372f | ||
|
|
d4db5eb818 | ||
|
|
371664caf3 | ||
|
|
372f412ffb | ||
|
|
dea37386c6 | ||
|
|
8bc04c9465 | ||
|
|
fb98338fb8 | ||
|
|
43accd4127 | ||
|
|
dcf2e0afc7 | ||
|
|
c3cfba6a8e | ||
|
|
5a410946e0 | ||
|
|
6e8a5c88ad | ||
|
|
6cc687f16c | ||
|
|
cd97f2bcba | ||
|
|
d0349731fa | ||
|
|
de62199901 | ||
|
|
aa10005b7a | ||
|
|
3df6559f30 | ||
|
|
9423ba4ee1 | ||
|
|
712fe59d4b | ||
|
|
0490fe79bb | ||
|
|
c7666b173c | ||
|
|
bcb870f377 | ||
|
|
f6962dfb75 | ||
|
|
ccba574e81 | ||
|
|
ae79455460 | ||
|
|
df06c174d1 | ||
|
|
69e8f77646 | ||
|
|
02ac4c49c5 | ||
|
|
643c9dffec | ||
|
|
42f382714d | ||
|
|
b3fa48e9a3 | ||
|
|
dab0e642fe | ||
|
|
4b3eacf3a1 | ||
|
|
9e987cfbf5 | ||
|
|
8688f89680 | ||
|
|
70d64b5db1 | ||
|
|
5642780c88 | ||
|
|
d9cc6ccf1e | ||
|
|
1635a258cc | ||
|
|
ee7a01e36b | ||
|
|
4a549af4b4 | ||
|
|
97d0170006 | ||
|
|
e9033aac9a | ||
|
|
4715dbc479 | ||
|
|
1967297d6f | ||
|
|
703cfabfd8 | ||
|
|
847a9f247d | ||
|
|
8cf8a31072 | ||
|
|
e4d5e4e7d8 | ||
|
|
13df529a5a | ||
|
|
bd489bc04d | ||
|
|
a0c1d73fee | ||
|
|
3ff2ff7b8a | ||
|
|
baf8edc3ff | ||
|
|
2e6b75a5d8 | ||
|
|
8124a95467 | ||
|
|
bf4a6492ae | ||
|
|
60a4afc556 | ||
|
|
ad93189c4f | ||
|
|
2dd73500af | ||
|
|
81e90f68a1 | ||
|
|
e8dab960c5 | ||
|
|
e6b5695265 | ||
|
|
c83f02f4b7 | ||
|
|
9f41993d1d | ||
|
|
95666c55c2 | ||
|
|
18deb8eb3d | ||
|
|
2ff99611fb | ||
|
|
c38b48c7f1 | ||
|
|
e86ca3b49a | ||
|
|
758cd9d268 | ||
|
|
98ece21909 | ||
|
|
8d8745bd48 | ||
|
|
051449143c | ||
|
|
1741f0fc9d | ||
|
|
ee50a584a7 | ||
|
|
e74eee55dd | ||
|
|
af07c48a86 | ||
|
|
dbb6d03084 | ||
|
|
6d8a8bc20d | ||
|
|
3526ebfd88 | ||
|
|
39b9ae7c5d | ||
|
|
da044135d9 | ||
|
|
a9285389ac | ||
|
|
b28db4d6d8 | ||
|
|
71e41b7c48 | ||
|
|
76d7b4254c | ||
|
|
f89ff877de | ||
|
|
1d36def10c | ||
|
|
8d68e56a78 | ||
|
|
71f79a1ffc | ||
|
|
37b90108ac | ||
|
|
6bfd6c0afb | ||
|
|
43bb78a566 | ||
|
|
0a4a3b6480 | ||
|
|
16d7b2ffbb | ||
|
|
67241f9760 | ||
|
|
f22e90337e | ||
|
|
7948533230 | ||
|
|
d83a4fec7e | ||
|
|
7868dc1880 | ||
|
|
5972130ee0 | ||
|
|
bd9d8614dd | ||
|
|
c14d5d70ba | ||
|
|
8ba60d41e1 | ||
|
|
878b3a7616 | ||
|
|
9e979e1e65 | ||
|
|
d4493104d2 | ||
|
|
16da790a04 | ||
|
|
a775cd261e | ||
|
|
ad0b1a1e26 | ||
|
|
c2ae0e4887 | ||
|
|
c16e0f1e83 | ||
|
|
92be633866 | ||
|
|
94b97ce950 | ||
|
|
8e26173ac0 | ||
|
|
831eaa3b96 | ||
|
|
9bd64c3976 | ||
|
|
d7cc7f59fc | ||
|
|
1977cfa3a9 | ||
|
|
a8acfee1b1 | ||
|
|
a804bc2041 | ||
|
|
a62cf77dcf | ||
|
|
91ea3b04d9 | ||
|
|
113117b8d3 | ||
|
|
11588cdb7a | ||
|
|
349c00ca28 | ||
|
|
36503922c2 | ||
|
|
e02c089bd4 | ||
|
|
518173d63b | ||
|
|
c83988cc61 | ||
|
|
58e95e3af3 | ||
|
|
357a49a8c9 | ||
|
|
d924303849 | ||
|
|
51edbfdd03 | ||
|
|
fc630fe25b | ||
|
|
96a90b431a | ||
|
|
568bde81d2 | ||
|
|
c67541ef26 | ||
|
|
438bb71a15 | ||
|
|
da5fa4d573 | ||
|
|
19f34c11c8 | ||
|
|
0798d32630 | ||
|
|
7ce6f2f30b | ||
|
|
3df95bc536 | ||
|
|
d5fd91918a | ||
|
|
54ddbab79e | ||
|
|
18bcf6a375 | ||
|
|
3528b854ff | ||
|
|
f46b8220a1 | ||
|
|
a2fd3a86d0 | ||
|
|
31d93fd3b3 | ||
|
|
33fc319c83 | ||
|
|
4eb85174e0 | ||
|
|
33d4e6f4f0 | ||
|
|
250092c78d | ||
|
|
7de71d6045 | ||
|
|
2504a1cea1 | ||
|
|
1532a92209 | ||
|
|
f98ceaf5a7 | ||
|
|
dc0aae2dde | ||
|
|
dfa1794deb | ||
|
|
209c18374c | ||
|
|
6c2e3af775 | ||
|
|
e491e7e289 | ||
|
|
733f4e7501 | ||
|
|
fcf75f60a1 | ||
|
|
389f489fda | ||
|
|
940469dc4f | ||
|
|
d8b85debe6 | ||
|
|
ffe642c0b7 | ||
|
|
ee11ace111 | ||
|
|
5aea142d3a | ||
|
|
6794e4d54c | ||
|
|
b63b1aee7a | ||
|
|
c2bcc7be15 | ||
|
|
b2d4f0f9a2 | ||
|
|
96a91189b0 | ||
|
|
c34a05866e | ||
|
|
99c24a8ce2 | ||
|
|
d393038762 | ||
|
|
b1ddb612ee | ||
|
|
6e5af9e6b6 | ||
|
|
11fc1dccaf | ||
|
|
d1b7f203d2 | ||
|
|
52454977ca | ||
|
|
e3833fedf1 | ||
|
|
906d434abb | ||
|
|
476c157847 | ||
|
|
b69dc5fde1 | ||
|
|
f1503d8f10 | ||
|
|
54feaa8528 | ||
|
|
54d20b5768 | ||
|
|
8eaccb5d23 | ||
|
|
529e82cfcb | ||
|
|
28f632987a | ||
|
|
c34d2f979a | ||
|
|
970ca5264c | ||
|
|
55e7d4bf7a | ||
|
|
48fe3a699a | ||
|
|
dfa7dadac4 | ||
|
|
da5c625f6e | ||
|
|
0137f3e39f | ||
|
|
81dd45ab86 | ||
|
|
63d48416b6 | ||
|
|
a21266009c | ||
|
|
147874be43 | ||
|
|
d25e48dbfe | ||
|
|
b2489d87bb | ||
|
|
049580e639 | ||
|
|
85d30c16f1 | ||
|
|
d8de055767 | ||
|
|
a7a4ccee0c | ||
|
|
30f654c4ea | ||
|
|
67e812cd28 | ||
|
|
4a936324b5 | ||
|
|
a2bdee74e1 | ||
|
|
48582b1caa | ||
|
|
6b5379e6c0 | ||
|
|
ce0fe0358a | ||
|
|
825563d4f8 | ||
|
|
68b2a0931a | ||
|
|
9f793dab35 | ||
|
|
df243ebd66 | ||
|
|
bb558c5282 | ||
|
|
de62c4cde7 | ||
|
|
5c05860ad3 | ||
|
|
a372dd7660 | ||
|
|
268e33fa49 | ||
|
|
8d71befde0 | ||
|
|
43a6d7a180 | ||
|
|
3a11ac6799 | ||
|
|
45192ea73d | ||
|
|
17bb85d624 | ||
|
|
06fa4b8128 | ||
|
|
cb97fe0274 | ||
|
|
c0c985993c | ||
|
|
48370ecf8c | ||
|
|
a76ee3ae2e | ||
|
|
5d69bc5022 | ||
|
|
3aa7f72527 | ||
|
|
a7002d5e38 | ||
|
|
6ceff112e2 | ||
|
|
491ee56cd4 | ||
|
|
d5666ba699 | ||
|
|
8cb17f57f7 | ||
|
|
ee11fbcbf7 | ||
|
|
448a6cb995 | ||
|
|
1132bde48f | ||
|
|
6bcb4cc53a | ||
|
|
c0e01ddebb | ||
|
|
1baa83bd34 | ||
|
|
3700d23b18 | ||
|
|
023d80b5fa | ||
|
|
a2760b3f78 | ||
|
|
696557032c | ||
|
|
94fe759b9d | ||
|
|
5f9fe82903 | ||
|
|
00668484bd | ||
|
|
295fff2fbc | ||
|
|
9e090ea744 | ||
|
|
f783bb87b3 | ||
|
|
51394349d0 | ||
|
|
a536d4c5b8 | ||
|
|
6e654067ab | ||
|
|
86b01d2ba6 | ||
|
|
522cfebc9a | ||
|
|
3b026c9116 | ||
|
|
1210381342 | ||
|
|
badfaf3db9 | ||
|
|
ebfa56d9ed | ||
|
|
cdc1aa8928 | ||
|
|
c2a4b2d886 | ||
|
|
b69e119fd4 | ||
|
|
ca1df95052 | ||
|
|
c90f01a81b | ||
|
|
85b9b5b85f | ||
|
|
396ea68c1a | ||
|
|
15b3f54e66 | ||
|
|
e90e8fa53b | ||
|
|
403245bd38 | ||
|
|
02710c33d3 | ||
|
|
5a698f8121 | ||
|
|
4536b13ceb | ||
|
|
c7376896d6 | ||
|
|
5f53dff7c9 | ||
|
|
be18cb1cb7 | ||
|
|
6a0e9d5d38 | ||
|
|
11c154226f | ||
|
|
99fdcc647a | ||
|
|
fe89c8d64e | ||
|
|
12b984e53d | ||
|
|
ef3c73554f | ||
|
|
ff0f0def59 | ||
|
|
b328532356 | ||
|
|
ce9381cfa4 | ||
|
|
9abfc6bc1c | ||
|
|
22689c28d3 | ||
|
|
f89ebbe5d2 | ||
|
|
8aedf23deb | ||
|
|
a147080ac1 | ||
|
|
65a490eefc | ||
|
|
28fb718529 | ||
|
|
9bbd6ccb87 | ||
|
|
3361526e4a | ||
|
|
9faf83899d | ||
|
|
fcc1e7f54c | ||
|
|
2cbad94c09 | ||
|
|
46c11d1f85 | ||
|
|
786b405ed6 | ||
|
|
bb30ac2a04 | ||
|
|
94ecbbf8f7 | ||
|
|
650e031aca | ||
|
|
031bc484ab | ||
|
|
db70ca4a69 | ||
|
|
8b9867f2fb | ||
|
|
68d16d39dd | ||
|
|
7ff2ad94d2 | ||
|
|
252556d91a | ||
|
|
f47eac03b3 | ||
|
|
d667c2f8b9 | ||
|
|
9f4cd75e43 | ||
|
|
20e82953d7 | ||
|
|
d71d57a9e7 | ||
|
|
2b1148448e | ||
|
|
f83860a135 | ||
|
|
7f991305e6 | ||
|
|
c79ba4448c | ||
|
|
c15c593136 | ||
|
|
020cd45050 | ||
|
|
2da4a4ea6b | ||
|
|
6d2be950a3 | ||
|
|
dad762eb61 | ||
|
|
09b239f4b9 | ||
|
|
9c6238ff03 | ||
|
|
aaf6494faa | ||
|
|
bc23b04d16 | ||
|
|
a843800b2a | ||
|
|
62ef7f65dd | ||
|
|
87f5cedf7f | ||
|
|
95c2762432 | ||
|
|
315190cc1b | ||
|
|
355ae07667 | ||
|
|
13a97b56c1 | ||
|
|
7857230aa5 | ||
|
|
f939fdc154 | ||
|
|
53bc498da4 | ||
|
|
0d50b13a2c | ||
|
|
9f69fe86a0 | ||
|
|
918c5e7d4f | ||
|
|
2375817c1d | ||
|
|
e4130cd12f | ||
|
|
4d66d2ab98 | ||
|
|
6c514ac028 | ||
|
|
99a3979b27 | ||
|
|
19c742a0c2 | ||
|
|
c9258f5c40 | ||
|
|
0ac096c108 | ||
|
|
544285aaea | ||
|
|
ccb8385b36 | ||
|
|
05423910d2 | ||
|
|
49a0bee762 | ||
|
|
06cf09f91d | ||
|
|
cdf2f853aa | ||
|
|
99f2194af6 | ||
|
|
609e355d55 | ||
|
|
e7f5df1423 | ||
|
|
ed5f40ab83 | ||
|
|
7de2eeaad5 | ||
|
|
6517f1d389 | ||
|
|
b5d24f38bc | ||
|
|
662f209862 | ||
|
|
daea75908b | ||
|
|
3a9e75b162 | ||
|
|
fe27514e62 | ||
|
|
1000eaedba | ||
|
|
2a773e1f8a | ||
|
|
a7c4d13619 | ||
|
|
bf045e3a04 | ||
|
|
a560f431b4 | ||
|
|
cbb06a0856 | ||
|
|
bf32cdc1f2 | ||
|
|
745043c466 | ||
|
|
edecafd887 | ||
|
|
b27dd8e3fe | ||
|
|
ccffa1a8bf | ||
|
|
72409bfef9 | ||
|
|
d35f31de68 | ||
|
|
1a5c5bc2f5 | ||
|
|
a4f188615b | ||
|
|
155c814a4a | ||
|
|
796d7274e6 | ||
|
|
c163bdded3 | ||
|
|
b857f46533 | ||
|
|
5e91b4eaab | ||
|
|
162356f99b | ||
|
|
f40e815e28 | ||
|
|
4f38e08c39 | ||
|
|
2ef1d9c542 | ||
|
|
ecf0c6ce15 | ||
|
|
25432bd33a | ||
|
|
f13342a362 | ||
|
|
3762321406 | ||
|
|
521c23cc02 | ||
|
|
787124cb06 | ||
|
|
0f75a4edc3 | ||
|
|
74ae3219f3 | ||
|
|
b65accec4e | ||
|
|
81de9f851f | ||
|
|
66bb5cdc6e | ||
|
|
110f278d5e | ||
|
|
832d21fbdd | ||
|
|
30d9fafbc4 | ||
|
|
ed20e2851c | ||
|
|
974654ec34 | ||
|
|
ba786f5a46 | ||
|
|
48592ec112 | ||
|
|
665a25f637 | ||
|
|
c111f90251 | ||
|
|
da4bc74da3 | ||
|
|
935f3b7659 | ||
|
|
dcba27c3a8 | ||
|
|
1a68073292 | ||
|
|
df0c050e4b | ||
|
|
4a0cb0aa5c | ||
|
|
1c1d41c864 | ||
|
|
3004b39304 | ||
|
|
e77ad7f44f | ||
|
|
06334aac59 | ||
|
|
734495e9bf | ||
|
|
98e23f4955 | ||
|
|
d9e2827e4c | ||
|
|
979bb3f67a | ||
|
|
e7667b5397 | ||
|
|
3fafb2e9df | ||
|
|
22688b804f | ||
|
|
ba02081ebb | ||
|
|
ecf9fd0b8b | ||
|
|
98a31448c5 | ||
|
|
465909f8c0 | ||
|
|
232c260c9a | ||
|
|
ebd8a9ea82 | ||
|
|
69097dd444 | ||
|
|
1c5e61fb32 | ||
|
|
f675081405 | ||
|
|
0a3839c109 | ||
|
|
32f2d4939a | ||
|
|
620e823cc1 | ||
|
|
de7aade158 | ||
|
|
f7abb0b5c2 | ||
|
|
4efa634f37 | ||
|
|
db9bf8428d | ||
|
|
2b297ccd7a | ||
|
|
8c18d88e61 | ||
|
|
ecfc1493d0 | ||
|
|
64ccd3213c | ||
|
|
4f0fc39c45 | ||
|
|
84076a11da | ||
|
|
b73321b580 | ||
|
|
d8aafc0243 | ||
|
|
7b83677da5 | ||
|
|
449f9b1dfa | ||
|
|
632cfa7312 | ||
|
|
e407f4cff3 | ||
|
|
9e00b483bb | ||
|
|
347fd1e3c1 | ||
|
|
08dde21f02 | ||
|
|
e62eacce71 | ||
|
|
900b15468b | ||
|
|
2734829513 | ||
|
|
5a43e1dcd3 | ||
|
|
f5553eef3e | ||
|
|
630f86d264 | ||
|
|
575ccab8b8 | ||
|
|
c4c631f6e5 | ||
|
|
a852608363 | ||
|
|
49e96b11f8 | ||
|
|
1acdadf15e | ||
|
|
5217bd1797 | ||
|
|
8feea385d5 | ||
|
|
5303713153 | ||
|
|
f0ec8c6e65 | ||
|
|
e6412d6d75 | ||
|
|
549f6f05f2 | ||
|
|
72e0444d7c | ||
|
|
daba02833c | ||
|
|
4b4691518a | ||
|
|
7bf8949a24 | ||
|
|
12c766bf29 | ||
|
|
b53320c587 | ||
|
|
a8dd865f78 | ||
|
|
d1c4ccd0b9 | ||
|
|
df5cf5ccb1 | ||
|
|
e936bc466a | ||
|
|
067cc9cba8 | ||
|
|
fe4ab2c61e | ||
|
|
ab75917fbc | ||
|
|
32561fe41a | ||
|
|
f4b8261573 | ||
|
|
9c7a5d61f9 | ||
|
|
0dc4f185e5 | ||
|
|
ac1d975fd3 | ||
|
|
a6f8f60447 | ||
|
|
44301bd2d8 | ||
|
|
cf3f984e75 | ||
|
|
8036a257ce | ||
|
|
ad6ed3a10e | ||
|
|
5076734d3a | ||
|
|
9036164902 | ||
|
|
e759649b56 | ||
|
|
6abfbcaa0a | ||
|
|
cc31c7167e | ||
|
|
a5a8c30089 | ||
|
|
8a10ee4e8b | ||
|
|
27e7a2fbee | ||
|
|
0d49acc1e6 | ||
|
|
ca164bb8ad | ||
|
|
565132b7a9 | ||
|
|
0c5625e616 | ||
|
|
e502c1ad71 | ||
|
|
bd4d9491ba | ||
|
|
5d8bf3be87 | ||
|
|
c0ecb5c3c9 | ||
|
|
a4a2618cf7 | ||
|
|
5c43a97e1e | ||
|
|
497dacdc3c |
2743
ChangeLog.md
2743
ChangeLog.md
File diff suppressed because it is too large
Load Diff
24
ReadMe.md
24
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.
|
||||
@@ -168,6 +168,28 @@ 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,36 +1,11 @@
|
||||
import kotlinx.benchmark.gradle.benchmark
|
||||
|
||||
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")
|
||||
val benchmarks_version = "0.3.0"
|
||||
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -42,7 +17,7 @@ dependencies {
|
||||
compile(jpsStandalone()) { includeJars("jps-model") }
|
||||
compile(intellijPluginDep("java"))
|
||||
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
||||
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
|
||||
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,21 +29,43 @@ 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.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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,6 +94,10 @@ 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
|
||||
|
||||
@@ -425,6 +429,8 @@ 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
|
||||
}
|
||||
@@ -435,6 +441,7 @@ open class IncrementalJvmCache(
|
||||
operator fun contains(className: JvmClassName): Boolean =
|
||||
className.internalName in storage
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
@@ -444,6 +451,8 @@ open class IncrementalJvmCache(
|
||||
|
||||
private inner class MultifileClassPartMap(storageFile: File) :
|
||||
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
|
||||
|
||||
@Synchronized
|
||||
fun set(partName: String, facadeName: String) {
|
||||
storage[partName] = facadeName
|
||||
}
|
||||
@@ -451,6 +460,7 @@ open class IncrementalJvmCache(
|
||||
fun get(partName: JvmClassName): String? =
|
||||
storage[partName.internalName]
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ data class IncrementalModuleEntry(
|
||||
|
||||
class IncrementalModuleInfo(
|
||||
val projectRoot: File,
|
||||
val rootProjectBuildDir: File,
|
||||
val dirToModule: Map<File, IncrementalModuleEntry>,
|
||||
val nameToModules: Map<String, Set<IncrementalModuleEntry>>,
|
||||
val jarToClassListFile: Map<File, File>,
|
||||
@@ -28,6 +29,6 @@ class IncrementalModuleInfo(
|
||||
val jarToModule: Map<File, IncrementalModuleEntry>
|
||||
) : Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID = 0L
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
@@ -182,6 +182,21 @@ 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
|
||||
@@ -266,6 +281,9 @@ 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,
|
||||
@@ -314,6 +332,21 @@ 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)
|
||||
@@ -1728,6 +1761,18 @@ 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,6 +290,11 @@ 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,6 +10347,37 @@ 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>
|
||||
*/
|
||||
@@ -10585,9 +10616,32 @@ 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_ & 0x00000008) == 0x00000008)) {
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
subBuilder = typeTable_.toBuilder();
|
||||
}
|
||||
typeTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.PARSER, extensionRegistry);
|
||||
@@ -10595,13 +10649,13 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(typeTable_);
|
||||
typeTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000008;
|
||||
bitField0_ |= 0x00000040;
|
||||
break;
|
||||
}
|
||||
case 248: {
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
}
|
||||
versionRequirement_.add(input.readInt32());
|
||||
break;
|
||||
@@ -10609,9 +10663,9 @@ public final class DebugProtoBuf {
|
||||
case 250: {
|
||||
int length = input.readRawVarint32();
|
||||
int limit = input.pushLimit(length);
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000) && input.getBytesUntilLimit() > 0) {
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000) && input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
}
|
||||
while (input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_.add(input.readInt32());
|
||||
@@ -10621,7 +10675,7 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
case 258: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
subBuilder = versionRequirementTable_.toBuilder();
|
||||
}
|
||||
versionRequirementTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.PARSER, extensionRegistry);
|
||||
@@ -10629,7 +10683,7 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(versionRequirementTable_);
|
||||
versionRequirementTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000010;
|
||||
bitField0_ |= 0x00000080;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -10670,7 +10724,7 @@ public final class DebugProtoBuf {
|
||||
if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
|
||||
sealedSubclassFqName_ = java.util.Collections.unmodifiableList(sealedSubclassFqName_);
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
}
|
||||
this.unknownFields = unknownFields.build();
|
||||
@@ -11225,13 +11279,64 @@ 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_ & 0x00000008) == 0x00000008);
|
||||
return ((bitField0_ & 0x00000040) == 0x00000040);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -11286,7 +11391,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
return ((bitField0_ & 0x00000080) == 0x00000080);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -11315,6 +11420,9 @@ 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();
|
||||
@@ -11371,6 +11479,12 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
@@ -11443,12 +11557,21 @@ 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_ & 0x00000010) == 0x00000010)) {
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
output.writeMessage(32, versionRequirementTable_);
|
||||
}
|
||||
extensionWriter.writeUntil(19000, output);
|
||||
@@ -11544,6 +11667,18 @@ 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_);
|
||||
}
|
||||
@@ -11556,7 +11691,7 @@ public final class DebugProtoBuf {
|
||||
size += dataSize;
|
||||
size += 2 * getVersionRequirementList().size();
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(32, versionRequirementTable_);
|
||||
}
|
||||
@@ -11678,6 +11813,7 @@ public final class DebugProtoBuf {
|
||||
getPropertyFieldBuilder();
|
||||
getTypeAliasFieldBuilder();
|
||||
getEnumEntryFieldBuilder();
|
||||
getInlineClassUnderlyingTypeFieldBuilder();
|
||||
getTypeTableFieldBuilder();
|
||||
getVersionRequirementTableFieldBuilder();
|
||||
}
|
||||
@@ -11742,20 +11878,30 @@ 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_ & ~0x00002000);
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -11877,18 +12023,34 @@ 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_ & 0x00004000) == 0x00004000)) {
|
||||
if (((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
}
|
||||
result.versionRequirement_ = versionRequirement_;
|
||||
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
if (((from_bitField0_ & 0x00040000) == 0x00040000)) {
|
||||
to_bitField0_ |= 0x00000080;
|
||||
}
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
result.versionRequirementTable_ = versionRequirementTable_;
|
||||
@@ -12132,13 +12294,22 @@ 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_ & ~0x00004000);
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
} else {
|
||||
ensureVersionRequirementIsMutable();
|
||||
versionRequirement_.addAll(other.versionRequirement_);
|
||||
@@ -12200,6 +12371,12 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
|
||||
@@ -14258,6 +14435,186 @@ 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_;
|
||||
@@ -14265,7 +14622,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public boolean hasTypeTable() {
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
return ((bitField0_ & 0x00010000) == 0x00010000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -14290,7 +14647,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00002000;
|
||||
bitField0_ |= 0x00010000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14304,7 +14661,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00002000;
|
||||
bitField0_ |= 0x00010000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14312,7 +14669,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeTypeTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable value) {
|
||||
if (typeTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00002000) == 0x00002000) &&
|
||||
if (((bitField0_ & 0x00010000) == 0x00010000) &&
|
||||
typeTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance()) {
|
||||
typeTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14323,7 +14680,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00002000;
|
||||
bitField0_ |= 0x00010000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14336,14 +14693,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder getTypeTableBuilder() {
|
||||
bitField0_ |= 0x00002000;
|
||||
bitField0_ |= 0x00010000;
|
||||
onChanged();
|
||||
return getTypeTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -14376,9 +14733,9 @@ public final class DebugProtoBuf {
|
||||
|
||||
private java.util.List<java.lang.Integer> versionRequirement_ = java.util.Collections.emptyList();
|
||||
private void ensureVersionRequirementIsMutable() {
|
||||
if (!((bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
if (!((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>(versionRequirement_);
|
||||
bitField0_ |= 0x00004000;
|
||||
bitField0_ |= 0x00020000;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -14463,7 +14820,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder clearVersionRequirement() {
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
@@ -14475,7 +14832,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00008000) == 0x00008000);
|
||||
return ((bitField0_ & 0x00040000) == 0x00040000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -14500,7 +14857,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00008000;
|
||||
bitField0_ |= 0x00040000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14514,7 +14871,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00008000;
|
||||
bitField0_ |= 0x00040000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14522,7 +14879,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeVersionRequirementTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable value) {
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00008000) == 0x00008000) &&
|
||||
if (((bitField0_ & 0x00040000) == 0x00040000) &&
|
||||
versionRequirementTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance()) {
|
||||
versionRequirementTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.newBuilder(versionRequirementTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14533,7 +14890,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00008000;
|
||||
bitField0_ |= 0x00040000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14546,14 +14903,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder getVersionRequirementTableBuilder() {
|
||||
bitField0_ |= 0x00008000;
|
||||
bitField0_ |= 0x00040000;
|
||||
onChanged();
|
||||
return getVersionRequirementTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -34382,7 +34739,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\"\250\007\n\005Class\022\020" +
|
||||
"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\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" +
|
||||
@@ -34398,122 +34755,127 @@ 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\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"
|
||||
"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"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -34587,7 +34949,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", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "InlineClassUnderlyingPropertyName", "InlineClassUnderlyingType", "InlineClassUnderlyingTypeId", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_descriptor =
|
||||
getDescriptor().getMessageTypes().get(6);
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_fieldAccessorTable = new
|
||||
@@ -34696,6 +35058,8 @@ 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);
|
||||
|
||||
@@ -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.0.88"
|
||||
extra["versions.r8"] = "2.1.75"
|
||||
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-dev-17775"
|
||||
extra["versions.kotlin-native"] = "1.5-rc1-41"
|
||||
}
|
||||
|
||||
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
|
||||
@@ -345,6 +345,7 @@ val coreLibProjects = listOfNotNull(
|
||||
":kotlin-stdlib-js",
|
||||
":kotlin-stdlib-jdk7",
|
||||
":kotlin-stdlib-jdk8",
|
||||
":kotlin-test",
|
||||
":kotlin-test:kotlin-test-annotations-common",
|
||||
":kotlin-test:kotlin-test-common",
|
||||
":kotlin-test:kotlin-test-jvm",
|
||||
@@ -423,14 +424,19 @@ allprojects {
|
||||
repositories {
|
||||
kotlinBuildLocalRepo(project)
|
||||
mirrorRepo?.let(::maven)
|
||||
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)
|
||||
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()
|
||||
}
|
||||
|
||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
||||
@@ -471,7 +477,7 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir) {
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) {
|
||||
// For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects
|
||||
// (compiler/build.gradle.kts and libraries/commonConfiguration.gradle).
|
||||
val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile }
|
||||
@@ -637,7 +643,10 @@ tasks {
|
||||
|
||||
listOf("clean", "assemble", "install").forEach { taskName ->
|
||||
register("coreLibs${taskName.capitalize()}") {
|
||||
coreLibProjects.forEach { projectName -> dependsOn("$projectName:$taskName") }
|
||||
for (projectName in coreLibProjects) {
|
||||
if (projectName.startsWith(":kotlin-test:") && taskName == "install") continue
|
||||
dependsOn("$projectName:$taskName")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -728,10 +737,12 @@ tasks {
|
||||
register("scriptingTest") {
|
||||
dependsOn("dist")
|
||||
dependsOn(":kotlin-script-util:test")
|
||||
dependsOn(":kotlin-scripting-compiler-embeddable:test")
|
||||
dependsOn(":kotlin-scripting-compiler:test")
|
||||
dependsOn(":kotlin-scripting-compiler:testWithIr")
|
||||
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")
|
||||
@@ -739,6 +750,7 @@ 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")
|
||||
@@ -752,7 +764,6 @@ tasks {
|
||||
|
||||
register("miscCompilerTest") {
|
||||
dependsOn("nativeCompilerTest")
|
||||
dependsOn("firCompilerTest")
|
||||
|
||||
dependsOn(":kotlin-daemon-tests:test")
|
||||
dependsOn("scriptingTest")
|
||||
@@ -953,7 +964,6 @@ tasks {
|
||||
dependsOn(
|
||||
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-tests-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
|
||||
@@ -975,9 +985,7 @@ tasks {
|
||||
":kotlin-stdlib-jdk7:publish",
|
||||
":kotlin-stdlib-jdk8:publish",
|
||||
":kotlin-reflect:publish",
|
||||
":kotlin-main-kts:publish",
|
||||
":kotlin-stdlib-js:publish",
|
||||
":kotlin-test:kotlin-test-js:publish"
|
||||
":kotlin-main-kts:publish"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ extra["customDepsOrg"] = "kotlin.build"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
gradlePluginPortal()
|
||||
|
||||
|
||||
@@ -65,28 +65,11 @@ 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://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
}
|
||||
|
||||
val intellij by configurations.creating
|
||||
|
||||
@@ -18,3 +18,5 @@ val KotlinBuildProperties.proguard: Boolean get() = postProcessing && getBoolean
|
||||
val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.build.jar.compression", isTeamcityBuild)
|
||||
|
||||
val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild)
|
||||
|
||||
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", isTeamcityBuild)
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.ExternalModuleDependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.project
|
||||
import java.io.File
|
||||
@@ -112,6 +115,50 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
|
||||
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
|
||||
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
|
||||
|
||||
fun Project.testApiJUnit5(
|
||||
vintageEngine: Boolean = false,
|
||||
runner: Boolean = false,
|
||||
suiteApi: Boolean = false
|
||||
) {
|
||||
with(dependencies) {
|
||||
val platformVersion = commonVer("org.junit", "junit-bom")
|
||||
testApi(platform("org.junit:junit-bom:$platformVersion"))
|
||||
testApi("org.junit.jupiter:junit-jupiter")
|
||||
if (vintageEngine) {
|
||||
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
|
||||
}
|
||||
val componentsVersion = commonVer("org.junit.platform", "")
|
||||
|
||||
val components = mutableListOf(
|
||||
"org.junit.platform:junit-platform-commons",
|
||||
"org.junit.platform:junit-platform-launcher"
|
||||
)
|
||||
if (runner) {
|
||||
components += "org.junit.platform:junit-platform-runner"
|
||||
}
|
||||
if (suiteApi) {
|
||||
components += "org.junit.platform:junit-platform-suite-api"
|
||||
}
|
||||
|
||||
for (component in components) {
|
||||
testApi("$component:$componentsVersion")
|
||||
}
|
||||
|
||||
addDependencyTo<ExternalModuleDependency>(this, "testImplementation", intellijDep()) {
|
||||
// This dependency is needed only for FileComparisonFailure
|
||||
includeJars("idea_rt", rootProject = rootProject)
|
||||
isTransitive = false
|
||||
}
|
||||
|
||||
// This is needed only for using FileComparisonFailure, which relies on JUnit 3 classes
|
||||
add("testRuntimeOnly", commonDep("junit:junit"))
|
||||
}
|
||||
}
|
||||
|
||||
private fun DependencyHandler.testApi(dependencyNotation: Any) {
|
||||
add("testApi", dependencyNotation)
|
||||
}
|
||||
|
||||
val Project.protobufVersion: String get() = findProperty("versions.protobuf") as String
|
||||
|
||||
val Project.protobufRepo: String
|
||||
|
||||
@@ -25,6 +25,7 @@ val packagesToRelocate =
|
||||
"org.fusesource",
|
||||
"net.jpountz",
|
||||
"one.util.streamex",
|
||||
"it.unimi.dsi.fastutil",
|
||||
"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 validateTaskProperties
|
||||
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
|
||||
lateinit var counts: Counts
|
||||
|
||||
@get:OutputFile
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -71,62 +71,11 @@ class KotlinBuildPublishingPlugin @Inject constructor(
|
||||
create<MavenPublication>(PUBLICATION_NAME) {
|
||||
from(kotlinLibraryComponent)
|
||||
|
||||
pom {
|
||||
packaging = "jar"
|
||||
name.set(humanReadableName(project))
|
||||
description.set(project.description ?: humanReadableName(project))
|
||||
url.set("https://kotlinlang.org/")
|
||||
licenses {
|
||||
license {
|
||||
name.set("The Apache License, Version 2.0")
|
||||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url.set("https://github.com/JetBrains/kotlin")
|
||||
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
|
||||
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
name.set("Kotlin Team")
|
||||
organization.set("JetBrains")
|
||||
organizationUrl.set("https://www.jetbrains.com")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = REPOSITORY_NAME
|
||||
url = file("${project.rootDir}/build/repo").toURI()
|
||||
configureKotlinPomAttributes(project)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val signingRequired = provider {
|
||||
project.findProperty("signingRequired")?.toString()?.toBoolean()
|
||||
?: project.property("isSonatypeRelease") as Boolean
|
||||
}
|
||||
|
||||
configure<SigningExtension> {
|
||||
setRequired(signingRequired)
|
||||
sign(extensions.getByType<PublishingExtension>().publications[PUBLICATION_NAME])
|
||||
useGpgCmd()
|
||||
}
|
||||
|
||||
tasks.withType<Sign>().configureEach {
|
||||
setOnlyIf { signingRequired.get() }
|
||||
}
|
||||
|
||||
tasks.register("install") {
|
||||
dependsOn(tasks.named("publishToMavenLocal"))
|
||||
}
|
||||
|
||||
tasks.named<PublishToMavenRepository>("publish${PUBLICATION_NAME}PublicationTo${REPOSITORY_NAME}Repository")
|
||||
.configureRepository()
|
||||
configureDefaultPublishing()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -137,13 +86,84 @@ class KotlinBuildPublishingPlugin @Inject constructor(
|
||||
const val COMPILE_CONFIGURATION = "publishedCompile"
|
||||
const val RUNTIME_CONFIGURATION = "publishedRuntime"
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun humanReadableName(project: Project) =
|
||||
project.name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
|
||||
}
|
||||
}
|
||||
|
||||
fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
private fun humanReadableName(name: String) =
|
||||
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
|
||||
|
||||
fun MavenPublication.configureKotlinPomAttributes(project: Project, explicitDescription: String? = null) {
|
||||
val publication = this
|
||||
pom {
|
||||
packaging = "jar"
|
||||
name.set(humanReadableName(publication.artifactId))
|
||||
description.set(explicitDescription ?: project.description ?: humanReadableName(publication.artifactId))
|
||||
url.set("https://kotlinlang.org/")
|
||||
licenses {
|
||||
license {
|
||||
name.set("The Apache License, Version 2.0")
|
||||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url.set("https://github.com/JetBrains/kotlin")
|
||||
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
|
||||
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
name.set("Kotlin Team")
|
||||
organization.set("JetBrains")
|
||||
organizationUrl.set("https://www.jetbrains.com")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Project.configureDefaultPublishing() {
|
||||
configure<PublishingExtension> {
|
||||
repositories {
|
||||
maven {
|
||||
name = KotlinBuildPublishingPlugin.REPOSITORY_NAME
|
||||
url = file("${project.rootDir}/build/repo").toURI()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configureSigning()
|
||||
|
||||
tasks.register("install") {
|
||||
dependsOn(tasks.named("publishToMavenLocal"))
|
||||
}
|
||||
|
||||
tasks.withType<PublishToMavenRepository>()
|
||||
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
|
||||
.all { configureRepository() }
|
||||
}
|
||||
|
||||
private fun Project.configureSigning() {
|
||||
val signingRequired = provider {
|
||||
project.findProperty("signingRequired")?.toString()?.toBoolean()
|
||||
?: project.property("isSonatypeRelease") as Boolean
|
||||
}
|
||||
|
||||
configure<SigningExtension> {
|
||||
setRequired(signingRequired)
|
||||
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
||||
useGpgCmd()
|
||||
}
|
||||
|
||||
tasks.withType<Sign>().configureEach {
|
||||
setOnlyIf { signingRequired.get() }
|
||||
}
|
||||
}
|
||||
|
||||
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
|
||||
configure { configureRepository() }
|
||||
|
||||
private fun PublishToMavenRepository.configureRepository() {
|
||||
dependsOn(project.rootProject.tasks.named("preparePublication"))
|
||||
doFirst {
|
||||
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
@@ -51,11 +40,7 @@ fun Task.dependsOnKotlinPluginInstall() {
|
||||
":kotlin-gradle-plugin-model:install",
|
||||
":kotlin-reflect:install",
|
||||
":kotlin-annotation-processing-gradle:install",
|
||||
":kotlin-test:kotlin-test-common:install",
|
||||
":kotlin-test:kotlin-test-annotations-common:install",
|
||||
":kotlin-test:kotlin-test-jvm:install",
|
||||
":kotlin-test:kotlin-test-js:install",
|
||||
":kotlin-test:kotlin-test-junit:install",
|
||||
":kotlin-test:install",
|
||||
":kotlin-gradle-subplugin-example:install",
|
||||
":kotlin-stdlib-common:install",
|
||||
":kotlin-stdlib:install",
|
||||
|
||||
@@ -19,6 +19,10 @@ dependencies {
|
||||
testCompile(project(":kotlin-reflect"))
|
||||
testCompile(projectTests(":compiler:tests-common"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testApi(projectTests(":compiler:test-infrastructure"))
|
||||
testApi(projectTests(":compiler:test-infrastructure-utils"))
|
||||
testApi(projectTests(":compiler:tests-compiler-utils"))
|
||||
testApi(projectTests(":compiler:tests-common-new"))
|
||||
|
||||
testCompile(projectTests(":jps-plugin"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
@@ -37,6 +41,8 @@ dependencies {
|
||||
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
|
||||
testCompile(jpsStandalone()) { includeJars("jps-model") }
|
||||
testCompile(jpsBuildTest())
|
||||
|
||||
testCompile("org.junit.platform:junit-platform-launcher:${commonVer("org.junit.platform", "")}")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -20,7 +20,9 @@ import com.intellij.openapi.util.Ref
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.test.KotlinBaseTest
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.sourceFileProvider
|
||||
import java.io.File
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@@ -34,28 +36,24 @@ private data class OldPackageAndNew(val oldFqName: FqName, val newFqName: FqName
|
||||
|
||||
internal fun patchFilesAndAddTest(
|
||||
testFile: File,
|
||||
testFiles: List<KotlinBaseTest.TestFile>,
|
||||
module: TestModule,
|
||||
services: TestServices,
|
||||
filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter
|
||||
): FqName? {
|
||||
if (testFiles.any { it.name.endsWith(".java") }) {
|
||||
//TODO support java files
|
||||
return null
|
||||
}
|
||||
val ktFiles = testFiles.filter { it.name.endsWith(".kt") }
|
||||
if (ktFiles.isEmpty()) return null
|
||||
|
||||
): FqName {
|
||||
val newPackagePrefix = testFile.path.replace("\\\\|-|\\.|/".toRegex(), "_")
|
||||
val oldPackage = Ref<FqName>()
|
||||
val isJvmName = Ref<Boolean>(false)
|
||||
val testFiles = module.files
|
||||
val isSingle = testFiles.size == 1
|
||||
val resultFiles = testFiles.map {
|
||||
val fileName = if (isSingle) it.name else testFile.name.substringBeforeLast(".kt") + "/" + it.name
|
||||
val content = services.sourceFileProvider.getContentOfSourceFile(it)
|
||||
TestClassInfo(
|
||||
fileName,
|
||||
changePackage(newPackagePrefix, it.content, oldPackage, isJvmName),
|
||||
changePackage(newPackagePrefix, content, oldPackage, isJvmName),
|
||||
oldPackage.get(),
|
||||
isJvmName.get(),
|
||||
getGeneratedClassName(File(fileName), it.content, newPackagePrefix, oldPackage.get())
|
||||
getGeneratedClassName(File(fileName), content, newPackagePrefix, oldPackage.get())
|
||||
)
|
||||
}
|
||||
val packages =
|
||||
|
||||
@@ -16,12 +16,25 @@ 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
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
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
|
||||
import org.jetbrains.kotlin.test.services.*
|
||||
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.impl.BackendKindExtractorImpl
|
||||
import org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl
|
||||
import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider
|
||||
import org.jetbrains.kotlin.test.services.sourceProviders.CodegenHelpersSourceFilesProvider
|
||||
import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
@@ -241,6 +254,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(TestInfrastructureInternals::class)
|
||||
@Throws(IOException::class)
|
||||
private fun processFiles(
|
||||
files: Array<File>,
|
||||
@@ -279,7 +293,8 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
//TODO support JvmPackageName
|
||||
if (fullFileText.contains("@file:JvmPackageName(")) continue
|
||||
// TODO: Support jvm assertions
|
||||
if (fullFileText.contains("// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm")) continue
|
||||
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) }
|
||||
|
||||
@@ -292,31 +307,90 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (fullFileText.contains("// SKIP_JDK6")) continue
|
||||
|
||||
if (hasBoxMethod(fullFileText)) {
|
||||
val testFiles = createTestFiles(file, fullFileText)
|
||||
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
|
||||
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
|
||||
val testConfiguration = createTestConfiguration(file)
|
||||
val services = testConfiguration.testServices
|
||||
|
||||
val moduleStructure = try {
|
||||
testConfiguration.moduleStructureExtractor.splitTestDataByModules(
|
||||
file.path,
|
||||
testConfiguration.directives,
|
||||
).also {
|
||||
services.register(TestModuleStructure::class, it)
|
||||
}
|
||||
} catch (e: ExceptionFromModuleStructureTransformer) {
|
||||
continue
|
||||
}
|
||||
val module = moduleStructure.modules.singleOrNull() ?: continue
|
||||
if (module.files.any { it.isJavaFile || it.isKtsFile }) continue
|
||||
if (module.files.isEmpty()) continue
|
||||
services.registerDependencyProvider(DependencyProviderImpl(services, moduleStructure.modules))
|
||||
|
||||
val keyConfiguration = CompilerConfiguration()
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
|
||||
val configuratorForFlags = JvmEnvironmentConfigurator(services)
|
||||
with(configuratorForFlags) {
|
||||
val extractor = DirectiveToConfigurationKeyExtractor()
|
||||
extractor.provideConfigurationKeys()
|
||||
extractor.configure(keyConfiguration, module.directives)
|
||||
}
|
||||
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
|
||||
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
|
||||
|
||||
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 compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
|
||||
val filesHolder = holders.getOrPut(key) {
|
||||
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind,
|
||||
KtTestUtil.getAnnotationsJar()
|
||||
).apply {
|
||||
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
|
||||
println("Creating new configuration by $key")
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
patchFilesAndAddTest(file, testFiles, filesHolder)
|
||||
patchFilesAndAddTest(file, module, services, filesHolder)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createTestConfiguration(testDataFile: File): TestConfiguration {
|
||||
return TestConfigurationBuilder().apply {
|
||||
testConfiguration()
|
||||
testInfo = KotlinTestInfo(
|
||||
"org.jetbrains.kotlin.android.tests.AndroidRunner",
|
||||
"test${testDataFile.nameWithoutExtension.capitalize()}",
|
||||
emptySet()
|
||||
)
|
||||
}.build(testDataFile.path)
|
||||
}
|
||||
|
||||
private val testConfiguration: TestConfigurationBuilder.() -> Unit = {
|
||||
globalDefaults {
|
||||
frontend = FrontendKinds.ClassicFrontend
|
||||
targetBackend = TargetBackend.ANDROID
|
||||
targetPlatform = JvmPlatforms.defaultJvmPlatform
|
||||
dependencyKind = DependencyKind.Binary
|
||||
}
|
||||
|
||||
useConfigurators(
|
||||
::CommonEnvironmentConfigurator,
|
||||
::JvmEnvironmentConfigurator
|
||||
)
|
||||
|
||||
useAdditionalSourceProviders(
|
||||
::AdditionalDiagnosticsSourceFilesProvider,
|
||||
::CoroutineHelpersSourceFilesProvider,
|
||||
::CodegenHelpersSourceFilesProvider,
|
||||
)
|
||||
|
||||
assertions = JUnit5Assertions
|
||||
useAdditionalService<TemporaryDirectoryManager>(::TemporaryDirectoryManagerImpl)
|
||||
useAdditionalService<BackendKindExtractor>(::BackendKindExtractorImpl)
|
||||
useSourcePreprocessor(*AbstractKotlinCompilerTest.defaultPreprocessors.toTypedArray())
|
||||
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
|
||||
}
|
||||
|
||||
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
|
||||
CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class AsmTypes {
|
||||
private static final Map<Class<?>, Type> TYPES_MAP = new HashMap<>();
|
||||
|
||||
@@ -116,6 +116,12 @@ 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,11 +20,9 @@ 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)
|
||||
@@ -70,12 +68,8 @@ abstract class ArgumentGenerator {
|
||||
generateExpression(declIndex, argument)
|
||||
}
|
||||
is DefaultValueArgument -> {
|
||||
if (calleeDescriptor?.defaultValueFromJava(declIndex) == true) {
|
||||
generateDefaultJava(declIndex, argument)
|
||||
} else {
|
||||
defaultArgs.mark(declIndex)
|
||||
generateDefault(declIndex, argument)
|
||||
}
|
||||
defaultArgs.mark(declIndex)
|
||||
generateDefault(declIndex, argument)
|
||||
}
|
||||
is VarargValueArgument -> {
|
||||
generateVararg(declIndex, argument)
|
||||
@@ -103,10 +97,6 @@ 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")
|
||||
}
|
||||
@@ -116,28 +106,6 @@ 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
|
||||
@@ -155,4 +123,4 @@ fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): Fun
|
||||
function.valueParameters.any { valueParameter -> valueParameter.hasDefaultValue() }
|
||||
}
|
||||
?: functionDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ interface BaseExpressionCodegen {
|
||||
|
||||
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
|
||||
|
||||
@JvmDefault
|
||||
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
|
||||
with(typeSystem) {
|
||||
val (typeParameter, second) = extractReificationArgument(type) ?: return
|
||||
|
||||
@@ -72,12 +72,6 @@ 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,9 +232,7 @@ public class DescriptorAsmUtil {
|
||||
int flags = getVisibilityAccessFlag(functionDescriptor, kind);
|
||||
flags |= getVarargsFlag(functionDescriptor);
|
||||
flags |= getDeprecatedAccessFlag(functionDescriptor);
|
||||
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) ||
|
||||
isInlineWithReified(functionDescriptor) ||
|
||||
functionDescriptor.isSuspend() && functionDescriptor.getVisibility().equals(DescriptorVisibilities.PRIVATE)) {
|
||||
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) || isInlineWithReified(functionDescriptor)) {
|
||||
flags |= ACC_SYNTHETIC;
|
||||
}
|
||||
return flags;
|
||||
@@ -427,10 +425,6 @@ 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,7 +74,10 @@ 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.*;
|
||||
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.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
@@ -85,6 +88,7 @@ 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;
|
||||
@@ -2690,7 +2694,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);
|
||||
@@ -2698,7 +2702,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
fd = SamCodegenUtil.resolveSamAdapter(fd);
|
||||
|
||||
if (ArgumentGeneratorKt.shouldInvokeDefaultArgumentsStub(resolvedCall)) {
|
||||
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
|
||||
if (valueArguments != null && valueArguments.stream().anyMatch(it -> it instanceof DefaultValueArgument)) {
|
||||
// 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
|
||||
@@ -5528,4 +5533,11 @@ 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,8 +1152,10 @@ 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 =
|
||||
DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor)
|
||||
(!isInterface(functionDescriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) &&
|
||||
(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 &&
|
||||
@@ -1685,10 +1687,11 @@ public class FunctionCodegen {
|
||||
|
||||
// Fake overrides in interfaces should be expanded to implementation to make proper default check
|
||||
if (JvmAnnotationUtilKt.checkIsImplementationCompiledToJvmDefault(memberDescriptor, mode)) {
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) ||
|
||||
boolean isSyntheticInCompatibilityOrJvmDefault = isSynthetic && (mode.isCompatibility() || mode == JvmDefaultMode.ENABLE);
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) ||
|
||||
(kind == OwnerKind.DEFAULT_IMPLS &&
|
||||
(isSynthetic || //TODO: move synthetic method generation into interface
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
|
||||
(isSyntheticInCompatibilityOrJvmDefault ||
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))) && !DescriptorVisibilities.isPrivate(memberDescriptor.getVisibility()));
|
||||
} else {
|
||||
switch (kind) {
|
||||
case DEFAULT_IMPLS: return true;
|
||||
|
||||
@@ -660,7 +660,8 @@ 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;
|
||||
|
||||
v.newField(NO_ORIGIN, ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
|
||||
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,
|
||||
"[" + K_PROPERTY_TYPE, null, null);
|
||||
|
||||
if (!state.getClassBuilderMode().generateBodies) return;
|
||||
|
||||
@@ -34,9 +34,13 @@ 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
|
||||
@@ -125,8 +129,19 @@ 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, FACADE_CLASS_ATTRIBUTES,
|
||||
singleSourceFile, state.classFileVersion, attributes,
|
||||
facadeClassType.internalName, null, superClassForFacade, emptyArray()
|
||||
)
|
||||
if (singleSourceFile != null) {
|
||||
@@ -146,6 +161,13 @@ 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,7 +23,6 @@ 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(
|
||||
@@ -65,12 +64,6 @@ 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)
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class OriginCollectingClassBuilderFactory(private val builderMode: ClassBuilderM
|
||||
}
|
||||
|
||||
override fun asBytes(builder: ClassBuilder): ByteArray {
|
||||
val classWriter = ClassWriter(0)
|
||||
val classWriter = ClassWriter(ClassWriter.COMPUTE_FRAMES or ClassWriter.COMPUTE_MAXS)
|
||||
(builder as OriginCollectingClassBuilder).classNode.accept(classWriter)
|
||||
return classWriter.toByteArray()
|
||||
}
|
||||
@@ -66,4 +66,4 @@ class OriginCollectingClassBuilderFactory(private val builderMode: ClassBuilderM
|
||||
override fun asText(builder: ClassBuilder) = throw UnsupportedOperationException()
|
||||
|
||||
override fun close() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,14 +36,16 @@ class SamWrapperClasses(private val state: GenerationState) {
|
||||
expressionCodegen: ExpressionCodegen,
|
||||
contextDescriptor: CallableMemberDescriptor
|
||||
): Type {
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(expressionCodegen.context.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(expressionCodegen.context, state)
|
||||
val parentContext = expressionCodegen.context
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(parentContext.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(parentContext, state)
|
||||
return samInterfaceToWrapperClass.getOrPut(WrapperKey(samType, file, isInsideInline)) {
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, isInsideInline).genWrapper(file, contextDescriptor)
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, parentContext, 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,9 +21,9 @@ 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;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||
@@ -63,6 +63,7 @@ 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";
|
||||
@@ -71,6 +72,7 @@ public class SamWrapperCodegen {
|
||||
@NotNull GenerationState state,
|
||||
@NotNull SamType samType,
|
||||
@NotNull MemberCodegen<?> parentCodegen,
|
||||
@NotNull CodegenContext<?> parentContext,
|
||||
boolean isInsideInline
|
||||
) {
|
||||
this.state = state;
|
||||
@@ -78,8 +80,10 @@ public class SamWrapperCodegen {
|
||||
this.typeMapper = state.getTypeMapper();
|
||||
this.samType = samType;
|
||||
this.parentCodegen = parentCodegen;
|
||||
this.parentContext = parentContext;
|
||||
visibility = isInsideInline ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
|
||||
classFlags = visibility | ACC_FINAL | ACC_SUPER;
|
||||
int synth = state.getLanguageVersionSettings().supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) ? ACC_SYNTHETIC : 0;
|
||||
classFlags = visibility | ACC_FINAL | ACC_SUPER | synth;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -168,7 +172,6 @@ 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;
|
||||
|
||||
@@ -629,7 +629,11 @@ public abstract class StackValue {
|
||||
}
|
||||
|
||||
public static void coerce(@NotNull Type fromType, @NotNull Type toType, @NotNull InstructionAdapter v) {
|
||||
if (toType.equals(fromType)) return;
|
||||
coerce(fromType, toType, v, false);
|
||||
}
|
||||
|
||||
public static void coerce(@NotNull Type fromType, @NotNull Type toType, @NotNull InstructionAdapter v, boolean forceSelfCast) {
|
||||
if (toType.equals(fromType) && !forceSelfCast) return;
|
||||
|
||||
if (toType.getSort() == Type.VOID) {
|
||||
pop(v, fromType);
|
||||
|
||||
@@ -5,18 +5,7 @@
|
||||
|
||||
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
|
||||
|
||||
@@ -86,40 +75,3 @@ 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,6 +24,7 @@ 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;
|
||||
@@ -87,6 +88,7 @@ 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();
|
||||
@@ -97,6 +99,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
this.languageVersionSettings = state.getLanguageVersionSettings();
|
||||
this.classBuilderMode = state.getClassBuilderMode();
|
||||
this.delegatedPropertiesCodegenHelper = new DelegatedPropertiesCodegenHelper(state);
|
||||
jvmDefaultMode = state.getJvmDefaultMode();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -585,7 +588,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
}
|
||||
|
||||
return AsmUtil.asmTypeByClassId(
|
||||
DescriptorUtils.isInterface(descriptor)
|
||||
DescriptorUtils.isInterface(descriptor) && !jvmDefaultMode.getForAllMethodsWithBody()
|
||||
? classId.createNestedClassId(Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME))
|
||||
: classId
|
||||
);
|
||||
|
||||
@@ -721,9 +721,16 @@ 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,
|
||||
suspendFunctionJvmView.unwrapFrontendVersion(),
|
||||
// Obtain default impls method for interfaces
|
||||
isInterfaceMethod
|
||||
)
|
||||
@@ -736,10 +743,10 @@ class CoroutineCodegenForNamedFunction private constructor(
|
||||
|
||||
if (suspendFunctionJvmView.isOverridable && !isInterfaceMethod && captureThisType != null) {
|
||||
val owner = captureThisType.internalName
|
||||
val impl = callableMethod.getAsmMethod().getImplForOpenMethod(owner)
|
||||
val impl = callableAccessorMethod.getAsmMethod().getImplForOpenMethod(owner)
|
||||
codegen.v.invokestatic(owner, impl.name, impl.descriptor, false)
|
||||
} else {
|
||||
callableMethod.genInvokeInstruction(codegen.v)
|
||||
callableAccessorMethod.genInvokeInstruction(codegen.v)
|
||||
}
|
||||
|
||||
if (inlineClassToBoxInInvokeSuspend != null) {
|
||||
|
||||
@@ -1217,6 +1217,27 @@ 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
|
||||
@@ -1237,23 +1258,35 @@ 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
|
||||
val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue
|
||||
// Extend lvt record to the next suspension point
|
||||
val endLabel = min(lvtRecord.end, nextSuspensionPointEndLabel(insn))
|
||||
// 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.
|
||||
var recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && InsnSequence(recordToExtend.end, startLabel).none { isBeforeSuspendMarker(it) }) {
|
||||
val recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && containsSuspensionPoint(recordToExtend.end, startLabel)) {
|
||||
recordToExtend.end = endLabel
|
||||
} else {
|
||||
val node = LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index)
|
||||
method.localVariables.add(node)
|
||||
if (lvtRecord !in oldLvtNodeToLatestNewLvtNode) {
|
||||
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
|
||||
@@ -1262,10 +1295,26 @@ 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,7 +90,10 @@ 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")
|
||||
throw RuntimeException(
|
||||
"Lambda, SAM or anonymous object should have only one constructor.\n" +
|
||||
"First:\n${constructor.nodeText}\n\nSecond:\n${node.nodeText}\n"
|
||||
)
|
||||
}
|
||||
constructor = node
|
||||
} else {
|
||||
@@ -319,7 +322,7 @@ class AnonymousObjectTransformer(
|
||||
), null
|
||||
)
|
||||
|
||||
val result = inliner.doInline(deferringVisitor, LocalVarRemapper(parameters, 0), false, ReturnLabelOwner.NOT_APPLICABLE)
|
||||
val result = inliner.doInline(deferringVisitor, LocalVarRemapper(parameters, 0), false, mapOf())
|
||||
result.reifiedTypeParametersUsages.mergeAll(typeParametersToReify)
|
||||
deferringVisitor.visitMaxs(-1, -1)
|
||||
return result
|
||||
@@ -462,6 +465,29 @@ 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>()
|
||||
@@ -470,10 +496,12 @@ class AnonymousObjectTransformer(
|
||||
val parameterAload = fieldNode.previous as VarInsnNode
|
||||
val varIndex = parameterAload.`var`
|
||||
val functionalArgument = indexToFunctionalArgument[varIndex]
|
||||
val newFieldName = if (isThis0(fieldName) && shouldRenameThis0(parentFieldRemapper, indexToFunctionalArgument.values))
|
||||
getNewFieldName(fieldName, true)
|
||||
else
|
||||
fieldName
|
||||
// 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 info = capturedParamBuilder.addCapturedParam(
|
||||
Type.getObjectType(transformationInfo.oldClassName), fieldName, newFieldName,
|
||||
Type.getType(fieldNode.desc), functionalArgument is LambdaInfo, null
|
||||
@@ -508,35 +536,17 @@ 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 (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>()
|
||||
if (!topLevelInCrossinlineLambda) {
|
||||
val capturedOuterThisTypes = mutableSetOf<String>()
|
||||
for (info in capturedLambdas) {
|
||||
for (desc in info.capturedVars) {
|
||||
val key = desc.fieldName + "$$$" + desc.type.className
|
||||
val alreadyAddedParam = alreadyAdded[key]
|
||||
|
||||
val recapturedParamInfo = capturedParamBuilder.addCapturedParam(
|
||||
desc,
|
||||
alreadyAddedParam?.newFieldName ?: getNewFieldName(desc.fieldName, false),
|
||||
alreadyAddedParam != null
|
||||
)
|
||||
// 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)
|
||||
if (info is ExpressionLambda && info.isCapturedSuspend(desc)) {
|
||||
recapturedParamInfo.functionalArgument = NonInlineableArgumentForInlineableParameterCalledInSuspend
|
||||
}
|
||||
@@ -551,10 +561,6 @@ class AnonymousObjectTransformer(
|
||||
allRecapturedParameters.add(desc)
|
||||
|
||||
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.newFieldName).remapValue = composed
|
||||
|
||||
if (isThis0(desc.fieldName)) {
|
||||
alreadyAdded.put(key, recapturedParamInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (capturedLambdas.isNotEmpty()) {
|
||||
@@ -579,24 +585,6 @@ 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
|
||||
@@ -604,7 +592,4 @@ class AnonymousObjectTransformer(
|
||||
existNames.add(newName)
|
||||
return newName
|
||||
}
|
||||
|
||||
private fun isFirstDeclSiteLambdaFieldRemapper(parentRemapper: FieldRemapper): Boolean =
|
||||
parentRemapper !is RegeneratedLambdaFieldRemapper && parentRemapper !is InlinedLambdaRemapper
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ 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
|
||||
@@ -42,8 +41,6 @@ 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>(
|
||||
@@ -111,11 +108,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
)
|
||||
}
|
||||
|
||||
protected fun generateStub(resolvedCall: ResolvedCall<*>?, codegen: BaseExpressionCodegen) {
|
||||
protected fun generateStub(text: String, codegen: BaseExpressionCodegen) {
|
||||
leaveTemps()
|
||||
assert(resolvedCall != null)
|
||||
val message = "Call is part of inline cycle: " + resolvedCall!!.call.callElement.text
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message)
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", "Call is part of inline cycle: $text")
|
||||
}
|
||||
|
||||
protected fun endCall(result: InlineResult, registerLineNumberAfterwards: Boolean) {
|
||||
@@ -243,12 +238,10 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
//hack to keep linenumber info, otherwise jdi will skip begin of linenumber chain
|
||||
adapter.visitInsn(Opcodes.NOP)
|
||||
|
||||
val result = inliner.doInline(adapter, remapper, true, ReturnLabelOwner.SKIP_ALL)
|
||||
val result = inliner.doInline(adapter, remapper, true, mapOf())
|
||||
result.reifiedTypeParametersUsages.mergeAll(reificationResult)
|
||||
|
||||
val labels = sourceCompiler.getContextLabels()
|
||||
|
||||
val infos = MethodInliner.processReturns(adapter, ReturnLabelOwner { labels.contains(it) }, true, null)
|
||||
val infos = MethodInliner.processReturns(adapter, sourceCompiler.getContextLabels(), null)
|
||||
generateAndInsertFinallyBlocks(
|
||||
adapter, infos, (remapper.remap(parameters.argsSizeOnStack + 1).value as StackValue.Local).index
|
||||
)
|
||||
@@ -319,7 +312,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
frameMap.enterTemp(Type.INT_TYPE)
|
||||
}
|
||||
|
||||
sourceCompiler.generateFinallyBlocksIfNeeded(finallyCodegen, extension.returnType, extension.finallyIntervalEnd.label)
|
||||
sourceCompiler.generateFinallyBlocksIfNeeded(
|
||||
finallyCodegen, extension.returnType, extension.finallyIntervalEnd.label, extension.jumpTarget
|
||||
)
|
||||
|
||||
//Exception table for external try/catch/finally blocks will be generated in original codegen after exiting this method
|
||||
insertNodeBefore(finallyNode, intoNode, curInstr)
|
||||
@@ -639,35 +634,17 @@ 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)
|
||||
var methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
|
||||
val methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
|
||||
if (methodNode == null && requiresFunctionNameManglingForReturnType(callableDescriptor)) {
|
||||
val nameWithoutManglingSuffix = asmMethod.name.stripManglingSuffixOrNull()
|
||||
if (nameWithoutManglingSuffix != null) {
|
||||
methodNode = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
|
||||
}
|
||||
if (methodNode == null) {
|
||||
val nameWithImplSuffix = "$nameWithoutManglingSuffix-impl"
|
||||
methodNode = getMethodNode(bytes, nameWithImplSuffix, asmMethod.descriptor, classType)
|
||||
val methodWithoutMangling = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
|
||||
if (methodWithoutMangling != null) return methodWithoutMangling
|
||||
}
|
||||
return getMethodNode(bytes, "$nameWithoutManglingSuffix-impl", asmMethod.descriptor, classType)
|
||||
}
|
||||
|
||||
return methodNode
|
||||
}
|
||||
|
||||
|
||||
@@ -30,17 +30,14 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCallWithAssert
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.*
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
interface FunctionalArgument
|
||||
|
||||
abstract class LambdaInfo(@JvmField val isCrossInline: Boolean) : FunctionalArgument, ReturnLabelOwner {
|
||||
abstract class LambdaInfo(@JvmField val isCrossInline: Boolean) : FunctionalArgument {
|
||||
|
||||
abstract val isBoundCallableReference: Boolean
|
||||
|
||||
@@ -54,6 +51,9 @@ abstract class LambdaInfo(@JvmField val isCrossInline: Boolean) : FunctionalArgu
|
||||
|
||||
abstract val capturedVars: List<CapturedParamDesc>
|
||||
|
||||
open val returnLabels: Map<String, Label?>
|
||||
get() = mapOf()
|
||||
|
||||
lateinit var node: SMAPAndMethodNode
|
||||
|
||||
abstract fun generateLambdaBody(sourceCompiler: SourceCompilerForInline, reifiedTypeInliner: ReifiedTypeInliner<*>)
|
||||
@@ -129,8 +129,6 @@ abstract class DefaultLambda(
|
||||
final override lateinit var capturedVars: List<CapturedParamDesc>
|
||||
private set
|
||||
|
||||
override fun isReturnFromMe(labelName: String): Boolean = false
|
||||
|
||||
var originalBoundReceiverType: Type? = null
|
||||
private set
|
||||
|
||||
@@ -247,7 +245,7 @@ class PsiExpressionLambda(
|
||||
|
||||
val functionWithBodyOrCallableReference: KtExpression = (expression as? KtLambdaExpression)?.functionLiteral ?: expression
|
||||
|
||||
private val labels: Set<String>
|
||||
override val returnLabels: Map<String, Label?>
|
||||
|
||||
override val isSuspend: Boolean
|
||||
|
||||
@@ -284,7 +282,7 @@ class PsiExpressionLambda(
|
||||
closure = it!!
|
||||
}
|
||||
|
||||
labels = InlineCodegen.getDeclarationLabels(expression, invokeMethodDescriptor)
|
||||
returnLabels = InlineCodegen.getDeclarationLabels(expression, invokeMethodDescriptor).associateWith { null }
|
||||
invokeMethod = typeMapper.mapAsmMethod(invokeMethodDescriptor)
|
||||
isSuspend = invokeMethodDescriptor.isSuspend
|
||||
}
|
||||
@@ -324,10 +322,6 @@ class PsiExpressionLambda(
|
||||
}
|
||||
}
|
||||
|
||||
override fun isReturnFromMe(labelName: String): Boolean {
|
||||
return labels.contains(labelName)
|
||||
}
|
||||
|
||||
val isPropertyReference: Boolean
|
||||
get() = propertyReferenceInfo != null
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.codegen.optimization.common.isMeaningful
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.peek
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.top
|
||||
import org.jetbrains.kotlin.codegen.optimization.nullCheck.isCheckParameterIsNotNull
|
||||
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsn
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
||||
@@ -72,9 +73,9 @@ class MethodInliner(
|
||||
adapter: MethodVisitor,
|
||||
remapper: LocalVarRemapper,
|
||||
remapReturn: Boolean,
|
||||
returnLabelOwner: ReturnLabelOwner
|
||||
returnLabels: Map<String, Label?>
|
||||
): InlineResult {
|
||||
return doInline(adapter, remapper, remapReturn, returnLabelOwner, 0)
|
||||
return doInline(adapter, remapper, remapReturn, returnLabels, 0)
|
||||
}
|
||||
|
||||
private fun recordTransformation(info: TransformationInfo) {
|
||||
@@ -91,11 +92,11 @@ class MethodInliner(
|
||||
adapter: MethodVisitor,
|
||||
remapper: LocalVarRemapper,
|
||||
remapReturn: Boolean,
|
||||
returnLabelOwner: ReturnLabelOwner,
|
||||
returnLabels: Map<String, Label?>,
|
||||
finallyDeepShift: Int
|
||||
): InlineResult {
|
||||
//analyze body
|
||||
var transformedNode = markPlacesForInlineAndRemoveInlinable(node, returnLabelOwner, finallyDeepShift)
|
||||
var transformedNode = markPlacesForInlineAndRemoveInlinable(node, returnLabels, finallyDeepShift)
|
||||
if (inliningContext.isInliningLambda && isDefaultLambdaWithReification(inliningContext.lambdaInfo!!)) {
|
||||
//TODO maybe move reification in one place
|
||||
inliningContext.root.inlineMethodReifier.reifyInstructions(transformedNode)
|
||||
@@ -139,7 +140,9 @@ class MethodInliner(
|
||||
)
|
||||
}
|
||||
|
||||
processReturns(resultNode, returnLabelOwner, remapReturn, end)
|
||||
if (remapReturn) {
|
||||
processReturns(resultNode, returnLabels, end)
|
||||
}
|
||||
//flush transformed node to output
|
||||
resultNode.accept(SkipMaxAndEndVisitor(adapter))
|
||||
return result
|
||||
@@ -297,7 +300,7 @@ class MethodInliner(
|
||||
|
||||
val varRemapper = LocalVarRemapper(lambdaParameters, valueParamShift)
|
||||
//TODO add skipped this and receiver
|
||||
val lambdaResult = inliner.doInline(localVariablesSorter, varRemapper, true, info, invokeCall.finallyDepthShift)
|
||||
val lambdaResult = inliner.doInline(localVariablesSorter, varRemapper, true, info.returnLabels, invokeCall.finallyDepthShift)
|
||||
result.mergeWithNotChangeInfo(lambdaResult)
|
||||
result.reifiedTypeParametersUsages.mergeAll(lambdaResult.reifiedTypeParametersUsages)
|
||||
|
||||
@@ -486,11 +489,11 @@ class MethodInliner(
|
||||
}
|
||||
|
||||
private fun markPlacesForInlineAndRemoveInlinable(
|
||||
node: MethodNode, returnLabelOwner: ReturnLabelOwner, finallyDeepShift: Int
|
||||
node: MethodNode, returnLabels: Map<String, Label?>, finallyDeepShift: Int
|
||||
): MethodNode {
|
||||
val processingNode = prepareNode(node, finallyDeepShift)
|
||||
|
||||
preprocessNodeBeforeInline(processingNode, returnLabelOwner)
|
||||
preprocessNodeBeforeInline(processingNode, returnLabels)
|
||||
|
||||
replaceContinuationAccessesWithFakeContinuationsIfNeeded(processingNode)
|
||||
|
||||
@@ -765,7 +768,7 @@ class MethodInliner(
|
||||
}
|
||||
}
|
||||
|
||||
private fun preprocessNodeBeforeInline(node: MethodNode, returnLabelOwner: ReturnLabelOwner) {
|
||||
private fun preprocessNodeBeforeInline(node: MethodNode, returnLabels: Map<String, Label?>) {
|
||||
try {
|
||||
FixStackWithLabelNormalizationMethodTransformer().transform("fake", node)
|
||||
} catch (e: Throwable) {
|
||||
@@ -787,16 +790,13 @@ class MethodInliner(
|
||||
|
||||
if (!isReturnOpcode(insnNode.opcode)) continue
|
||||
|
||||
var insertBeforeInsn = insnNode
|
||||
|
||||
// TODO extract isLocalReturn / isNonLocalReturn, see processReturns
|
||||
val labelName = getMarkedReturnLabelOrNull(insnNode)
|
||||
if (labelName != null) {
|
||||
if (!returnLabelOwner.isReturnFromMe(labelName)) continue
|
||||
insertBeforeInsn = insnNode.previous
|
||||
if (labelName == null) {
|
||||
localReturnsNormalizer.addLocalReturnToTransform(insnNode, insnNode, frame)
|
||||
} else if (labelName in returnLabels) {
|
||||
localReturnsNormalizer.addLocalReturnToTransform(insnNode, insnNode.previous, frame)
|
||||
}
|
||||
|
||||
localReturnsNormalizer.addLocalReturnToTransform(insnNode, insertBeforeInsn, frame)
|
||||
}
|
||||
|
||||
localReturnsNormalizer.transform(node)
|
||||
@@ -1001,7 +1001,8 @@ class MethodInliner(
|
||||
class PointForExternalFinallyBlocks(
|
||||
@JvmField val beforeIns: AbstractInsnNode,
|
||||
@JvmField val returnType: Type,
|
||||
@JvmField val finallyIntervalEnd: LabelNode
|
||||
@JvmField val finallyIntervalEnd: LabelNode,
|
||||
@JvmField val jumpTarget: Label?
|
||||
)
|
||||
|
||||
companion object {
|
||||
@@ -1115,55 +1116,44 @@ class MethodInliner(
|
||||
//process local and global returns (local substituted with goto end-label global kept unchanged)
|
||||
@JvmStatic
|
||||
fun processReturns(
|
||||
node: MethodNode, returnLabelOwner: ReturnLabelOwner, remapReturn: Boolean, endLabel: Label?
|
||||
node: MethodNode, returnLabels: Map<String, Label?>, endLabel: Label?
|
||||
): List<PointForExternalFinallyBlocks> {
|
||||
if (!remapReturn) {
|
||||
return emptyList()
|
||||
}
|
||||
val result = ArrayList<PointForExternalFinallyBlocks>()
|
||||
val instructions = node.instructions
|
||||
var insnNode: AbstractInsnNode? = instructions.first
|
||||
while (insnNode != null) {
|
||||
if (isReturnOpcode(insnNode.opcode)) {
|
||||
var isLocalReturn = true
|
||||
val labelName = getMarkedReturnLabelOrNull(insnNode)
|
||||
val returnType = getReturnType(insnNode.opcode)
|
||||
|
||||
if (labelName != null) {
|
||||
isLocalReturn = returnLabelOwner.isReturnFromMe(labelName)
|
||||
//remove global return flag
|
||||
if (isLocalReturn) {
|
||||
instructions.remove(insnNode.previous)
|
||||
}
|
||||
val isLocalReturn = labelName == null || labelName in returnLabels
|
||||
val jumpTarget = returnLabels[labelName] ?: endLabel
|
||||
|
||||
if (isLocalReturn && labelName != null) {
|
||||
// remove non-local return flag
|
||||
instructions.remove(insnNode.previous)
|
||||
}
|
||||
|
||||
if (isLocalReturn && endLabel != null) {
|
||||
val nop = InsnNode(Opcodes.NOP)
|
||||
instructions.insert(insnNode, nop)
|
||||
|
||||
val labelNode = endLabel.info as LabelNode
|
||||
val jumpInsnNode = JumpInsnNode(Opcodes.GOTO, labelNode)
|
||||
instructions.insert(nop, jumpInsnNode)
|
||||
|
||||
if (isLocalReturn && jumpTarget != null) {
|
||||
val jumpInsnNode = JumpInsnNode(Opcodes.GOTO, jumpTarget.info as LabelNode)
|
||||
instructions.insertBefore(insnNode, InsnNode(Opcodes.NOP))
|
||||
if (jumpTarget != endLabel) {
|
||||
instructions.insertBefore(insnNode, PseudoInsn.FIX_STACK_BEFORE_JUMP.createInsnNode())
|
||||
}
|
||||
instructions.insertBefore(insnNode, jumpInsnNode)
|
||||
instructions.remove(insnNode)
|
||||
insnNode = jumpInsnNode
|
||||
}
|
||||
|
||||
//generate finally block before nonLocalReturn flag/return/goto
|
||||
val label = LabelNode()
|
||||
instructions.insert(insnNode, label)
|
||||
result.add(
|
||||
PointForExternalFinallyBlocks(
|
||||
getInstructionToInsertFinallyBefore(insnNode, isLocalReturn), getReturnType(insnNode.opcode), label
|
||||
)
|
||||
)
|
||||
// generate finally blocks before the non-local return flag or the stack fixup pseudo instruction
|
||||
val finallyInsertionPoint = if (isLocalReturn && jumpTarget == endLabel) insnNode else insnNode.previous
|
||||
result.add(PointForExternalFinallyBlocks(finallyInsertionPoint, returnType, label, jumpTarget))
|
||||
}
|
||||
insnNode = insnNode.next
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun getInstructionToInsertFinallyBefore(nonLocalReturnOrJump: AbstractInsnNode, isLocal: Boolean): AbstractInsnNode {
|
||||
return if (isLocal) nonLocalReturnOrJump else nonLocalReturnOrJump.previous
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ class PsiInlineCodegen(
|
||||
callDefault: Boolean,
|
||||
codegen: ExpressionCodegen
|
||||
) {
|
||||
if (!state.globalInlineContext.enterIntoInlining(resolvedCall?.resultingDescriptor, resolvedCall?.call?.callElement)) {
|
||||
generateStub(resolvedCall, codegen)
|
||||
if (!state.globalInlineContext.enterIntoInlining(functionDescriptor, resolvedCall?.call?.callElement)) {
|
||||
generateStub(resolvedCall?.call?.callElement?.text ?: "<no source>", codegen)
|
||||
return
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -1,29 +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.codegen.inline;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ReturnLabelOwner {
|
||||
boolean isReturnFromMe(@NotNull String labelName);
|
||||
|
||||
ReturnLabelOwner SKIP_ALL = name -> false;
|
||||
|
||||
ReturnLabelOwner NOT_APPLICABLE = name -> {
|
||||
throw new RuntimeException("This operation not applicable for current context");
|
||||
};
|
||||
}
|
||||
@@ -64,7 +64,7 @@ interface SourceCompilerForInline {
|
||||
curFinallyDepth: Int
|
||||
): BaseExpressionCodegen
|
||||
|
||||
fun generateFinallyBlocksIfNeeded(finallyCodegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label)
|
||||
fun generateFinallyBlocksIfNeeded(codegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label, target: Label?)
|
||||
|
||||
fun isCallInsideSameModuleAsDeclared(functionDescriptor: FunctionDescriptor): Boolean
|
||||
|
||||
@@ -74,7 +74,7 @@ interface SourceCompilerForInline {
|
||||
|
||||
val compilationContextFunctionDescriptor: FunctionDescriptor
|
||||
|
||||
fun getContextLabels(): Set<String>
|
||||
fun getContextLabels(): Map<String, Label?>
|
||||
|
||||
fun reportSuspensionPointInsideMonitor(stackTraceElement: String)
|
||||
}
|
||||
@@ -311,9 +311,10 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
|
||||
|
||||
override fun hasFinallyBlocks() = codegen.hasFinallyBlocks()
|
||||
|
||||
override fun generateFinallyBlocksIfNeeded(finallyCodegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label) {
|
||||
require(finallyCodegen is ExpressionCodegen)
|
||||
finallyCodegen.generateFinallyBlocksIfNeeded(returnType, null, afterReturnLabel)
|
||||
override fun generateFinallyBlocksIfNeeded(codegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label, target: Label?) {
|
||||
// TODO use the target label for non-local break/continue
|
||||
require(codegen is ExpressionCodegen)
|
||||
codegen.generateFinallyBlocksIfNeeded(returnType, null, afterReturnLabel)
|
||||
}
|
||||
|
||||
override fun createCodegenForExternalFinallyBlockGenerationOnNonLocalReturn(finallyNode: MethodNode, curFinallyDepth: Int) =
|
||||
@@ -337,14 +338,15 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
|
||||
override val compilationContextFunctionDescriptor
|
||||
get() = codegen.getContext().functionDescriptor
|
||||
|
||||
override fun getContextLabels(): Set<String> {
|
||||
override fun getContextLabels(): Map<String, Label?> {
|
||||
val context = codegen.getContext()
|
||||
val parentContext = context.parentContext
|
||||
val descriptor = if (parentContext is ClosureContext && parentContext.originalSuspendLambdaDescriptor != null) {
|
||||
parentContext.originalSuspendLambdaDescriptor!!
|
||||
} else context.contextDescriptor
|
||||
|
||||
return InlineCodegen.getDeclarationLabels(DescriptorToSourceUtils.descriptorToDeclaration(descriptor), descriptor)
|
||||
val labels = InlineCodegen.getDeclarationLabels(DescriptorToSourceUtils.descriptorToDeclaration(descriptor), descriptor)
|
||||
return labels.associateWith { null } // TODO add break/continue labels
|
||||
}
|
||||
|
||||
fun initializeInlineFunctionContext(functionDescriptor: FunctionDescriptor) {
|
||||
|
||||
@@ -84,9 +84,11 @@ private fun createSpecialEnumMethodBody(
|
||||
Opcodes.INVOKESTATIC, ENUM_TYPE.internalName, "valueOf",
|
||||
Type.getMethodDescriptor(ENUM_TYPE, JAVA_CLASS_TYPE, JAVA_STRING_TYPE), false
|
||||
)
|
||||
node.visitTypeInsn(Opcodes.CHECKCAST, ENUM_TYPE.internalName)
|
||||
} else {
|
||||
node.visitInsn(Opcodes.ICONST_0)
|
||||
node.visitTypeInsn(Opcodes.ANEWARRAY, ENUM_TYPE.internalName)
|
||||
node.visitTypeInsn(Opcodes.CHECKCAST, AsmUtil.getArrayType(ENUM_TYPE).internalName)
|
||||
}
|
||||
node.visitInsn(Opcodes.ARETURN)
|
||||
node.visitMaxs(if (isValueOf) 3 else 2, if (isValueOf) 1 else 0)
|
||||
|
||||
@@ -37,17 +37,9 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
|
||||
// Tracks proper usages of objects corresponding to captured variables.
|
||||
//
|
||||
// The 'kotlin.jvm.internal.Ref.*' instance can be replaced with a local variable,
|
||||
// if all of the following conditions are satisfied:
|
||||
// * It is created inside a current method.
|
||||
// * The only permitted operations on it are:
|
||||
// - store to a local variable
|
||||
// - ALOAD, ASTORE
|
||||
// - DUP, POP
|
||||
// - GETFIELD <owner>.element, PUTFIELD <owner>.element
|
||||
// * There's a corresponding local variable definition,
|
||||
// and all ALOAD/ASTORE instructions operate on that particular local variable.
|
||||
// * Its 'element' field is initialized at start of local variable visibility range.
|
||||
// The 'kotlin.jvm.internal.Ref.*' instance can be replaced with a local variable, if
|
||||
// * it is created inside a current method;
|
||||
// * the only operations on it are ALOAD, ASTORE, DUP, POP, GETFIELD element, PUTFIELD element.
|
||||
//
|
||||
// Note that for code that doesn't create Ref objects explicitly these conditions are true,
|
||||
// unless the Ref object escapes to a local class constructor (including local classes for lambdas).
|
||||
@@ -58,47 +50,43 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
var initCallInsn: MethodInsnNode? = null
|
||||
var localVar: LocalVariableNode? = null
|
||||
var localVarIndex = -1
|
||||
val astoreInsns: MutableCollection<VarInsnNode> = LinkedHashSet()
|
||||
val aloadInsns: MutableCollection<VarInsnNode> = LinkedHashSet()
|
||||
val stackInsns: MutableCollection<AbstractInsnNode> = LinkedHashSet()
|
||||
val wrapperInsns: MutableCollection<AbstractInsnNode> = LinkedHashSet()
|
||||
val getFieldInsns: MutableCollection<FieldInsnNode> = LinkedHashSet()
|
||||
val putFieldInsns: MutableCollection<FieldInsnNode> = LinkedHashSet()
|
||||
var cleanVarInstruction: VarInsnNode? = null
|
||||
|
||||
fun canRewrite(): Boolean =
|
||||
!hazard &&
|
||||
initCallInsn != null &&
|
||||
localVar != null &&
|
||||
localVarIndex >= 0
|
||||
|
||||
override fun onUseAsTainted() {
|
||||
hazard = true
|
||||
}
|
||||
|
||||
fun canRewrite() = !hazard && initCallInsn != null
|
||||
}
|
||||
|
||||
private class Transformer(private val internalClassName: String, private val methodNode: MethodNode) {
|
||||
private val refValues = ArrayList<CapturedVarDescriptor>()
|
||||
private val refValuesByNewInsn = LinkedHashMap<TypeInsnNode, CapturedVarDescriptor>()
|
||||
private val insns = methodNode.instructions.toArray()
|
||||
private lateinit var frames: Array<out Frame<BasicValue>?>
|
||||
|
||||
val hasRewritableRefValues: Boolean
|
||||
get() = refValues.isNotEmpty()
|
||||
|
||||
fun run() {
|
||||
createRefValues()
|
||||
if (!hasRewritableRefValues) return
|
||||
if (refValues.isEmpty()) return
|
||||
|
||||
analyze()
|
||||
if (!hasRewritableRefValues) return
|
||||
val frames = analyze(internalClassName, methodNode, Interpreter())
|
||||
trackPops(frames)
|
||||
assignLocalVars(frames)
|
||||
|
||||
rewrite()
|
||||
for (refValue in refValues) {
|
||||
if (refValue.canRewrite()) {
|
||||
rewriteRefValue(refValue)
|
||||
}
|
||||
}
|
||||
|
||||
methodNode.removeEmptyCatchBlocks()
|
||||
methodNode.removeUnusedLocalVariables()
|
||||
}
|
||||
|
||||
private fun AbstractInsnNode.getIndex() = methodNode.instructions.indexOf(this)
|
||||
|
||||
private fun createRefValues() {
|
||||
for (insn in insns) {
|
||||
for (insn in methodNode.instructions.asSequence()) {
|
||||
if (insn.opcode == Opcodes.NEW && insn is TypeInsnNode) {
|
||||
val type = Type.getObjectType(insn.desc)
|
||||
if (AsmTypes.isSharedVarType(type)) {
|
||||
@@ -113,19 +101,15 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
|
||||
private inner class Interpreter : ReferenceTrackingInterpreter() {
|
||||
override fun newOperation(insn: AbstractInsnNode): BasicValue =
|
||||
refValuesByNewInsn[insn]?.let { descriptor ->
|
||||
ProperTrackedReferenceValue(descriptor.refType, descriptor)
|
||||
}
|
||||
?: super.newOperation(insn)
|
||||
refValuesByNewInsn[insn]?.let { ProperTrackedReferenceValue(it.refType, it) } ?: super.newOperation(insn)
|
||||
|
||||
override fun processRefValueUsage(value: TrackedReferenceValue, insn: AbstractInsnNode, position: Int) {
|
||||
for (descriptor in value.descriptors) {
|
||||
if (descriptor !is CapturedVarDescriptor) throw AssertionError("Unexpected descriptor: $descriptor")
|
||||
when {
|
||||
insn.opcode == Opcodes.ALOAD ->
|
||||
descriptor.aloadInsns.add(insn as VarInsnNode)
|
||||
insn.opcode == Opcodes.ASTORE ->
|
||||
descriptor.astoreInsns.add(insn as VarInsnNode)
|
||||
insn.opcode == Opcodes.DUP -> descriptor.wrapperInsns.add(insn)
|
||||
insn.opcode == Opcodes.ALOAD -> descriptor.wrapperInsns.add(insn)
|
||||
insn.opcode == Opcodes.ASTORE -> descriptor.wrapperInsns.add(insn)
|
||||
insn.opcode == Opcodes.GETFIELD && insn is FieldInsnNode && insn.name == REF_ELEMENT_FIELD && position == 0 ->
|
||||
descriptor.getFieldInsns.add(insn)
|
||||
insn.opcode == Opcodes.PUTFIELD && insn is FieldInsnNode && insn.name == REF_ELEMENT_FIELD && position == 0 ->
|
||||
@@ -135,32 +119,18 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
descriptor.hazard = true
|
||||
else
|
||||
descriptor.initCallInsn = insn
|
||||
insn.opcode == Opcodes.DUP ->
|
||||
descriptor.stackInsns.add(insn)
|
||||
else ->
|
||||
descriptor.hazard = true
|
||||
else -> descriptor.hazard = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun analyze() {
|
||||
frames = MethodTransformer.analyze(internalClassName, methodNode, Interpreter())
|
||||
trackPops()
|
||||
assignLocalVars()
|
||||
|
||||
refValues.removeAll { !it.canRewrite() }
|
||||
}
|
||||
|
||||
private fun trackPops() {
|
||||
for (i in insns.indices) {
|
||||
private fun trackPops(frames: Array<out Frame<BasicValue>?>) {
|
||||
for ((i, insn) in methodNode.instructions.asSequence().withIndex()) {
|
||||
val frame = frames[i] ?: continue
|
||||
val insn = insns[i]
|
||||
|
||||
when (insn.opcode) {
|
||||
Opcodes.POP -> {
|
||||
frame.top()?.getCapturedVarOrNull()?.run { stackInsns.add(insn) }
|
||||
frame.top()?.getCapturedVarOrNull()?.run { wrapperInsns.add(insn) }
|
||||
}
|
||||
Opcodes.POP2 -> {
|
||||
val top = frame.top()
|
||||
@@ -176,7 +146,7 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
private fun BasicValue.getCapturedVarOrNull() =
|
||||
safeAs<ProperTrackedReferenceValue>()?.descriptor?.safeAs<CapturedVarDescriptor>()
|
||||
|
||||
private fun assignLocalVars() {
|
||||
private fun assignLocalVars(frames: Array<out Frame<BasicValue>?>) {
|
||||
for (localVar in methodNode.localVariables) {
|
||||
val type = Type.getType(localVar.desc)
|
||||
if (!AsmTypes.isSharedVarType(type)) continue
|
||||
@@ -197,51 +167,20 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
|
||||
for (refValue in refValues) {
|
||||
if (refValue.hazard) continue
|
||||
val localVar = refValue.localVar ?: continue
|
||||
val oldVarIndex = localVar.index
|
||||
|
||||
if (refValue.valueType.size != 1) {
|
||||
if (refValue.localVar == null || refValue.valueType.size != 1) {
|
||||
refValue.localVarIndex = methodNode.maxLocals
|
||||
methodNode.maxLocals += 2
|
||||
localVar.index = refValue.localVarIndex
|
||||
methodNode.maxLocals += refValue.valueType.size
|
||||
} else {
|
||||
refValue.localVarIndex = localVar.index
|
||||
refValue.localVarIndex = refValue.localVar!!.index
|
||||
}
|
||||
|
||||
val cleanInstructions = findCleanInstructions(refValue, oldVarIndex, methodNode.instructions)
|
||||
if (cleanInstructions.size > 1) {
|
||||
refValue.hazard = true
|
||||
continue
|
||||
}
|
||||
refValue.cleanVarInstruction = cleanInstructions.firstOrNull()
|
||||
}
|
||||
}
|
||||
|
||||
private fun findCleanInstructions(refValue: CapturedVarDescriptor, oldVarIndex: Int, instructions: InsnList): List<VarInsnNode> {
|
||||
return InsnSequence(instructions).filterIsInstance<VarInsnNode>().filter {
|
||||
it.opcode == Opcodes.ASTORE && it.`var` == oldVarIndex
|
||||
}.filter {
|
||||
it.previous?.opcode == Opcodes.ACONST_NULL
|
||||
}.filter {
|
||||
val operationIndex = instructions.indexOf(it)
|
||||
val localVariableNode = refValue.localVar!!
|
||||
instructions.indexOf(localVariableNode.start) < operationIndex && operationIndex < instructions.indexOf(
|
||||
localVariableNode.end
|
||||
)
|
||||
}.toList()
|
||||
}
|
||||
|
||||
private fun rewrite() {
|
||||
for (refValue in refValues) {
|
||||
if (!refValue.canRewrite()) continue
|
||||
|
||||
rewriteRefValue(refValue)
|
||||
private fun LocalVariableNode.findCleanInstructions() =
|
||||
InsnSequence(methodNode.instructions).dropWhile { it != start }.takeWhile { it != end }.filter {
|
||||
it is VarInsnNode && it.opcode == Opcodes.ASTORE && it.`var` == index && it.previous?.opcode == Opcodes.ACONST_NULL
|
||||
}
|
||||
|
||||
methodNode.removeEmptyCatchBlocks()
|
||||
methodNode.removeUnusedLocalVariables()
|
||||
}
|
||||
|
||||
// Be careful to not remove instructions that are the only instruction for a line number. That will
|
||||
// break debugging. If the previous instruction is a line number and the following instruction is
|
||||
// a label followed by a line number, insert a nop instead of deleting the instruction.
|
||||
@@ -255,34 +194,38 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
|
||||
|
||||
private fun rewriteRefValue(capturedVar: CapturedVarDescriptor) {
|
||||
methodNode.instructions.run {
|
||||
val localVar = capturedVar.localVar!!
|
||||
localVar.signature = null
|
||||
localVar.desc = capturedVar.valueType.descriptor
|
||||
|
||||
val loadOpcode = capturedVar.valueType.getOpcode(Opcodes.ILOAD)
|
||||
val storeOpcode = capturedVar.valueType.getOpcode(Opcodes.ISTORE)
|
||||
|
||||
if (capturedVar.putFieldInsns.none { it.getIndex() < localVar.start.getIndex() }) {
|
||||
// variable needs to be initialized before its live range can begin
|
||||
insertBefore(capturedVar.newInsn, InsnNode(AsmUtil.defaultValueOpcode(capturedVar.valueType)))
|
||||
insertBefore(capturedVar.newInsn, VarInsnNode(storeOpcode, capturedVar.localVarIndex))
|
||||
val localVar = capturedVar.localVar
|
||||
if (localVar != null) {
|
||||
if (capturedVar.putFieldInsns.none { it.getIndex() < localVar.start.getIndex() }) {
|
||||
// variable needs to be initialized before its live range can begin
|
||||
insertBefore(capturedVar.newInsn, InsnNode(AsmUtil.defaultValueOpcode(capturedVar.valueType)))
|
||||
insertBefore(capturedVar.newInsn, VarInsnNode(storeOpcode, capturedVar.localVarIndex))
|
||||
}
|
||||
|
||||
for (insn in localVar.findCleanInstructions()) {
|
||||
// after visiting block codegen tries to delete all allocated references:
|
||||
// see ExpressionCodegen.addLeaveTaskToRemoveLocalVariableFromFrameMap
|
||||
if (storeOpcode == Opcodes.ASTORE) {
|
||||
set(insn.previous, InsnNode(AsmUtil.defaultValueOpcode(capturedVar.valueType)))
|
||||
} else {
|
||||
remove(insn.previous)
|
||||
remove(insn)
|
||||
}
|
||||
}
|
||||
|
||||
localVar.index = capturedVar.localVarIndex
|
||||
localVar.desc = capturedVar.valueType.descriptor
|
||||
localVar.signature = null
|
||||
}
|
||||
|
||||
remove(capturedVar.newInsn)
|
||||
remove(capturedVar.initCallInsn!!)
|
||||
|
||||
capturedVar.stackInsns.forEach { removeOrReplaceByNop(it) }
|
||||
capturedVar.aloadInsns.forEach { removeOrReplaceByNop(it) }
|
||||
capturedVar.astoreInsns.forEach { removeOrReplaceByNop(it) }
|
||||
capturedVar.wrapperInsns.forEach { removeOrReplaceByNop(it) }
|
||||
capturedVar.getFieldInsns.forEach { set(it, VarInsnNode(loadOpcode, capturedVar.localVarIndex)) }
|
||||
capturedVar.putFieldInsns.forEach { set(it, VarInsnNode(storeOpcode, capturedVar.localVarIndex)) }
|
||||
|
||||
//after visiting block codegen tries to delete all allocated references:
|
||||
// see ExpressionCodegen.addLeaveTaskToRemoveLocalVariableFromFrameMap
|
||||
capturedVar.cleanVarInstruction?.let {
|
||||
remove(it.previous)
|
||||
remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ import org.jetbrains.org.objectweb.asm.tree.TypeInsnNode
|
||||
class RedundantCheckCastEliminationMethodTransformer : MethodTransformer() {
|
||||
override fun transform(internalClassName: String, methodNode: MethodNode) {
|
||||
val insns = methodNode.instructions.toArray()
|
||||
if (!insns.any { it.opcode == Opcodes.CHECKCAST }) return
|
||||
if (!insns.any { it.opcode == Opcodes.CHECKCAST}) return
|
||||
if (insns.any { ReifiedTypeInliner.isOperationReifiedMarker(it) }) return
|
||||
|
||||
val redundantCheckCasts = ArrayList<TypeInsnNode>()
|
||||
|
||||
@@ -36,7 +37,6 @@ class RedundantCheckCastEliminationMethodTransformer : MethodTransformer() {
|
||||
for (i in insns.indices) {
|
||||
val valueType = frames[i]?.top()?.type ?: continue
|
||||
val insn = insns[i]
|
||||
if (ReifiedTypeInliner.isOperationReifiedMarker(insn.previous)) continue
|
||||
|
||||
if (insn is TypeInsnNode) {
|
||||
val insnType = Type.getObjectType(insn.desc)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
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.*;
|
||||
|
||||
@@ -31,7 +32,7 @@ public abstract class MethodTransformer {
|
||||
return analyzer.analyze(internalClassName, node);
|
||||
}
|
||||
catch (AnalyzerException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ 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.*
|
||||
@@ -32,7 +31,6 @@ 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
|
||||
@@ -91,7 +89,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
}
|
||||
//TODO: support local delegated properties in new defaults scheme
|
||||
val containerAsmType =
|
||||
if (isInterface(descriptor)) typeMapper.mapDefaultImpls(descriptor) else typeMapper.mapClass(descriptor)
|
||||
if (isInterface(descriptor) && !jvmDefaultMode.forAllMethodsWithBody) typeMapper.mapDefaultImpls(descriptor) else typeMapper.mapClass(descriptor)
|
||||
writeLocalProperties(proto, containerAsmType, JvmProtoBuf.classLocalVariable)
|
||||
writeVersionRequirementForJvmDefaultIfNeeded(descriptor, proto, versionRequirementTable)
|
||||
|
||||
@@ -114,13 +112,6 @@ 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)
|
||||
@@ -280,10 +271,6 @@ 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,8 +77,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
val elements = LinkedHashSet<PsiElement>()
|
||||
if (noOwnImplementations) {
|
||||
elements.addIfNotNull(data.classOrigin.element)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (origin in data.signatureOrigins) {
|
||||
var element = origin.element
|
||||
|
||||
@@ -96,9 +95,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)
|
||||
@@ -107,9 +106,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
|
||||
@@ -122,9 +121,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
|
||||
@@ -141,9 +140,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
for ((rawSignature, origins) in groupedBySignature.entrySet()) {
|
||||
if (origins.size <= 1) continue
|
||||
|
||||
val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)
|
||||
|
||||
when (diagnostic) {
|
||||
when (val diagnostic = computeDiagnosticToReport(classOrigin, classInternalName, rawSignature, origins)) {
|
||||
is ConflictingDeclarationError.AccidentalOverride -> {
|
||||
diagnostics.report(ErrorsJvm.ACCIDENTAL_OVERRIDE.on(diagnostic.element, diagnostic.data))
|
||||
}
|
||||
@@ -156,16 +153,17 @@ 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
|
||||
@@ -211,19 +209,17 @@ 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))
|
||||
}
|
||||
}
|
||||
@@ -232,10 +228,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,6 +20,7 @@ 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
|
||||
@@ -49,6 +50,7 @@ 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,
|
||||
@@ -204,15 +206,29 @@ 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.INLINE
|
||||
configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INDY_WITH_CONSTANTS
|
||||
else JvmStringConcat.INLINE
|
||||
|
||||
val samConversionsScheme = run {
|
||||
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS) ?: JvmSamConversions.DEFAULT
|
||||
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
|
||||
JvmClosureGenerationScheme.CLASS
|
||||
}
|
||||
|
||||
val lambdasScheme = run {
|
||||
val fromConfig = configuration.get(JVMConfigurationKeys.LAMBDAS)
|
||||
?: JvmClosureGenerationScheme.DEFAULT
|
||||
if (target >= fromConfig.minJvmTarget)
|
||||
fromConfig
|
||||
else
|
||||
JvmSamConversions.DEFAULT
|
||||
JvmClosureGenerationScheme.DEFAULT
|
||||
}
|
||||
|
||||
val moduleName: String = moduleName ?: JvmCodegenUtil.getModuleName(module)
|
||||
@@ -229,7 +245,6 @@ class GenerationState private constructor(
|
||||
this.moduleName,
|
||||
languageVersionSettings,
|
||||
useOldManglingSchemeForFunctionsWithInlineClassesInSignatures,
|
||||
IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace),
|
||||
target,
|
||||
isIrBackend
|
||||
)
|
||||
@@ -306,8 +321,7 @@ class GenerationState private constructor(
|
||||
|
||||
val metadataVersion =
|
||||
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
|
||||
?: if (languageVersionSettings.languageVersion >= LanguageVersion.LATEST_STABLE) JvmMetadataVersion.INSTANCE
|
||||
else JvmMetadataVersion(1, 1, 18)
|
||||
?: LANGUAGE_TO_METADATA_VERSION.getValue(languageVersionSettings.languageVersion)
|
||||
|
||||
val abiStability = configuration.get(JVMConfigurationKeys.ABI_STABILITY)
|
||||
|
||||
@@ -378,6 +392,24 @@ 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)
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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,7 +87,6 @@ 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,
|
||||
@@ -494,9 +493,8 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
boxInlineClassBeforeInvoke = true
|
||||
}
|
||||
else -> {
|
||||
val isPrivateFunInvocation =
|
||||
DescriptorVisibilities.isPrivate(functionDescriptor.visibility) && !functionDescriptor.isSuspend
|
||||
invokeOpcode = if (superCall || isPrivateFunInvocation) INVOKESPECIAL else INVOKEVIRTUAL
|
||||
invokeOpcode =
|
||||
if (superCall || DescriptorVisibilities.isPrivate(functionDescriptor.visibility)) INVOKESPECIAL else INVOKEVIRTUAL
|
||||
isInterfaceMember = false
|
||||
}
|
||||
}
|
||||
@@ -845,8 +843,6 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
skipGenericSignature: Boolean,
|
||||
hasSpecialBridge: Boolean
|
||||
): JvmMethodGenericSignature {
|
||||
checkOwnerCompatibility(f)
|
||||
|
||||
val sw = if (skipGenericSignature || f is AccessorForCallableDescriptor<*>)
|
||||
JvmSignatureWriter()
|
||||
else
|
||||
@@ -969,15 +965,6 @@ 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,7 +32,9 @@ fun writeKotlinMetadata(
|
||||
) {
|
||||
val av = cb.newAnnotation(JvmAnnotationNames.METADATA_DESC, true)
|
||||
av.visit(JvmAnnotationNames.METADATA_VERSION_FIELD_NAME, state.metadataVersion.toArray())
|
||||
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||
if (!state.metadataVersion.isAtLeast(1, 5, 0)) {
|
||||
av.visit("bv", JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||
}
|
||||
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
||||
var flags = extraFlags
|
||||
if (state.languageVersionSettings.isPreRelease()) {
|
||||
|
||||
@@ -87,7 +87,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
idea {
|
||||
this.module.generatedSourceDirs.add(generationRoot)
|
||||
}
|
||||
} else {
|
||||
} else if (!kotlinBuildProperties.disableWerror) {
|
||||
allprojects {
|
||||
tasks.withType<KotlinCompile<*>> {
|
||||
if (path !in tasksWithWarnings) {
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
export KOTLIN_TOOL=kotlin-annotation-processing-cli.jar
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_COMPILER=org.jetbrains.kotlin.kapt.cli.KaptCli
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
export KOTLIN_RUNNER=1
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
export KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.dce.K2JSDce
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.dce.K2JSDce
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_RUNNER=1
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Based on scalac from the Scala distribution
|
||||
# Copyright 2002-2011, LAMP/EPFL
|
||||
# Copyright 2011-2015, JetBrains
|
||||
#
|
||||
# This is free software; see the distribution for copying conditions.
|
||||
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
##############################################################################
|
||||
# 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.
|
||||
|
||||
cygwin=false;
|
||||
case "`uname`" in
|
||||
@@ -25,6 +21,17 @@ findKotlinHome() {
|
||||
(cd -P "$(dirname "$source")/.." && pwd)
|
||||
}
|
||||
|
||||
findJavaVersion() {
|
||||
# Note that this only loads the first component of the version, so "1.8.0_265" -> "1".
|
||||
# But it's fine because major version is 9 for JDK 9, and so on.
|
||||
regex='^.*version "([[:digit:]]+).*$'
|
||||
while read -r line; do
|
||||
if [[ "$line" =~ $regex ]]; then
|
||||
echo ${BASH_REMATCH[1]}
|
||||
fi
|
||||
done <<< $("${JAVACMD:=java}" -version 2>&1)
|
||||
}
|
||||
|
||||
KOTLIN_HOME="$(findKotlinHome)"
|
||||
|
||||
if $cygwin; then
|
||||
@@ -60,17 +67,24 @@ fi
|
||||
|
||||
declare -a kotlin_app
|
||||
|
||||
if [ -n "$KOTLIN_RUNNER" ];
|
||||
then
|
||||
java_version="$(findJavaVersion)"
|
||||
if [[ $java_version -ge 9 ]]; then
|
||||
# Workaround the illegal reflective access warning from ReflectionUtil to ResourceBundle.setParent, see IDEA-248785.
|
||||
java_args=("${java_args[@]}" "--add-opens" "java.base/java.util=ALL-UNNAMED")
|
||||
fi
|
||||
|
||||
if [ -n "$KOTLIN_RUNNER" ]; then
|
||||
java_args=("${java_args[@]}" "-Dkotlin.home=${KOTLIN_HOME}")
|
||||
kotlin_app=("${KOTLIN_HOME}/lib/kotlin-runner.jar" "org.jetbrains.kotlin.runner.Main")
|
||||
else
|
||||
[ -n "$KOTLIN_COMPILER" ] || KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
java_args=("${java_args[@]}" "-noverify")
|
||||
|
||||
if [[ $java_version < 13 ]]; then
|
||||
java_args=("${java_args[@]}" "-noverify")
|
||||
fi
|
||||
|
||||
declare additional_classpath=""
|
||||
if [ -n "$KOTLIN_TOOL" ];
|
||||
then
|
||||
if [ -n "$KOTLIN_TOOL" ]; then
|
||||
additional_classpath=":${KOTLIN_HOME}/lib/${KOTLIN_TOOL}"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
export KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
DIR="${BASH_SOURCE[0]%/*}"
|
||||
: ${DIR:="."}
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
call %~dps0kotlinc.bat %*
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
@echo off
|
||||
rem based on scalac.bat from the Scala distribution
|
||||
rem ##########################################################################
|
||||
rem # Copyright 2002-2011, LAMP/EPFL
|
||||
rem # Copyright 2011-2015, JetBrains
|
||||
rem #
|
||||
rem # This is free software; see the distribution for copying conditions.
|
||||
rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
rem # PARTICULAR PURPOSE.
|
||||
rem ##########################################################################
|
||||
|
||||
rem Based on scalac.bat from the Scala distribution
|
||||
rem Copyright 2002-2011, LAMP/EPFL
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
rem We adopt the following conventions:
|
||||
rem - System/user environment variables start with a letter
|
||||
@@ -19,11 +15,10 @@ call :set_home
|
||||
if "%_KOTLIN_COMPILER%"=="" set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
|
||||
if not "%JAVA_HOME%"=="" (
|
||||
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
|
||||
rem Prepend JAVA_HOME to local PATH to be able to simply execute "java" later in the script.
|
||||
set "PATH=%JAVA_HOME%\bin;%PATH%"
|
||||
)
|
||||
|
||||
if "%_JAVACMD%"=="" set _JAVACMD=java
|
||||
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined
|
||||
if "%JAVA_OPTS%"=="" set JAVA_OPTS=-Xmx256M -Xms32M
|
||||
|
||||
@@ -45,18 +40,29 @@ shift
|
||||
goto loop
|
||||
:loopend
|
||||
|
||||
if "%_KOTLIN_RUNNER%"=="1" (
|
||||
"%_JAVACMD%" %JAVA_OPTS% "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
call :set_java_version
|
||||
if !_java_major_version! geq 9 (
|
||||
rem Workaround the illegal reflective access warning from ReflectionUtil to ResourceBundle.setParent, see IDEA-248785.
|
||||
set JAVA_OPTS=!JAVA_OPTS! "--add-opens" "java.base/java.util=ALL-UNNAMED"
|
||||
)
|
||||
|
||||
if "!_KOTLIN_RUNNER!"=="1" (
|
||||
java !JAVA_OPTS! "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
|
||||
org.jetbrains.kotlin.runner.Main %KOTLIN_OPTS%
|
||||
) else (
|
||||
setlocal EnableDelayedExpansion
|
||||
SET _ADDITIONAL_CLASSPATH=
|
||||
set _ADDITIONAL_CLASSPATH=
|
||||
|
||||
if !_java_major_version! lss 13 (
|
||||
set JAVA_OPTS=!JAVA_OPTS! "-noverify"
|
||||
)
|
||||
|
||||
if not "%_KOTLIN_TOOL%"=="" (
|
||||
set _ADDITIONAL_CLASSPATH=;%_KOTLIN_HOME%\lib\%_KOTLIN_TOOL%
|
||||
)
|
||||
|
||||
"%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
|
||||
java !JAVA_OPTS! -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
|
||||
org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar!_ADDITIONAL_CLASSPATH!" ^
|
||||
%_KOTLIN_COMPILER% %KOTLIN_OPTS%
|
||||
)
|
||||
@@ -73,6 +79,29 @@ rem # subroutines
|
||||
set _KOTLIN_HOME=%_BIN_DIR%..
|
||||
goto :eof
|
||||
|
||||
rem Parses "java -version" output and stores the major version to _java_major_version.
|
||||
rem Note that this only loads the first component of the version, so "1.8.0_265" -> "1".
|
||||
rem But it's fine because major version is 9 for JDK 9, and so on.
|
||||
rem Needs to be executed in the EnableDelayedExpansion mode.
|
||||
:set_java_version
|
||||
set _version=
|
||||
rem Parse output and take the third token from the string containing " version ".
|
||||
rem It should be something like "1.8.0_275" or "15.0.1".
|
||||
for /f "tokens=3" %%i in ('java -version 2^>^&1 ^| findstr /i " version "') do (
|
||||
rem Split the string by "-" or "." and take the first token.
|
||||
for /f "delims=-. tokens=1" %%j in ("%%i") do (
|
||||
rem At this point, _version should be something like "1 or "15. Note the leading quote.
|
||||
set _version=%%j
|
||||
)
|
||||
)
|
||||
if "!_version!"=="" (
|
||||
rem If failed to parse the output, set the version to 1.
|
||||
set _java_major_version=1
|
||||
) else (
|
||||
rem Strip the leading quote.
|
||||
set _java_major_version=!_version:~1!
|
||||
)
|
||||
goto :eof
|
||||
|
||||
:end
|
||||
endlocal
|
||||
|
||||
|
||||
@@ -16,8 +16,54 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common
|
||||
|
||||
val KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY = "kotlin.environment.keepalive"
|
||||
import com.intellij.util.LineSeparator
|
||||
import java.util.*
|
||||
|
||||
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,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
)
|
||||
var inferenceCompatibility: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xextended-compiler-checks",
|
||||
description = "Enable additional compiler checks that might provide verbose diagnostic information for certain errors.\n" +
|
||||
"Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code."
|
||||
)
|
||||
var extendedCompilerChecks: Boolean by FreezableVar(false)
|
||||
|
||||
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||
return HashMap<AnalysisFlag<*>, Any>().apply {
|
||||
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
|
||||
@@ -369,6 +376,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
CompilerMessageSeverity.ERROR,
|
||||
"Unknown value for parameter -Xexplicit-api: '$explicitApi'. Value should be one of ${ExplicitApiMode.availableValues()}"
|
||||
)
|
||||
put(AnalysisFlags.extendedCompilerChecks, extendedCompilerChecks)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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.arguments
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class DeprecatedOption(
|
||||
val message: String = "This option has no effect and will be removed in a future release.",
|
||||
val removeAfter: String,
|
||||
val level: DeprecationLevel
|
||||
)
|
||||
@@ -5,8 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.arguments
|
||||
|
||||
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.arguments.K2JsArgumentConstants.*
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
@@ -126,6 +125,13 @@ 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)
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
description = "List of directories and JAR/ZIP archives to search for user class files")
|
||||
var classpath: String? by NullableStringFreezableVar(null)
|
||||
|
||||
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
|
||||
@GradleOption(DefaultValues.BooleanFalseDefault::class)
|
||||
@Argument(value = "-include-runtime", description = "Include Kotlin runtime into the resulting JAR")
|
||||
var includeRuntime: Boolean by FreezableVar(false)
|
||||
@@ -41,10 +42,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath")
|
||||
var noJdk: Boolean by FreezableVar(false)
|
||||
|
||||
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
|
||||
@GradleOption(DefaultValues.BooleanTrueDefault::class)
|
||||
@Argument(value = "-no-stdlib", description = "Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath")
|
||||
var noStdlib: Boolean by FreezableVar(false)
|
||||
|
||||
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
|
||||
@GradleOption(DefaultValues.BooleanTrueDefault::class)
|
||||
@Argument(value = "-no-reflect", description = "Don't automatically include Kotlin reflection into the classpath")
|
||||
var noReflect: Boolean by FreezableVar(false)
|
||||
@@ -71,7 +74,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-jvm-target",
|
||||
valueDescription = "<version>",
|
||||
description = "Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.6"
|
||||
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"
|
||||
)
|
||||
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)
|
||||
|
||||
@@ -81,8 +84,12 @@ 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")
|
||||
@Argument(
|
||||
value = "-Xuse-ir",
|
||||
description = "Use the IR backend. This option has no effect unless the language version less than 1.5 is used"
|
||||
)
|
||||
var useIR: Boolean by FreezableVar(false)
|
||||
|
||||
@GradleOption(DefaultValues.BooleanFalseDefault::class)
|
||||
@@ -355,10 +362,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-Xstring-concat",
|
||||
valueDescription = "{indy-with-constants|indy|inline}",
|
||||
description = """Switch a way in which string concatenation is performed.
|
||||
-Xstring-concat=indy-with-constants Performs string concatenation via `invokedynamic` 'makeConcatWithConstants'. Works only with `-jvm-target 9` or greater
|
||||
-Xstring-concat=indy Performs string concatenation via `invokedynamic` 'makeConcat'. Works only with `-jvm-target 9` or greater
|
||||
-Xstring-concat=inline Performs string concatenation via `StringBuilder`"""
|
||||
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"""
|
||||
|
||||
)
|
||||
var stringConcat: String? by NullableStringFreezableVar(JvmStringConcat.INLINE.description)
|
||||
|
||||
@@ -366,10 +375,20 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
value = "-Xsam-conversions",
|
||||
valueDescription = "{class|indy}",
|
||||
description = """Select code generation scheme for SAM conversions.
|
||||
-Xsam-conversions=indy Generate SAM conversions using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 8` or greater.
|
||||
-Xsam-conversions=indy Generate SAM conversions using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater.
|
||||
-Xsam-conversions=class Generate SAM conversions as explicit classes"""
|
||||
)
|
||||
var samConversions: String? by NullableStringFreezableVar(JvmSamConversions.CLASS.description)
|
||||
var samConversions: String? by NullableStringFreezableVar(null)
|
||||
|
||||
@Argument(
|
||||
value = "-Xlambdas",
|
||||
valueDescription = "{class|indy}",
|
||||
description = """Select code generation scheme for lambdas.
|
||||
-Xlambdas=indy Generate lambdas using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater.
|
||||
Lambda objects created using `LambdaMetafactory.metafactory` will have different `toString()`.
|
||||
-Xlambdas=class Generate lambdas as explicit classes"""
|
||||
)
|
||||
var lambdas: String? by NullableStringFreezableVar(null)
|
||||
|
||||
@Argument(
|
||||
value = "-Xklib",
|
||||
@@ -438,6 +457,20 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
)
|
||||
var enableJvmPreview: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xsuppress-deprecated-jvm-target-warning",
|
||||
description = "Suppress deprecation warning about deprecated JVM target versions"
|
||||
)
|
||||
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
|
||||
@@ -460,6 +493,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
|
||||
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
|
||||
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
|
||||
result[JvmAnalysisFlags.useIR] = !useOldBackend
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -468,6 +502,9 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
if (strictJavaNullabilityAssertions) {
|
||||
result[LanguageFeature.StrictJavaNullabilityAssertions] = LanguageFeature.State.ENABLED
|
||||
}
|
||||
if (typeEnhancementImprovementsInStrictMode) {
|
||||
result[LanguageFeature.TypeEnhancementImprovementsInStrictMode] = LanguageFeature.State.ENABLED
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -28,4 +28,7 @@ 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,6 +17,7 @@ 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
|
||||
@@ -264,6 +265,10 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
mainArguments = mainCallArguments,
|
||||
generateFullJs = !arguments.irDce,
|
||||
generateDceJs = arguments.irDce,
|
||||
dceRuntimeDiagnostic = DceRuntimeDiagnostic.resolve(
|
||||
arguments.irDceRuntimeDiagnostic,
|
||||
messageCollector
|
||||
),
|
||||
dceDriven = arguments.irDceDriven,
|
||||
multiModule = arguments.irPerModule,
|
||||
relativeRequirePath = true,
|
||||
@@ -273,6 +278,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
return COMPILATION_ERROR
|
||||
}
|
||||
|
||||
|
||||
val jsCode = if (arguments.irDce && !arguments.irDceDriven) compiledModule.dceJsCode!! else compiledModule.jsCode!!
|
||||
outputFile.writeText(jsCode.mainModule)
|
||||
jsCode.dependencies.forEach { (name, content) ->
|
||||
@@ -430,6 +436,19 @@ 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)
|
||||
|
||||
@@ -76,17 +76,23 @@ class K2JSDce : CLITool<K2JSDceArguments>() {
|
||||
messageCollector.report(severity, message)
|
||||
}
|
||||
|
||||
val dceResult = DeadCodeElimination.run(files, includedDeclarations, logConsumer)
|
||||
val dceResult = DeadCodeElimination.run(
|
||||
files,
|
||||
includedDeclarations,
|
||||
arguments.printReachabilityInfo,
|
||||
logConsumer
|
||||
)
|
||||
if (dceResult.status == DeadCodeEliminationStatus.FAILED) return ExitCode.COMPILATION_ERROR
|
||||
val nodes = dceResult.reachableNodes.filterTo(mutableSetOf()) { it.reachable }
|
||||
|
||||
val reachabilitySeverity = if (arguments.printReachabilityInfo) CompilerMessageSeverity.INFO else CompilerMessageSeverity.LOGGING
|
||||
messageCollector.report(reachabilitySeverity, "")
|
||||
for (node in nodes.extractRoots()) {
|
||||
printTree(
|
||||
node, { messageCollector.report(reachabilitySeverity, it) },
|
||||
printNestedMembers = false, showLocations = true
|
||||
)
|
||||
if (arguments.printReachabilityInfo) {
|
||||
val reachabilitySeverity = CompilerMessageSeverity.INFO
|
||||
messageCollector.report(reachabilitySeverity, "")
|
||||
for (node in dceResult.reachableNodes.extractReachableRoots(dceResult.context!!)) {
|
||||
printTree(
|
||||
node, { messageCollector.report(reachabilitySeverity, it) },
|
||||
printNestedMembers = false, showLocations = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return ExitCode.OK
|
||||
|
||||
137
compiler/cli/src/com/intellij/DynamicBundle.java
Normal file
137
compiler/cli/src/com/intellij/DynamicBundle.java
Normal file
@@ -0,0 +1,137 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@@ -205,8 +205,8 @@ abstract class CLITool<A : CommonToolArguments> {
|
||||
if (System.getProperty("java.awt.headless") == null) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
}
|
||||
if (System.getProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY) == null) {
|
||||
System.setProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY, "true")
|
||||
if (CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value == null) {
|
||||
CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value = "true"
|
||||
}
|
||||
|
||||
setupIdeaStandaloneExecution()
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
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
|
||||
@@ -24,7 +23,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
|
||||
import org.jetbrains.kotlin.config.languageVersionSettings
|
||||
@@ -32,16 +31,12 @@ 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,
|
||||
@@ -72,6 +67,9 @@ class AnalyzerWithCompilerReport(
|
||||
.append(", unresolved supertypes: ").append(unresolved!!.joinToString())
|
||||
.append("\n")
|
||||
}
|
||||
if (!languageVersionSettings.getFlag(AnalysisFlags.extendedCompilerChecks)) {
|
||||
message.append("Adding -Xextended-compiler-checks argument might provide additional information.\n")
|
||||
}
|
||||
messageCollector.report(ERROR, message.toString())
|
||||
}
|
||||
}
|
||||
@@ -242,33 +240,5 @@ 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))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,13 +31,12 @@ 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 (!SystemInfo.isWindows && "true".equals(System.getProperty(KOTLIN_COLORS_ENABLED_PROPERTY))) {
|
||||
if (!PropertiesKt.isWindows() && "true".equals(CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.getValue())) {
|
||||
try {
|
||||
// AnsiConsole doesn't check isatty() for stderr (see https://github.com/fusesource/jansi/pull/35).
|
||||
colorEnabled = CLibrary.isatty(CLibrary.STDERR_FILENO) != 0;
|
||||
@@ -49,7 +48,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
||||
COLOR_ENABLED = colorEnabled;
|
||||
}
|
||||
|
||||
private static final String LINE_SEPARATOR = LineSeparator.getSystemLineSeparator().getSeparatorString();
|
||||
private static final String LINE_SEPARATOR = System.lineSeparator();
|
||||
|
||||
private static final Set<CompilerMessageSeverity> IMPORTANT_MESSAGE_SEVERITIES = EnumSet.of(EXCEPTION, ERROR, STRONG_WARNING, WARNING);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.descriptors.PackageViewDescriptor
|
||||
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
|
||||
import org.jetbrains.kotlin.load.java.components.FilesByFacadeFqNameIndexer
|
||||
@@ -110,7 +111,7 @@ class CliKotlinAsJavaSupport(
|
||||
}
|
||||
|
||||
override fun getLightClass(classOrObject: KtClassOrObject): KtLightClass? =
|
||||
KtLightClassForSourceDeclaration.create(classOrObject)
|
||||
KtLightClassForSourceDeclaration.create(classOrObject, traceHolder.languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode))
|
||||
|
||||
override fun getLightClassForScript(script: KtScript): KtLightClassForScript? =
|
||||
KtLightClassForScript.create(script)
|
||||
|
||||
@@ -23,11 +23,17 @@ import org.jetbrains.kotlin.asJava.builder.InvalidLightClassDataHolder
|
||||
import org.jetbrains.kotlin.asJava.builder.LightClassConstructionContext
|
||||
import org.jetbrains.kotlin.asJava.builder.LightClassDataHolder
|
||||
import org.jetbrains.kotlin.asJava.builder.LightClassDataHolderImpl
|
||||
import org.jetbrains.kotlin.asJava.classes.*
|
||||
import org.jetbrains.kotlin.asJava.classes.KtUltraLightSupport
|
||||
import org.jetbrains.kotlin.asJava.classes.cleanFromAnonymousTypes
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.asJava.classes.tryGetPredefinedName
|
||||
import org.jetbrains.kotlin.codegen.ClassBuilderMode
|
||||
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.load.java.components.JavaDeprecationSettings
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -57,7 +63,8 @@ class CliLightClassGenerationSupport(
|
||||
|
||||
private class CliLightClassSupport(
|
||||
private val project: Project,
|
||||
override val languageVersionSettings: LanguageVersionSettings
|
||||
override val languageVersionSettings: LanguageVersionSettings,
|
||||
private val jvmTarget: JvmTarget
|
||||
) : KtUltraLightSupport {
|
||||
|
||||
// This is the way to untie CliLightClassSupport and CliLightClassGenerationSupport to prevent descriptors leak
|
||||
@@ -88,7 +95,7 @@ class CliLightClassGenerationSupport(
|
||||
moduleName,
|
||||
languageVersionSettings,
|
||||
useOldInlineClassesManglingScheme = false,
|
||||
jvmTarget = JvmTarget.JVM_1_8,
|
||||
jvmTarget = jvmTarget,
|
||||
typePreprocessor = KotlinType::cleanFromAnonymousTypes,
|
||||
namePreprocessor = ::tryGetPredefinedName
|
||||
)
|
||||
@@ -96,7 +103,7 @@ class CliLightClassGenerationSupport(
|
||||
}
|
||||
|
||||
private val ultraLightSupport: KtUltraLightSupport by lazyPub {
|
||||
CliLightClassSupport(project, traceHolder.languageVersionSettings)
|
||||
CliLightClassSupport(project, traceHolder.languageVersionSettings, traceHolder.jvmTarget)
|
||||
}
|
||||
|
||||
override fun getUltraLightClassSupport(element: KtElement): KtUltraLightSupport {
|
||||
@@ -129,7 +136,9 @@ class CliLightClassGenerationSupport(
|
||||
}
|
||||
|
||||
private fun getContext(): LightClassConstructionContext =
|
||||
LightClassConstructionContext(traceHolder.bindingContext, traceHolder.module)
|
||||
LightClassConstructionContext(
|
||||
traceHolder.bindingContext, traceHolder.module, null /* TODO: traceHolder.languageVersionSettings? */, traceHolder.jvmTarget
|
||||
)
|
||||
|
||||
override fun resolveToDescriptor(declaration: KtDeclaration): DeclarationDescriptor? {
|
||||
return traceHolder.bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration)
|
||||
@@ -140,4 +149,4 @@ class CliLightClassGenerationSupport(
|
||||
override fun analyzeAnnotation(element: KtAnnotationEntry) = traceHolder.bindingContext.get(BindingContext.ANNOTATION, element)
|
||||
|
||||
override fun analyzeWithContent(element: KtClassOrObject) = traceHolder.bindingContext
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.cli.jvm.compiler
|
||||
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
@@ -13,30 +14,32 @@ import org.jetbrains.kotlin.psi.KtPsiUtil
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext
|
||||
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmCodeAnalyzerInitializer
|
||||
import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer
|
||||
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
class CliTraceHolder : CodeAnalyzerInitializer {
|
||||
var bindingContext: BindingContext by Delegates.notNull()
|
||||
class CliTraceHolder : JvmCodeAnalyzerInitializer() {
|
||||
lateinit var bindingContext: BindingContext
|
||||
private set
|
||||
var module: ModuleDescriptor by Delegates.notNull()
|
||||
lateinit var module: ModuleDescriptor
|
||||
private set
|
||||
var languageVersionSettings: LanguageVersionSettings by Delegates.notNull()
|
||||
lateinit var languageVersionSettings: LanguageVersionSettings
|
||||
private set
|
||||
lateinit var jvmTarget: JvmTarget
|
||||
private set
|
||||
|
||||
|
||||
override fun initialize(
|
||||
trace: BindingTrace,
|
||||
module: ModuleDescriptor,
|
||||
codeAnalyzer: KotlinCodeAnalyzer,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
jvmTarget: JvmTarget
|
||||
) {
|
||||
this.bindingContext = trace.bindingContext
|
||||
this.module = module
|
||||
this.languageVersionSettings = languageVersionSettings
|
||||
this.jvmTarget = jvmTarget
|
||||
|
||||
if (trace !is CliBindingTrace) {
|
||||
throw IllegalArgumentException("Shared trace is expected to be subclass of ${CliBindingTrace::class.java.simpleName} class")
|
||||
|
||||
@@ -28,11 +28,13 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleChunk;
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleXmlParser;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.kotlin.utils.PathUtil;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.jar.*;
|
||||
|
||||
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR;
|
||||
@@ -60,6 +62,7 @@ public class CompileEnvironmentUtil {
|
||||
OutputStream fos,
|
||||
@Nullable FqName mainClass,
|
||||
boolean includeRuntime,
|
||||
boolean noReflect,
|
||||
boolean resetJarTimestamps
|
||||
) {
|
||||
try {
|
||||
@@ -89,6 +92,9 @@ public class CompileEnvironmentUtil {
|
||||
}
|
||||
if (includeRuntime) {
|
||||
writeRuntimeToJar(stream, resetJarTimestamps);
|
||||
if (!noReflect) {
|
||||
writeReflectToJar(stream, resetJarTimestamps);
|
||||
}
|
||||
}
|
||||
stream.finish();
|
||||
}
|
||||
@@ -98,12 +104,12 @@ public class CompileEnvironmentUtil {
|
||||
}
|
||||
|
||||
public static void writeToJar(
|
||||
File jarPath, boolean jarRuntime, boolean resetJarTimestamps, FqName mainClass, OutputFileCollection outputFiles
|
||||
File jarPath, boolean jarRuntime, boolean noReflect, boolean resetJarTimestamps, FqName mainClass, OutputFileCollection outputFiles
|
||||
) {
|
||||
FileOutputStream outputStream = null;
|
||||
try {
|
||||
outputStream = new FileOutputStream(jarPath);
|
||||
doWriteToJar(outputFiles, outputStream, mainClass, jarRuntime, resetJarTimestamps);
|
||||
doWriteToJar(outputFiles, outputStream, mainClass, jarRuntime, noReflect, resetJarTimestamps);
|
||||
outputStream.close();
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
@@ -125,16 +131,27 @@ public class CompileEnvironmentUtil {
|
||||
copyJarImpl(stream, stdlibPath, resetJarTimestamps);
|
||||
}
|
||||
|
||||
private static void writeReflectToJar(JarOutputStream stream, boolean resetJarTimestamps) throws IOException {
|
||||
File reflectPath = PathUtil.getKotlinPathsForCompiler().getReflectPath();
|
||||
if (!reflectPath.exists()) {
|
||||
throw new CompileEnvironmentException("Couldn't find kotlin-reflect at " + reflectPath);
|
||||
}
|
||||
copyJarImpl(stream, reflectPath, resetJarTimestamps);
|
||||
}
|
||||
|
||||
private static void copyJarImpl(JarOutputStream stream, File jarPath, boolean resetJarTimestamps) throws IOException {
|
||||
try (JarInputStream jis = new JarInputStream(new FileInputStream(jarPath))) {
|
||||
while (true) {
|
||||
JarEntry e = jis.getNextJarEntry();
|
||||
if (e == null) break;
|
||||
|
||||
if (!FileUtilRt.extensionEquals(e.getName(), "class") ||
|
||||
StringsKt.substringAfterLast(e.getName(), "/", e.getName()).equals("module-info.class")) {
|
||||
String name = e.getName();
|
||||
if (!FileUtilRt.extensionEquals(name, "class") &&
|
||||
!FileUtilRt.extensionEquals(name, BuiltInSerializerProtocol.BUILTINS_FILE_EXTENSION) &&
|
||||
!name.startsWith("META-INF/services/")) {
|
||||
continue;
|
||||
}
|
||||
if (StringsKt.substringAfterLast(name, "/", name).equals("module-info.class")) continue;
|
||||
if (resetJarTimestamps) {
|
||||
e.setTime(DOS_EPOCH);
|
||||
}
|
||||
|
||||
@@ -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.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
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)
|
||||
sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots).toSet() - sourceFiles
|
||||
}
|
||||
|
||||
fun createPackagePartProvider(scope: GlobalSearchScope): JvmPackagePartProvider {
|
||||
@@ -498,16 +498,13 @@ 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 (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY).toBooleanLenient() != true) {
|
||||
if (CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value.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
|
||||
@Suppress("ObjectLiteralToLambda") // Disposer tree depends on identity of disposables.
|
||||
Disposer.register(parentDisposable, object : Disposable {
|
||||
override fun dispose() {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (--ourProjectCount <= 0) {
|
||||
disposeApplicationEnvironment()
|
||||
}
|
||||
Disposer.register(parentDisposable, Disposable {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (--ourProjectCount <= 0) {
|
||||
disposeApplicationEnvironment()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -86,8 +86,9 @@ object KotlinToJVMBytecodeCompiler {
|
||||
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
|
||||
if (jarPath != null) {
|
||||
val includeRuntime = configuration.get(JVMConfigurationKeys.INCLUDE_RUNTIME, false)
|
||||
val noReflect = configuration.get(JVMConfigurationKeys.NO_REFLECT, false)
|
||||
val resetJarTimestamps = !configuration.get(JVMConfigurationKeys.NO_RESET_JAR_TIMESTAMPS, false)
|
||||
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, resetJarTimestamps, mainClassFqName, outputFiles)
|
||||
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, noReflect, resetJarTimestamps, mainClassFqName, outputFiles)
|
||||
if (reportOutputFiles) {
|
||||
val message = OutputMessageUtil.formatOutputMessage(outputFiles.asList().flatMap { it.sourceFiles }.distinct(), jarPath)
|
||||
messageCollector.report(OUTPUT, message)
|
||||
@@ -404,10 +405,6 @@ object KotlinToJVMBytecodeCompiler {
|
||||
environment.messageCollector
|
||||
)
|
||||
|
||||
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
|
||||
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector
|
||||
)
|
||||
|
||||
performanceManager?.notifyIRGenerationFinished()
|
||||
performanceManager?.notifyGenerationFinished()
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
@@ -606,10 +603,6 @@ object KotlinToJVMBytecodeCompiler {
|
||||
environment.messageCollector
|
||||
)
|
||||
|
||||
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
|
||||
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector
|
||||
)
|
||||
|
||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||
return generationState
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.io.File
|
||||
|
||||
fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArguments) {
|
||||
put(JVMConfigurationKeys.INCLUDE_RUNTIME, arguments.includeRuntime)
|
||||
put(JVMConfigurationKeys.NO_REFLECT, arguments.noReflect)
|
||||
|
||||
putIfNotNull(JVMConfigurationKeys.FRIEND_PATHS, arguments.friendPaths?.asList())
|
||||
|
||||
@@ -28,6 +29,12 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
|
||||
val jvmTarget = JvmTarget.fromString(arguments.jvmTarget!!)
|
||||
if (jvmTarget != null) {
|
||||
put(JVMConfigurationKeys.JVM_TARGET, jvmTarget)
|
||||
if (jvmTarget == JvmTarget.JVM_1_6 && !arguments.suppressDeprecatedJvmTargetWarning) {
|
||||
messageCollector.report(
|
||||
STRONG_WARNING,
|
||||
"JVM target 1.6 is deprecated and will be removed in a future release. Please migrate to JVM target 1.8 or above"
|
||||
)
|
||||
}
|
||||
} else {
|
||||
messageCollector.report(
|
||||
ERROR, "Unknown JVM target version: ${arguments.jvmTarget}\n" +
|
||||
@@ -65,27 +72,37 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.samConversions != null) {
|
||||
val samConversions = JvmSamConversions.fromString(arguments.samConversions)
|
||||
if (samConversions != null) {
|
||||
put(JVMConfigurationKeys.SAM_CONVERSIONS, samConversions)
|
||||
if (jvmTarget < samConversions.minJvmTarget) {
|
||||
handleClosureGenerationSchemeArgument("-Xsam-conversions", arguments.samConversions, JVMConfigurationKeys.SAM_CONVERSIONS, jvmTarget)
|
||||
handleClosureGenerationSchemeArgument("-Xlambdas", arguments.lambdas, JVMConfigurationKeys.LAMBDAS, jvmTarget)
|
||||
|
||||
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
|
||||
}
|
||||
|
||||
private fun CompilerConfiguration.handleClosureGenerationSchemeArgument(
|
||||
flag: String,
|
||||
value: String?,
|
||||
key: CompilerConfigurationKey<JvmClosureGenerationScheme>,
|
||||
jvmTarget: JvmTarget
|
||||
) {
|
||||
if (value != null) {
|
||||
val parsedValue = JvmClosureGenerationScheme.fromString(value)
|
||||
if (parsedValue != null) {
|
||||
put(key, parsedValue)
|
||||
if (jvmTarget < parsedValue.minJvmTarget) {
|
||||
messageCollector.report(
|
||||
WARNING,
|
||||
"`-Xsam-conversions=${arguments.samConversions}` requires JVM target at least " +
|
||||
"${samConversions.minJvmTarget.description} and is ignored."
|
||||
"`$flag=$value` requires JVM target at least " +
|
||||
"${parsedValue.minJvmTarget.description} and is ignored."
|
||||
)
|
||||
}
|
||||
} else {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"Unknown `-Xsam-conversions` argument: ${arguments.samConversions}\n" +
|
||||
"Supported arguments: ${JvmSamConversions.values().joinToString { it.description }}"
|
||||
"Unknown `$flag` argument: ${value}\n." +
|
||||
"Supported arguments: ${JvmClosureGenerationScheme.values().joinToString { it.description }}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
|
||||
}
|
||||
|
||||
fun CompilerConfiguration.configureJdkHome(arguments: K2JVMCompilerArguments): Boolean {
|
||||
@@ -185,11 +202,13 @@ 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)) {
|
||||
!arguments.useOldBackend
|
||||
!useOldBackend
|
||||
} else {
|
||||
arguments.useIR && !arguments.useOldBackend
|
||||
arguments.useIR && !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 = true;
|
||||
private static final boolean IS_PRE_RELEASE = false;
|
||||
|
||||
public static final String TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release";
|
||||
|
||||
|
||||
@@ -114,9 +114,12 @@ public class JVMConfigurationKeys {
|
||||
public static final CompilerConfigurationKey<JvmStringConcat> STRING_CONCAT =
|
||||
CompilerConfigurationKey.create("Specifies string concatenation scheme");
|
||||
|
||||
public static final CompilerConfigurationKey<JvmSamConversions> SAM_CONVERSIONS =
|
||||
public static final CompilerConfigurationKey<JvmClosureGenerationScheme> SAM_CONVERSIONS =
|
||||
CompilerConfigurationKey.create("SAM conversions code generation scheme");
|
||||
|
||||
public static final CompilerConfigurationKey<JvmClosureGenerationScheme> LAMBDAS =
|
||||
CompilerConfigurationKey.create("Lambdas code generation scheme");
|
||||
|
||||
public static final CompilerConfigurationKey<List<String>> KLIB_PATHS =
|
||||
CompilerConfigurationKey.create("Paths to .klib libraries");
|
||||
|
||||
@@ -146,4 +149,7 @@ public class JVMConfigurationKeys {
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> ENABLE_JVM_PREVIEW =
|
||||
CompilerConfigurationKey.create("Enable Java language preview features");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> NO_REFLECT =
|
||||
CompilerConfigurationKey.create("Don't automatically include kotlin-reflect.jar into the output if the output is a jar");
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ 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> =
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
enum class JvmSamConversions(
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||
|
||||
enum class JvmClosureGenerationScheme(
|
||||
val description: String,
|
||||
val minJvmTarget: JvmTarget
|
||||
) {
|
||||
@@ -17,7 +19,9 @@ enum class JvmSamConversions(
|
||||
val DEFAULT = CLASS
|
||||
|
||||
@JvmStatic
|
||||
fun fromString(string: String?) =
|
||||
values().find { it.description == string }
|
||||
fun fromString(string: String?): JvmClosureGenerationScheme? {
|
||||
val lowerStr = string?.toLowerCaseAsciiOnly() ?: return null
|
||||
return values().find { it.description == lowerStr }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,11 +32,12 @@ 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 {
|
||||
@JvmField
|
||||
val DEFAULT = JVM_1_6
|
||||
val DEFAULT = JVM_1_8
|
||||
|
||||
@JvmStatic
|
||||
fun fromString(string: String) = values().find { it.description == string }
|
||||
|
||||
@@ -50,4 +50,7 @@ object AnalysisFlags {
|
||||
|
||||
@JvmStatic
|
||||
val libraryToSourceAnalysis by AnalysisFlag.Delegates.Boolean
|
||||
|
||||
@JvmStatic
|
||||
val extendedCompilerChecks by AnalysisFlag.Delegates.Boolean
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ inline fun <reified T : Any> StorageComponentContainer.useImpl() {
|
||||
registerSingleton(T::class.java)
|
||||
}
|
||||
|
||||
inline fun <reified T : Any> StorageComponentContainer.useImplIf(cond: Boolean) {
|
||||
if (cond) useImpl<T>()
|
||||
}
|
||||
|
||||
inline fun <reified T : Any> ComponentProvider.get(): T {
|
||||
return getService(T::class.java)
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user