mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-15 00:21:29 +00:00
Compare commits
1405 Commits
bean-gener
...
modules
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31b722f4bf | ||
|
|
af2f2637cc | ||
|
|
e1ae245dca | ||
|
|
b0bbb2b28a | ||
|
|
adfc6e1c57 | ||
|
|
004539552e | ||
|
|
1e4635d6ec | ||
|
|
a5a9c06a48 | ||
|
|
9520fa235c | ||
|
|
6575a6dff4 | ||
|
|
c568218cf8 | ||
|
|
be4ad9c5a5 | ||
|
|
17888f64a0 | ||
|
|
0157a753ec | ||
|
|
41b157d92f | ||
|
|
3fd9ce1a27 | ||
|
|
2015712e57 | ||
|
|
5e14630874 | ||
|
|
09776c12c8 | ||
|
|
32b74d9731 | ||
|
|
c1b069bd46 | ||
|
|
630ea703da | ||
|
|
e95f172879 | ||
|
|
4ed4d66f15 | ||
|
|
3deaf49d1c | ||
|
|
dc82293012 | ||
|
|
6ba018df3d | ||
|
|
8cb630e6b2 | ||
|
|
a8982f24e5 | ||
|
|
917a0fe534 | ||
|
|
78f81fddf2 | ||
|
|
c1f15ee758 | ||
|
|
4066af1013 | ||
|
|
ced6232deb | ||
|
|
cb80f853ec | ||
|
|
42a1da1a70 | ||
|
|
593dda4f0d | ||
|
|
320eef5ce0 | ||
|
|
9850f7dd45 | ||
|
|
7152cec8f2 | ||
|
|
b4b2506bb2 | ||
|
|
fa43edd9ea | ||
|
|
a5f30a520f | ||
|
|
2f12434a26 | ||
|
|
ab44f9ceaa | ||
|
|
f5d55c1589 | ||
|
|
673d8c007a | ||
|
|
bc46062499 | ||
|
|
08108491e3 | ||
|
|
cd269718ee | ||
|
|
06544f3b87 | ||
|
|
9aa55bad22 | ||
|
|
85d087ddc5 | ||
|
|
9845bfcf81 | ||
|
|
8eaf6a1c79 | ||
|
|
cd059fb705 | ||
|
|
bdabd12cca | ||
|
|
63194fa115 | ||
|
|
fb9f419165 | ||
|
|
d1a4a8c02d | ||
|
|
ea118fc51b | ||
|
|
a21be544ab | ||
|
|
fd0d3aafc5 | ||
|
|
b500a76795 | ||
|
|
73713e06fe | ||
|
|
b5cfdec464 | ||
|
|
f2564b6efa | ||
|
|
a2c2e12f19 | ||
|
|
79cb9a209d | ||
|
|
4dcf9ebdab | ||
|
|
6ac9123b39 | ||
|
|
ab226ff79f | ||
|
|
a05d7bdf1b | ||
|
|
240676c08e | ||
|
|
4a861d6775 | ||
|
|
aced529afe | ||
|
|
615264720d | ||
|
|
1d43c6ea36 | ||
|
|
cc2ecc8c96 | ||
|
|
c96a03da57 | ||
|
|
e717eeefaf | ||
|
|
e54582fbbe | ||
|
|
e542279f99 | ||
|
|
5957cb278b | ||
|
|
de276b6a44 | ||
|
|
f9677dabb3 | ||
|
|
f3901f3095 | ||
|
|
77f6f9e539 | ||
|
|
35c2b8592c | ||
|
|
3e7af08524 | ||
|
|
eedb6e99dd | ||
|
|
e7eaac9d98 | ||
|
|
48aaf94221 | ||
|
|
ff48e79348 | ||
|
|
5408d8c4d4 | ||
|
|
1c618002ae | ||
|
|
5293234160 | ||
|
|
a23603b276 | ||
|
|
c458e7f4f6 | ||
|
|
d3d1f94539 | ||
|
|
3832d29643 | ||
|
|
07ede42745 | ||
|
|
c19a8df9f1 | ||
|
|
b5090d8a9d | ||
|
|
e36963bd1d | ||
|
|
961126724d | ||
|
|
cc21c1ea3c | ||
|
|
61b700ece4 | ||
|
|
112c6d9abf | ||
|
|
e371905fac | ||
|
|
c36d0722b2 | ||
|
|
85d709af83 | ||
|
|
67aae4ec91 | ||
|
|
c2e6daa5ad | ||
|
|
ac3285bc3f | ||
|
|
4d8632e0a0 | ||
|
|
66f7e28d33 | ||
|
|
6c9a12bf25 | ||
|
|
e5d9b38703 | ||
|
|
3877bf5bfa | ||
|
|
aa1d25339c | ||
|
|
20eb5a266a | ||
|
|
fa664966d2 | ||
|
|
6c492f2f7e | ||
|
|
0f81437251 | ||
|
|
4acd0fdb2c | ||
|
|
5b9a6c6cf9 | ||
|
|
2a0acefcdb | ||
|
|
f6f9922d24 | ||
|
|
22bf559807 | ||
|
|
baaa8eb457 | ||
|
|
84358b0ea1 | ||
|
|
5d02b61c61 | ||
|
|
55809c53fd | ||
|
|
f4446b8279 | ||
|
|
09757aaf11 | ||
|
|
d55dd28f39 | ||
|
|
e78e12c993 | ||
|
|
3d17bed746 | ||
|
|
0c69cbc41a | ||
|
|
f9ef8e9353 | ||
|
|
27c059b3c0 | ||
|
|
d71857fd35 | ||
|
|
7d9ab70317 | ||
|
|
303b0d456c | ||
|
|
6ebd2e5fc9 | ||
|
|
f99c00ae1c | ||
|
|
b27a19dbf7 | ||
|
|
0e22fd8682 | ||
|
|
2311305ed7 | ||
|
|
a2dc0ef333 | ||
|
|
c68b352522 | ||
|
|
a8ddb79f66 | ||
|
|
fba07bc9a6 | ||
|
|
eb7f6dd76f | ||
|
|
4f7b42bb3f | ||
|
|
9cc28a49c1 | ||
|
|
6079062c83 | ||
|
|
dfb997b44a | ||
|
|
3680edea69 | ||
|
|
37214d6d16 | ||
|
|
86d4e57275 | ||
|
|
19adb228bf | ||
|
|
e7e39bad2d | ||
|
|
481e143e19 | ||
|
|
4ed80fe21d | ||
|
|
b29fa0528d | ||
|
|
0809de398b | ||
|
|
e80a4a437a | ||
|
|
5da468fc29 | ||
|
|
5cd2cac09b | ||
|
|
46ff0f549e | ||
|
|
b54ed0a41e | ||
|
|
bb28e82a38 | ||
|
|
4bc79c442a | ||
|
|
563aab331a | ||
|
|
6671d04c74 | ||
|
|
70ffd1a45e | ||
|
|
a0c35ebbc8 | ||
|
|
b83caea63a | ||
|
|
583732fcdc | ||
|
|
0f5a7fa04f | ||
|
|
ce8ca9f62f | ||
|
|
7e5794cc7f | ||
|
|
7107288f88 | ||
|
|
deda45135e | ||
|
|
47d1ea2770 | ||
|
|
ac981915a1 | ||
|
|
f7de41ea1b | ||
|
|
7df84101d4 | ||
|
|
3920028fe5 | ||
|
|
84ff885f72 | ||
|
|
e26efb4e4d | ||
|
|
70f44244f9 | ||
|
|
89407fdcb2 | ||
|
|
738a874334 | ||
|
|
cee45f6a0a | ||
|
|
08ce27e97e | ||
|
|
0f83c8297e | ||
|
|
237be539b3 | ||
|
|
a880b2a699 | ||
|
|
3ec9cd817f | ||
|
|
bb9c6b7b88 | ||
|
|
20fa0a3cd1 | ||
|
|
578503c4cd | ||
|
|
61217a36e7 | ||
|
|
c93df9fd9d | ||
|
|
e2a13da325 | ||
|
|
2ac218e084 | ||
|
|
1d6836f6aa | ||
|
|
4213eec2a5 | ||
|
|
0e85fdd2cf | ||
|
|
bfd80e7855 | ||
|
|
8df2f83de0 | ||
|
|
e67e992bb0 | ||
|
|
3c7d413456 | ||
|
|
b3ec87f956 | ||
|
|
5db0f2132c | ||
|
|
5d33f779be | ||
|
|
64321dce56 | ||
|
|
1f3739415a | ||
|
|
db99492b9c | ||
|
|
89017fbc89 | ||
|
|
a887175f1a | ||
|
|
6e1e495397 | ||
|
|
bc59ed75ca | ||
|
|
6020fc216b | ||
|
|
bd4d939089 | ||
|
|
efe74a3b88 | ||
|
|
ab792a587c | ||
|
|
4ba4ac7e4e | ||
|
|
39e5115102 | ||
|
|
1e4536a914 | ||
|
|
49bbbe1a0b | ||
|
|
5460f984e9 | ||
|
|
d8ea6a3a59 | ||
|
|
a3eae3d5c1 | ||
|
|
998b74aa0a | ||
|
|
e4a172946b | ||
|
|
8ef067be77 | ||
|
|
6739f7ca24 | ||
|
|
6e51b83afc | ||
|
|
8206af0834 | ||
|
|
3512ad9c30 | ||
|
|
a2c74c14a1 | ||
|
|
c5d1e04d41 | ||
|
|
9b9fa26713 | ||
|
|
34d218fad0 | ||
|
|
04bf51d20e | ||
|
|
293aca2648 | ||
|
|
7b97e2535a | ||
|
|
1b7739178e | ||
|
|
23e8fe338f | ||
|
|
c6456d04f2 | ||
|
|
0e6e9af34d | ||
|
|
7c3307cd60 | ||
|
|
1c62818220 | ||
|
|
6daf41e66a | ||
|
|
632d12021f | ||
|
|
5e96ec22e8 | ||
|
|
c91cd9b962 | ||
|
|
6a7e72bfc5 | ||
|
|
7245b05426 | ||
|
|
23ce144f9d | ||
|
|
c53b88cc00 | ||
|
|
707957e8c1 | ||
|
|
58a8c0ed08 | ||
|
|
34c227b8ed | ||
|
|
e4df4059d1 | ||
|
|
514c7b553f | ||
|
|
3d4a5256e6 | ||
|
|
62266a64ee | ||
|
|
6b6c349a47 | ||
|
|
bcbb87783c | ||
|
|
bb9c65de4a | ||
|
|
881de132f7 | ||
|
|
c345ee27d8 | ||
|
|
f8b45f4480 | ||
|
|
9de03c68dd | ||
|
|
6c1e1b6f7f | ||
|
|
3190cf1526 | ||
|
|
27a8e16f97 | ||
|
|
a0f2e2d878 | ||
|
|
f1572580ac | ||
|
|
436619a0d8 | ||
|
|
4209430fe6 | ||
|
|
8b4fac7665 | ||
|
|
c2f5743cf0 | ||
|
|
69de91aa88 | ||
|
|
102f49b251 | ||
|
|
d1a443d952 | ||
|
|
026b833ba0 | ||
|
|
cc569fe0ba | ||
|
|
ec33f90f89 | ||
|
|
029b2d9770 | ||
|
|
1662c5cb75 | ||
|
|
1b2da6b558 | ||
|
|
1a54e42eb7 | ||
|
|
2c13b6b63d | ||
|
|
bb64e43ee1 | ||
|
|
626d9f988c | ||
|
|
543a2821e4 | ||
|
|
50bc94bafc | ||
|
|
70030b208d | ||
|
|
b1c13a25be | ||
|
|
eb20fb8b39 | ||
|
|
8d101ad5fa | ||
|
|
30afc99ccf | ||
|
|
48113f036f | ||
|
|
cd06bdedfe | ||
|
|
1de5da1e8a | ||
|
|
19bc28b29d | ||
|
|
326aeddbd5 | ||
|
|
afd764c27f | ||
|
|
c11be77aa1 | ||
|
|
98306c1c54 | ||
|
|
9bbfc788ea | ||
|
|
7c360a0ede | ||
|
|
7789062c7c | ||
|
|
ae6a2d3820 | ||
|
|
654fa09fff | ||
|
|
af0b6df2b4 | ||
|
|
814ca0385a | ||
|
|
856bffb324 | ||
|
|
eeb158a5c8 | ||
|
|
eef0e554d9 | ||
|
|
68c3b3981b | ||
|
|
bf62bc0261 | ||
|
|
179456cd0b | ||
|
|
15938e3d28 | ||
|
|
53b2bbad68 | ||
|
|
c3d5350315 | ||
|
|
8fad23691f | ||
|
|
6cd8779126 | ||
|
|
1aee735775 | ||
|
|
33fa065162 | ||
|
|
1f8d42ab49 | ||
|
|
fc62a7dfa0 | ||
|
|
f55c3befb3 | ||
|
|
b9e5704057 | ||
|
|
105d2d72de | ||
|
|
18d6e86e60 | ||
|
|
b1cb8edd18 | ||
|
|
808dbd160c | ||
|
|
882c2cb28d | ||
|
|
ccab19b2a1 | ||
|
|
021496c07d | ||
|
|
4043491ad2 | ||
|
|
b66025811f | ||
|
|
64c89836fd | ||
|
|
14f3144533 | ||
|
|
522530ec4a | ||
|
|
db6fb43d22 | ||
|
|
80b21524f4 | ||
|
|
44e14c0a1c | ||
|
|
b5f820cf69 | ||
|
|
ab99856c16 | ||
|
|
ca344d93cd | ||
|
|
cc2930b0b6 | ||
|
|
e1bc78da72 | ||
|
|
fd97bbcbd5 | ||
|
|
d6bc5a8782 | ||
|
|
da48a11374 | ||
|
|
83fa1e95e6 | ||
|
|
c753ac06b1 | ||
|
|
5a4ae00970 | ||
|
|
814cb6e255 | ||
|
|
6b23384ab9 | ||
|
|
524152f4a2 | ||
|
|
09ca020780 | ||
|
|
2499bb79ca | ||
|
|
1786c2c256 | ||
|
|
d772ad80f8 | ||
|
|
dca2b128aa | ||
|
|
256733b598 | ||
|
|
d245d5bbbb | ||
|
|
b851c5597a | ||
|
|
63f88cdf65 | ||
|
|
a3ca0b0d0c | ||
|
|
4d0786a64c | ||
|
|
0a1303d118 | ||
|
|
a5cecd6048 | ||
|
|
7231606eb2 | ||
|
|
15446e98b8 | ||
|
|
24d99eb33f | ||
|
|
620aae28d0 | ||
|
|
324a39d10b | ||
|
|
b52036c549 | ||
|
|
9e08087a11 | ||
|
|
42b7b7e221 | ||
|
|
3293e08d97 | ||
|
|
cf87f55085 | ||
|
|
e96d8ef475 | ||
|
|
9692921128 | ||
|
|
c86f0de79f | ||
|
|
5cf17f089f | ||
|
|
4ffca364ba | ||
|
|
b04110e3a9 | ||
|
|
6e61ada816 | ||
|
|
d276837833 | ||
|
|
4a17a7ef26 | ||
|
|
7e8a753be2 | ||
|
|
8d92b8a42a | ||
|
|
fb87a560fb | ||
|
|
a3667d1b28 | ||
|
|
3e0ead494e | ||
|
|
71bad95783 | ||
|
|
98dba29ab0 | ||
|
|
fd8da79b88 | ||
|
|
6f851845c6 | ||
|
|
ccbd4018b1 | ||
|
|
7ddadd9a6c | ||
|
|
ea46cf819f | ||
|
|
961429831c | ||
|
|
c4ab5a852f | ||
|
|
8a240e82bd | ||
|
|
59b78e3628 | ||
|
|
1cac7c1a41 | ||
|
|
439624e616 | ||
|
|
0cf272eda7 | ||
|
|
c595d95ee0 | ||
|
|
51f7110961 | ||
|
|
109c47645b | ||
|
|
766a33aaa1 | ||
|
|
b61bdcd67d | ||
|
|
9f1e808255 | ||
|
|
9dedc6d2a9 | ||
|
|
54ae3afcde | ||
|
|
c61c8d7fa0 | ||
|
|
c7e512a38a | ||
|
|
620143ae5b | ||
|
|
fe96a0172d | ||
|
|
b485c7ae26 | ||
|
|
22bf8b25b8 | ||
|
|
a61b3ec461 | ||
|
|
544aad390d | ||
|
|
90d255e7da | ||
|
|
30203383a4 | ||
|
|
9df3c22097 | ||
|
|
31231fe18b | ||
|
|
f994c9924f | ||
|
|
d23f82177f | ||
|
|
714708eac7 | ||
|
|
b311255d96 | ||
|
|
8a605b3884 | ||
|
|
83b93071d3 | ||
|
|
1670831269 | ||
|
|
ab79f655a1 | ||
|
|
40df6eafd1 | ||
|
|
04a6a1d4a4 | ||
|
|
27d7a159b1 | ||
|
|
c42c2e653b | ||
|
|
3014275982 | ||
|
|
d149218e1d | ||
|
|
cc94c45195 | ||
|
|
ff4a9fdab3 | ||
|
|
c069eedc9b | ||
|
|
4f028e41be | ||
|
|
27e6dad307 | ||
|
|
db91928984 | ||
|
|
ee0628e862 | ||
|
|
f5df9d7dbf | ||
|
|
fe66161352 | ||
|
|
33de1c31c5 | ||
|
|
73816a7ba2 | ||
|
|
f17139ba1e | ||
|
|
fe61d51c10 | ||
|
|
d418a16dd8 | ||
|
|
1a072e816a | ||
|
|
d447c90b13 | ||
|
|
3eee19578a | ||
|
|
0d0441ebd8 | ||
|
|
d09c5c5e5e | ||
|
|
3f466e8aac | ||
|
|
35696f9ca0 | ||
|
|
ab9781b85d | ||
|
|
4f5af9ab96 | ||
|
|
bb003d2b2f | ||
|
|
09e4625931 | ||
|
|
779a79d4d2 | ||
|
|
3ef640039b | ||
|
|
9b2c666c1f | ||
|
|
e932b4fa62 | ||
|
|
ecd64e80d8 | ||
|
|
9f28764811 | ||
|
|
e8e07ecec1 | ||
|
|
0c07cb70ca | ||
|
|
dcd358bf3a | ||
|
|
2d9f147dbc | ||
|
|
87a6be6749 | ||
|
|
97e1f0ba3c | ||
|
|
5cc6af0f54 | ||
|
|
170a3ad718 | ||
|
|
664e25d113 | ||
|
|
e739fd936e | ||
|
|
fa97770831 | ||
|
|
ff01fad3cd | ||
|
|
8f59172f27 | ||
|
|
677bc55056 | ||
|
|
da4f1aec1d | ||
|
|
b2823c5966 | ||
|
|
dfc45cc21e | ||
|
|
d3cb61ada7 | ||
|
|
54d864bc4a | ||
|
|
b54a0dd57e | ||
|
|
15dcab9097 | ||
|
|
d60c495995 | ||
|
|
e65ca47d98 | ||
|
|
3cf2289687 | ||
|
|
1f67492bf9 | ||
|
|
7e4bc445b9 | ||
|
|
7606bb3d1b | ||
|
|
1400efe36f | ||
|
|
375dd05773 | ||
|
|
b541b14ee9 | ||
|
|
0234d0afc8 | ||
|
|
843991083d | ||
|
|
fa0531aeb6 | ||
|
|
d474d1582a | ||
|
|
0b4b87fc3a | ||
|
|
091399aa4b | ||
|
|
b55b3f95f4 | ||
|
|
1749e3298c | ||
|
|
55d4599b3b | ||
|
|
74f05bf659 | ||
|
|
11273f3035 | ||
|
|
88e3b9e190 | ||
|
|
2862d13cb1 | ||
|
|
7f28540e62 | ||
|
|
64bc79aaac | ||
|
|
433660b2ce | ||
|
|
75f09b7527 | ||
|
|
70f67c7993 | ||
|
|
8697adb28a | ||
|
|
1021ec5ff4 | ||
|
|
41b379497d | ||
|
|
59ede8b979 | ||
|
|
bf33dd4091 | ||
|
|
a6468bdff1 | ||
|
|
1f4dd8cd33 | ||
|
|
b6870b4bba | ||
|
|
c296cbf6d1 | ||
|
|
2ae3dad92f | ||
|
|
d8258ef9fb | ||
|
|
e09cba03cc | ||
|
|
ffedb64ff2 | ||
|
|
01a24c6334 | ||
|
|
e3cb79ce2e | ||
|
|
5ee9b2fdd1 | ||
|
|
93e3bd930e | ||
|
|
3930d2ca33 | ||
|
|
b4c21acafd | ||
|
|
fe07fb4932 | ||
|
|
8eb6047972 | ||
|
|
4fa3909eaf | ||
|
|
4b96911b37 | ||
|
|
21eef960b5 | ||
|
|
dbfb29fdf8 | ||
|
|
3545f7758a | ||
|
|
9f546f938d | ||
|
|
649cbb65c0 | ||
|
|
c9339c2871 | ||
|
|
62bdd75c43 | ||
|
|
658dbda6d4 | ||
|
|
d08466d265 | ||
|
|
c96c3c3d45 | ||
|
|
7f5dfd7319 | ||
|
|
ffbcdb7b49 | ||
|
|
10df80feda | ||
|
|
c09c85e862 | ||
|
|
7b71c66fd6 | ||
|
|
25dc5b5991 | ||
|
|
4be1e7d8d8 | ||
|
|
a47ff5cdb5 | ||
|
|
ae5aeef147 | ||
|
|
4ca522bf0e | ||
|
|
2a4f06e32d | ||
|
|
7716feee71 | ||
|
|
54e5fa5256 | ||
|
|
e69acd9198 | ||
|
|
a15f1c8946 | ||
|
|
f05de2ffc8 | ||
|
|
d4e3a4f74d | ||
|
|
ee227f01b9 | ||
|
|
f2e78d9064 | ||
|
|
69f699e6a1 | ||
|
|
73785e74bc | ||
|
|
6141d0305a | ||
|
|
70ce304c93 | ||
|
|
83bc8d4f21 | ||
|
|
8b60b07cc5 | ||
|
|
2ec9e10f14 | ||
|
|
9b807a6c30 | ||
|
|
c5de948cd3 | ||
|
|
846d8f65e0 | ||
|
|
deb9fce5d5 | ||
|
|
79e27f2d90 | ||
|
|
b42777a28c | ||
|
|
e1b7126ae3 | ||
|
|
d0b18287c8 | ||
|
|
74771cb2db | ||
|
|
0f401d4c9d | ||
|
|
2e64aac788 | ||
|
|
1d8e7626a1 | ||
|
|
cfce055b37 | ||
|
|
f6a8c5e886 | ||
|
|
e31d5fd3fb | ||
|
|
bbde38a6dc | ||
|
|
1fcbf1721b | ||
|
|
2d2c44ca9d | ||
|
|
8fd59feb21 | ||
|
|
fdde9b9c49 | ||
|
|
c25b9ff1f3 | ||
|
|
cee8473910 | ||
|
|
ba9c455ea1 | ||
|
|
3c82e80745 | ||
|
|
07a25a7757 | ||
|
|
2ef63035f2 | ||
|
|
57e985b7f1 | ||
|
|
21c37951d6 | ||
|
|
9c83a2f85f | ||
|
|
6877722f81 | ||
|
|
fd6cb970e4 | ||
|
|
5eb173e8dd | ||
|
|
c2822fdad7 | ||
|
|
222c237cbc | ||
|
|
4cf5bc536c | ||
|
|
ae48edfb5f | ||
|
|
9c9599d65f | ||
|
|
d4058a8a31 | ||
|
|
7404105247 | ||
|
|
e7ea3d9667 | ||
|
|
17b4a5a15c | ||
|
|
d633dd7bb7 | ||
|
|
d31e53fa59 | ||
|
|
cd56b2f401 | ||
|
|
58f37f38f4 | ||
|
|
dd4b508213 | ||
|
|
719ed4c795 | ||
|
|
66ce736a81 | ||
|
|
63484e28e0 | ||
|
|
2fd1430329 | ||
|
|
b7c4b9e263 | ||
|
|
111dd13d39 | ||
|
|
18d1d31042 | ||
|
|
6c70c6c32a | ||
|
|
0660dfb84c | ||
|
|
3eac3cc38c | ||
|
|
a24bf67688 | ||
|
|
72b8c4b3c8 | ||
|
|
4a19cd758c | ||
|
|
88c304b85f | ||
|
|
ac7477a6c1 | ||
|
|
6d41697af0 | ||
|
|
cec0389a8a | ||
|
|
a947633bec | ||
|
|
0539be1b1c | ||
|
|
90e474ca75 | ||
|
|
79d3440c92 | ||
|
|
000fc55035 | ||
|
|
b2e74b1473 | ||
|
|
9fa3e47b65 | ||
|
|
0e0c048074 | ||
|
|
8c4abd4d9c | ||
|
|
0ff3589bb9 | ||
|
|
9b866b2e12 | ||
|
|
0051cb9553 | ||
|
|
4736b8d6e7 | ||
|
|
abe7ca21bf | ||
|
|
88a6cffb34 | ||
|
|
c8a194c0a8 | ||
|
|
797b961484 | ||
|
|
9cd67dfc5c | ||
|
|
eb8107115d | ||
|
|
af0997a147 | ||
|
|
823fc14722 | ||
|
|
9007a6214a | ||
|
|
be349f6229 | ||
|
|
bb5c65a7db | ||
|
|
1eae609a35 | ||
|
|
f4c91915bb | ||
|
|
3acf284a4a | ||
|
|
52b7ee6447 | ||
|
|
65f1a8f430 | ||
|
|
18b5495a8c | ||
|
|
0b1fe9c611 | ||
|
|
2904d1745b | ||
|
|
86938f57b1 | ||
|
|
10c5949199 | ||
|
|
f7e0b06c2f | ||
|
|
5313cf3bf0 | ||
|
|
7ce62a5b64 | ||
|
|
41a416da60 | ||
|
|
ecbb2f10ef | ||
|
|
9bf73cf4b3 | ||
|
|
63aacc416f | ||
|
|
639aa9e218 | ||
|
|
df5b809b46 | ||
|
|
74467df3ef | ||
|
|
c8f73cfdae | ||
|
|
1c0cdbf142 | ||
|
|
0187451c6f | ||
|
|
f91d4c5497 | ||
|
|
8e516441f1 | ||
|
|
341bd3a555 | ||
|
|
5a09d3a6b5 | ||
|
|
c662f51a0a | ||
|
|
e15953b9fc | ||
|
|
2ec03acd17 | ||
|
|
96c6e604fb | ||
|
|
0bf6c75e49 | ||
|
|
a4d2cd5247 | ||
|
|
fb80e64e6b | ||
|
|
41dd4b29ae | ||
|
|
8797c3ea95 | ||
|
|
0031a633a2 | ||
|
|
69ae014da3 | ||
|
|
aa4e69de11 | ||
|
|
0090ce3322 | ||
|
|
de37f73c8d | ||
|
|
0df71bd696 | ||
|
|
99827d10a8 | ||
|
|
b0aa094cf8 | ||
|
|
20c1181ad1 | ||
|
|
e37cb461f6 | ||
|
|
f9ae4f58b8 | ||
|
|
d385cd0155 | ||
|
|
52d259bc7b | ||
|
|
a0a22b7be6 | ||
|
|
f84d00eec9 | ||
|
|
0dc24bcd92 | ||
|
|
2cb530a6d1 | ||
|
|
56acd57e73 | ||
|
|
2e27fb80f3 | ||
|
|
3e02764603 | ||
|
|
a7531926a4 | ||
|
|
bd3d41e7ed | ||
|
|
e1831877b7 | ||
|
|
99aee736d1 | ||
|
|
95f84459c9 | ||
|
|
5e1e6c2595 | ||
|
|
3e13ca3fd1 | ||
|
|
dd15b0e222 | ||
|
|
1671015466 | ||
|
|
aa39519323 | ||
|
|
a089054b1a | ||
|
|
3851de11f7 | ||
|
|
fe170f383a | ||
|
|
73f8fdb474 | ||
|
|
9b0092190a | ||
|
|
20b6eae88c | ||
|
|
dad59b20ba | ||
|
|
4549ad0a5e | ||
|
|
a23a255ec1 | ||
|
|
3bbc1e342a | ||
|
|
4b5eaccb94 | ||
|
|
7668141f85 | ||
|
|
1441f6d591 | ||
|
|
db81672d23 | ||
|
|
3b41627b9f | ||
|
|
8b5607d98f | ||
|
|
ab730b7dd5 | ||
|
|
44dcdde513 | ||
|
|
a6c4a36ce5 | ||
|
|
731f2d51f6 | ||
|
|
126c21de96 | ||
|
|
e89a8c684f | ||
|
|
e9613b95ac | ||
|
|
8d71840255 | ||
|
|
e384d4ec96 | ||
|
|
c1772685e9 | ||
|
|
ca4751653f | ||
|
|
5f6804b6b4 | ||
|
|
191d566fb8 | ||
|
|
bfa20f7156 | ||
|
|
6bec3c9366 | ||
|
|
7362f69a62 | ||
|
|
10d971bc7a | ||
|
|
6874ab0ddc | ||
|
|
9422fea0c4 | ||
|
|
d7c8655966 | ||
|
|
2f47e30a1a | ||
|
|
54e5b6d476 | ||
|
|
5ba0177af8 | ||
|
|
4d0baf3e06 | ||
|
|
4305a009df | ||
|
|
ffd62eb80e | ||
|
|
c4a3963925 | ||
|
|
5c56900a09 | ||
|
|
fb9c4b92c4 | ||
|
|
6ce830e999 | ||
|
|
6f2625c7eb | ||
|
|
d2cddde04e | ||
|
|
7d46affd14 | ||
|
|
0f780a84d4 | ||
|
|
05b482e7d5 | ||
|
|
8dff523858 | ||
|
|
3b43d5e874 | ||
|
|
192a81591b | ||
|
|
c4b5577555 | ||
|
|
85bd41dfa5 | ||
|
|
cc5ba53c80 | ||
|
|
051e94b1c5 | ||
|
|
b612989eb0 | ||
|
|
cc6bd6239a | ||
|
|
65716431c4 | ||
|
|
0b51a6cae0 | ||
|
|
a0caa88adf | ||
|
|
0a1907de11 | ||
|
|
7a3000ccac | ||
|
|
43c37398af | ||
|
|
5d92453532 | ||
|
|
e76abcb625 | ||
|
|
84e4611d2b | ||
|
|
949f5ed834 | ||
|
|
173dfc4811 | ||
|
|
e97b65801b | ||
|
|
047db78104 | ||
|
|
abaa450917 | ||
|
|
8f78ee851b | ||
|
|
b9e07eb645 | ||
|
|
37b12bff2e | ||
|
|
6574eca393 | ||
|
|
739acbcf01 | ||
|
|
44580406ec | ||
|
|
cb3a1352e4 | ||
|
|
47f6af8e42 | ||
|
|
95e05d7d97 | ||
|
|
290681ceee | ||
|
|
65f1efb921 | ||
|
|
47abdcf565 | ||
|
|
0f2fa6bade | ||
|
|
fe685633b0 | ||
|
|
b0e9e7b5e7 | ||
|
|
21fa647983 | ||
|
|
8d9acc2662 | ||
|
|
bbab0eebae | ||
|
|
8fbc71df8a | ||
|
|
849aaaf5d2 | ||
|
|
b1847698a8 | ||
|
|
b1fd1d8301 | ||
|
|
fa08289706 | ||
|
|
303a613389 | ||
|
|
1263919e39 | ||
|
|
d14f382db9 | ||
|
|
5989bed5c7 | ||
|
|
9e45eb7326 | ||
|
|
05cf9041af | ||
|
|
8c8accad42 | ||
|
|
0ad48a3598 | ||
|
|
fb1f863098 | ||
|
|
1a03850951 | ||
|
|
d4854c22c4 | ||
|
|
eb06ac948b | ||
|
|
b039c69952 | ||
|
|
9d9580d4af | ||
|
|
7f051e38e5 | ||
|
|
4b4a9eb6c9 | ||
|
|
e46e77f0d3 | ||
|
|
effaebdd26 | ||
|
|
fe39f1ea63 | ||
|
|
40943fa6d2 | ||
|
|
d9ed18dc00 | ||
|
|
d70a5c9233 | ||
|
|
1170cbb7fa | ||
|
|
6f8c9bf0d1 | ||
|
|
1765843e1d | ||
|
|
9ada4a8082 | ||
|
|
6dfc923cf8 | ||
|
|
0fc0230069 | ||
|
|
1bedda7748 | ||
|
|
aeca4d3feb | ||
|
|
3a34ccb03e | ||
|
|
e3ba5bf9b7 | ||
|
|
4748befcfd | ||
|
|
fa96915a9c | ||
|
|
01e92be7d2 | ||
|
|
92c9688caf | ||
|
|
8e5ea77a72 | ||
|
|
59c94732a7 | ||
|
|
a577ccabab | ||
|
|
bf4fbe4aff | ||
|
|
207f8e7c47 | ||
|
|
689092da08 | ||
|
|
f929a7f5a9 | ||
|
|
69080b72af | ||
|
|
a91b113cc3 | ||
|
|
758bebafa4 | ||
|
|
5d4e4707ca | ||
|
|
0fddc92a64 | ||
|
|
034cd8844e | ||
|
|
6dd60ac8b0 | ||
|
|
18de2c8a1f | ||
|
|
ac633124a1 | ||
|
|
74da34baf2 | ||
|
|
8d0f8a0035 | ||
|
|
f29383faab | ||
|
|
2b1f8b843c | ||
|
|
26ccb80abb | ||
|
|
2a8ee31920 | ||
|
|
f34dd7b1b9 | ||
|
|
abbaa51a91 | ||
|
|
29dd3821cc | ||
|
|
941e47503e | ||
|
|
83075d0ad2 | ||
|
|
d437787c3d | ||
|
|
66aef9a64f | ||
|
|
91a1a1420d | ||
|
|
f166ae43bf | ||
|
|
db78db57fa | ||
|
|
4a6fd1676b | ||
|
|
5f3fc5190f | ||
|
|
330953782f | ||
|
|
4a2ff1f1d1 | ||
|
|
df7490d01c | ||
|
|
e69b9af6d1 | ||
|
|
6f38388409 | ||
|
|
934cce75af | ||
|
|
380c8b596a | ||
|
|
2c3a955074 | ||
|
|
7c4d1e6b09 | ||
|
|
b5aa44ae49 | ||
|
|
39b6c53ef3 | ||
|
|
f64487eb8b | ||
|
|
6b9c6e3d95 | ||
|
|
f1e31341ef | ||
|
|
c293fe124d | ||
|
|
5eae85dff5 | ||
|
|
e4d33e386e | ||
|
|
2201e63031 | ||
|
|
8a7548bc84 | ||
|
|
ab8bdf673d | ||
|
|
aea5620372 | ||
|
|
a930ae1b4f | ||
|
|
dc876e8eeb | ||
|
|
085ccd7327 | ||
|
|
6d567750d1 | ||
|
|
41fe1a55a5 | ||
|
|
897cfc534e | ||
|
|
9120732ad3 | ||
|
|
8f26bcaabb | ||
|
|
a217ff6746 | ||
|
|
e37f11ae53 | ||
|
|
04c83b25d4 | ||
|
|
14a033cbd4 | ||
|
|
27bbca7fe4 | ||
|
|
9d4447e3ae | ||
|
|
09f4705360 | ||
|
|
43fd993d6d | ||
|
|
16cad76060 | ||
|
|
5609d2506d | ||
|
|
3760bdfee9 | ||
|
|
b14ca4775c | ||
|
|
a7b703798a | ||
|
|
b3b885b8f9 | ||
|
|
4cea564c2f | ||
|
|
9684f05e7c | ||
|
|
5314b7a81e | ||
|
|
1f665e35f1 | ||
|
|
f12b678234 | ||
|
|
7e96501b81 | ||
|
|
c47704ab86 | ||
|
|
c53450d528 | ||
|
|
7bd87f64ac | ||
|
|
e16ff27e57 | ||
|
|
859ef8432e | ||
|
|
a8da60414f | ||
|
|
9ee3c0de6d | ||
|
|
8c5e7de29d | ||
|
|
1a7b7db67f | ||
|
|
f26412aae4 | ||
|
|
9d538dad8a | ||
|
|
33a82da493 | ||
|
|
142d9a090c | ||
|
|
4cebd3f75b | ||
|
|
293b272a22 | ||
|
|
ad848f2ebc | ||
|
|
0fea6822c3 | ||
|
|
a2e453b759 | ||
|
|
0b53bd25bd | ||
|
|
9bd4ed2a8d | ||
|
|
55968aabad | ||
|
|
4d4ba52378 | ||
|
|
0730248fb4 | ||
|
|
48445c23ef | ||
|
|
e03eaf6dde | ||
|
|
1de4da28fc | ||
|
|
6d95bb7f70 | ||
|
|
55acb2a675 | ||
|
|
dda15f7505 | ||
|
|
c041fc8fea | ||
|
|
6fa36d330c | ||
|
|
28c93f2912 | ||
|
|
60f8c8a343 | ||
|
|
87b5356ef9 | ||
|
|
4eac6f0d27 | ||
|
|
bc9f5da47e | ||
|
|
c483a7f7cd | ||
|
|
c0ce15ddfb | ||
|
|
8659d14ba0 | ||
|
|
da7f4f3421 | ||
|
|
862a6ffbbc | ||
|
|
0ce1c56999 | ||
|
|
5196a17f69 | ||
|
|
16aa79a828 | ||
|
|
6ab081d969 | ||
|
|
1f0a0b823b | ||
|
|
46b848857e | ||
|
|
d01193f8a3 | ||
|
|
5dec5a4c28 | ||
|
|
af3dffbed4 | ||
|
|
ef1ffa4bf7 | ||
|
|
20341a84e6 | ||
|
|
0df966323d | ||
|
|
b13a99d4cd | ||
|
|
fdf4c431e4 | ||
|
|
3cc61d070b | ||
|
|
d9cbeadfff | ||
|
|
d89f00e981 | ||
|
|
778df8b1fd | ||
|
|
63b3e59a18 | ||
|
|
bf42e3c093 | ||
|
|
df11628fb0 | ||
|
|
a09ebcd1d1 | ||
|
|
93680e1233 | ||
|
|
3e7ce13893 | ||
|
|
dc363c8db4 | ||
|
|
12473576b7 | ||
|
|
f596fb48fe | ||
|
|
e95bcbcc97 | ||
|
|
4517113bd3 | ||
|
|
204b9e3d2f | ||
|
|
08d2002277 | ||
|
|
85a18347b9 | ||
|
|
b7e4907f74 | ||
|
|
b300329e21 | ||
|
|
fbaaee65e1 | ||
|
|
7beb4fe10e | ||
|
|
2b83b970ed | ||
|
|
74469590b4 | ||
|
|
e69fe6f7d1 | ||
|
|
bd16ce4634 | ||
|
|
ad5a869a0a | ||
|
|
22d3adc89f | ||
|
|
a6bfa1ff6c | ||
|
|
21f6d1630d | ||
|
|
00ef0fc0a6 | ||
|
|
e9d1171d6d | ||
|
|
beec5a843e | ||
|
|
808c5abc0f | ||
|
|
d4a8ed5ae6 | ||
|
|
f0d52e63b2 | ||
|
|
f4a44155d9 | ||
|
|
538aa869b4 | ||
|
|
93b7e9add9 | ||
|
|
9b9e338131 | ||
|
|
70cde87052 | ||
|
|
38cc3e39e4 | ||
|
|
4dc51901ba | ||
|
|
a299cec2eb | ||
|
|
9b645589df | ||
|
|
6208bdb6da | ||
|
|
e6594ed5b1 | ||
|
|
54dffd6aad | ||
|
|
b8507c0391 | ||
|
|
122c2cbefb | ||
|
|
b0302246a0 | ||
|
|
93fd2bf10f | ||
|
|
76a62d8b7d | ||
|
|
f5e8766600 | ||
|
|
4089ac68bd | ||
|
|
19e6b02da8 | ||
|
|
2077faa76a | ||
|
|
4c241b1234 | ||
|
|
16fa729c74 | ||
|
|
c37d7352a5 | ||
|
|
972b234db6 | ||
|
|
b467638633 | ||
|
|
ce02c3e058 | ||
|
|
e3a30b10a9 | ||
|
|
2daf9a10d0 | ||
|
|
e49459f2cd | ||
|
|
e131cc1e83 | ||
|
|
5bdd68e502 | ||
|
|
32699133cd | ||
|
|
9906bbef4e | ||
|
|
4c64ea58d5 | ||
|
|
9c15a04291 | ||
|
|
5e5cd86194 | ||
|
|
1ab555a51b | ||
|
|
7fcbb3d563 | ||
|
|
68d8b6b4c3 | ||
|
|
4775329fb7 | ||
|
|
a5cf54d370 | ||
|
|
a85519c3db | ||
|
|
67d0d8b1a9 | ||
|
|
58de1cabbc | ||
|
|
11bc01795f | ||
|
|
57518c1200 | ||
|
|
207e161bfc | ||
|
|
cb87ec8bdd | ||
|
|
b6e2a0fb39 | ||
|
|
62f35e5e87 | ||
|
|
0626225ea5 | ||
|
|
f697098fb4 | ||
|
|
51c38d4cd3 | ||
|
|
428a2d8538 | ||
|
|
dc3e324987 | ||
|
|
6e8ac23689 | ||
|
|
8584a76750 | ||
|
|
d778952512 | ||
|
|
e15340bf3c | ||
|
|
e91805a593 | ||
|
|
7a03c85549 | ||
|
|
f5d6e8d751 | ||
|
|
d7a60f5fed | ||
|
|
97058e628e | ||
|
|
9904f21ceb | ||
|
|
e72cdbc1f7 | ||
|
|
bd31f36836 | ||
|
|
93327a3e31 | ||
|
|
d45a4f9d27 | ||
|
|
f0dea9aee4 | ||
|
|
ee395bee1f | ||
|
|
bb2e1c04ec | ||
|
|
28f1d288cf | ||
|
|
3ac45ecca7 | ||
|
|
d92e989c6e | ||
|
|
8a123f8722 | ||
|
|
8141229744 | ||
|
|
b01dc094db | ||
|
|
fcc3a4d0ab | ||
|
|
1824879dd0 | ||
|
|
9d0a4155bb | ||
|
|
e9639ead91 | ||
|
|
520b16e065 | ||
|
|
85b50aefda | ||
|
|
85337c3546 | ||
|
|
9b05e0a540 | ||
|
|
2f545688eb | ||
|
|
d27eb680e0 | ||
|
|
ac24f366e2 | ||
|
|
e04b946bf9 | ||
|
|
79cf8e60b8 | ||
|
|
1cfc5f366e | ||
|
|
b73ba148b6 | ||
|
|
7047267937 | ||
|
|
204ba8b2f4 | ||
|
|
f5b35e39ac | ||
|
|
9947bff2e1 | ||
|
|
0f38e3f1fc | ||
|
|
542201f4ed | ||
|
|
f6e9b0e234 | ||
|
|
cd2e619364 | ||
|
|
fc14d98869 | ||
|
|
b09050bb18 | ||
|
|
8a946c6ef9 | ||
|
|
b07d6d56a0 | ||
|
|
f55e3ce681 | ||
|
|
de1c416859 | ||
|
|
f311f88b8d | ||
|
|
b69e36331a | ||
|
|
fb12605185 | ||
|
|
9f0999c61e | ||
|
|
6778dda9db | ||
|
|
0ec4131231 | ||
|
|
947ab99f53 | ||
|
|
d4d713050a | ||
|
|
becd68b98d | ||
|
|
3b39257f13 | ||
|
|
f925bfccd0 | ||
|
|
f09054d1a0 | ||
|
|
4df4a91615 | ||
|
|
689cff6196 | ||
|
|
1f12658ce7 | ||
|
|
07df3dfe85 | ||
|
|
1978d3522d | ||
|
|
31ea793328 | ||
|
|
15328ed9c5 | ||
|
|
bc2a46a3da | ||
|
|
820152b97c | ||
|
|
b8eb0c84ff | ||
|
|
e324d3914f | ||
|
|
968a57fa7c | ||
|
|
34f9ae77ba | ||
|
|
a93596ca5e | ||
|
|
fc0750b504 | ||
|
|
77876f9a44 | ||
|
|
feb484cccb | ||
|
|
1dc928b5db | ||
|
|
c8aa3d9290 | ||
|
|
654a995a9d | ||
|
|
32073f0987 | ||
|
|
a9809c2c6b | ||
|
|
6141467499 | ||
|
|
5ad7be38bc | ||
|
|
3e7541605e | ||
|
|
54ff3f73fb | ||
|
|
7995013abb | ||
|
|
011cdba158 | ||
|
|
ebabb3b8af | ||
|
|
63248ed5b6 | ||
|
|
c224b6441d | ||
|
|
1092164684 | ||
|
|
d349bca42c | ||
|
|
6c6abab033 | ||
|
|
0bbc33755b | ||
|
|
95c9c4c0c4 | ||
|
|
d7624aa7b6 | ||
|
|
5e86cbe004 | ||
|
|
6975691e7a | ||
|
|
482d7813ee | ||
|
|
db57ca2bf7 | ||
|
|
74212bd2a4 | ||
|
|
83d5b1e6a0 | ||
|
|
42fb53f488 | ||
|
|
01b3d75374 | ||
|
|
46a485da01 | ||
|
|
91825a404c | ||
|
|
3d8b86040d | ||
|
|
a4a7e5818c | ||
|
|
a739964c74 | ||
|
|
17fa105116 | ||
|
|
f9331407a5 | ||
|
|
2948875cad | ||
|
|
f0ce7ac33a | ||
|
|
c5c5c7f8bb | ||
|
|
3a9ed81915 | ||
|
|
932d29e2ef | ||
|
|
aef96e93cf | ||
|
|
f220024308 | ||
|
|
3549d50225 | ||
|
|
d9ddaf298b | ||
|
|
b3265024ab | ||
|
|
09161d41c9 | ||
|
|
5f766aa33a | ||
|
|
4084416d56 | ||
|
|
6ed2d1560c | ||
|
|
6df5e8b73a | ||
|
|
f28a4c5464 | ||
|
|
5368e8cef3 | ||
|
|
c9921a3699 | ||
|
|
08a150b09e | ||
|
|
ef52ce6b9b | ||
|
|
00873b6e8c | ||
|
|
fd0251729b | ||
|
|
fad9169005 | ||
|
|
2dafbdc45a | ||
|
|
c9bdfd2f07 | ||
|
|
0c5960922a | ||
|
|
9eecf22e15 | ||
|
|
b23601eefe | ||
|
|
9dd167a760 | ||
|
|
d487f754cd | ||
|
|
a773b8426e | ||
|
|
6aef746d30 | ||
|
|
b9b87d894a | ||
|
|
f53f3e17c9 | ||
|
|
88bf3d9298 | ||
|
|
6375ea89a0 | ||
|
|
efc67f3d89 | ||
|
|
4252b3bca7 | ||
|
|
e761d69e9c | ||
|
|
914db59ea0 | ||
|
|
caad1c20a2 | ||
|
|
f4c1722a46 | ||
|
|
8d7de5d063 | ||
|
|
dd671313c5 | ||
|
|
4df311366d | ||
|
|
795b3bfbe0 | ||
|
|
a937d6be91 | ||
|
|
4da03f75f9 | ||
|
|
6530d48785 | ||
|
|
5b6828a7ce | ||
|
|
304926005f | ||
|
|
85f7b4069f | ||
|
|
673eba662d | ||
|
|
6f4afd675f | ||
|
|
af682d61f0 | ||
|
|
dff5f382ab | ||
|
|
1378f836f5 | ||
|
|
f17a7df6d9 | ||
|
|
b7a4349827 | ||
|
|
74ca357502 | ||
|
|
c21f52127c | ||
|
|
de45f2e8f7 | ||
|
|
8a33e1d6b2 | ||
|
|
5e40423de3 | ||
|
|
3cd41b2503 | ||
|
|
e97f53ce8d | ||
|
|
32f30c89d0 | ||
|
|
07ed31f90e | ||
|
|
c07306a7f2 | ||
|
|
8e740a3ee4 | ||
|
|
bc7f2fd09b | ||
|
|
0207693cec | ||
|
|
21b9835dc5 | ||
|
|
c2f2356855 | ||
|
|
e064a50728 | ||
|
|
1f2e3d09af | ||
|
|
5ac10ee8e5 | ||
|
|
c849a0c4e3 | ||
|
|
5b93ae2d08 | ||
|
|
12fd07af08 | ||
|
|
d8c9d19bd7 | ||
|
|
889ea107f6 | ||
|
|
da2f886bee | ||
|
|
d3f9e61db7 | ||
|
|
649259e715 | ||
|
|
7d8bde2ac6 | ||
|
|
94552d5524 | ||
|
|
6c2b402625 | ||
|
|
59e74e79c2 | ||
|
|
997e26d11e | ||
|
|
5fa069bebd | ||
|
|
3b11d5787c | ||
|
|
9d3907ff98 | ||
|
|
aa898725fc | ||
|
|
0f496eac21 | ||
|
|
ca587513e3 | ||
|
|
99a908e8fe | ||
|
|
8564c20baa | ||
|
|
af601b5a90 | ||
|
|
9c7724b7f9 | ||
|
|
cb08d27970 | ||
|
|
aeb7a0f1a7 | ||
|
|
4c55c484ed | ||
|
|
a7536e1ae9 | ||
|
|
10cedf8576 | ||
|
|
e4bb109060 | ||
|
|
c726c95921 | ||
|
|
7f617de8ac | ||
|
|
6017604e38 | ||
|
|
8d501bd7f4 | ||
|
|
c39a4dc57a | ||
|
|
c42380dc0b | ||
|
|
9c7cb64a30 | ||
|
|
662acb58b1 | ||
|
|
3ae89dbb1d | ||
|
|
b5b6f58b6b | ||
|
|
737b246b01 | ||
|
|
96b48aedfc | ||
|
|
86cc1db609 | ||
|
|
613a298e82 | ||
|
|
0c0d4d28c8 | ||
|
|
4b64e312fe | ||
|
|
8ac63a53ad | ||
|
|
05cf6a407a | ||
|
|
5bbe9af4bb | ||
|
|
b6aa9b2bce | ||
|
|
1ced967bc9 | ||
|
|
32b7f64792 | ||
|
|
aad4e306b2 | ||
|
|
908b58878b | ||
|
|
eb155bb204 | ||
|
|
da47c31a86 | ||
|
|
ff45322d1a | ||
|
|
3e1a5a7be1 | ||
|
|
4ed07cd9ae | ||
|
|
4ee76a6649 | ||
|
|
19e283a333 | ||
|
|
cda953942d | ||
|
|
4b465afdfa | ||
|
|
37cfb2fcc0 | ||
|
|
691cf52835 | ||
|
|
7773f713b7 | ||
|
|
39450dd954 | ||
|
|
473a969598 | ||
|
|
e8f9097127 | ||
|
|
d0a6f6252d | ||
|
|
993d3a3469 | ||
|
|
837cf38e91 | ||
|
|
8252c51ebc | ||
|
|
60f30732ed | ||
|
|
4525e05268 | ||
|
|
b09e0aa520 | ||
|
|
41f5c64607 | ||
|
|
059c6d0673 | ||
|
|
7e56d6eed8 | ||
|
|
1a216c22f2 | ||
|
|
d37bdbc07d | ||
|
|
21e97b408c | ||
|
|
d2a308964d | ||
|
|
d1f217f2df | ||
|
|
62b89655b9 | ||
|
|
f20c4dac15 | ||
|
|
5ff718b94c | ||
|
|
4a37c130df | ||
|
|
f287e2b55d | ||
|
|
94cad16d1d | ||
|
|
00bed4a2a4 | ||
|
|
3b63e6e061 | ||
|
|
9177080d8b | ||
|
|
c5e9deb906 | ||
|
|
044487cf37 | ||
|
|
89b413b7ad | ||
|
|
e2d213f1fd | ||
|
|
494345ce10 | ||
|
|
1f4d994480 | ||
|
|
961fde3c8a | ||
|
|
3fc2e5d20c | ||
|
|
900788a8e0 | ||
|
|
7bb7445c57 | ||
|
|
6384b7340c | ||
|
|
31480385c1 |
15
.idea/compiler.xml
generated
15
.idea/compiler.xml
generated
@@ -4,20 +4,7 @@
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="?*.properties" />
|
||||
<entry name="?*.xml" />
|
||||
<entry name="?*.gif" />
|
||||
<entry name="?*.png" />
|
||||
<entry name="?*.jpeg" />
|
||||
<entry name="?*.jpg" />
|
||||
<entry name="?*.html" />
|
||||
<entry name="?*.dtd" />
|
||||
<entry name="?*.tld" />
|
||||
<entry name="?*.ftl" />
|
||||
<entry name="?*.jet" />
|
||||
<entry name="?*.ft" />
|
||||
<entry name="?*.kt" />
|
||||
<entry name="?*.template" />
|
||||
<entry name="!*.java" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
|
||||
6
.idea/copyright/profiles_settings.xml
generated
6
.idea/copyright/profiles_settings.xml
generated
@@ -1,6 +1,8 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="apache">
|
||||
<module2copyright />
|
||||
<settings default="">
|
||||
<module2copyright>
|
||||
<element module="all except testData" copyright="apache" />
|
||||
</module2copyright>
|
||||
<LanguageOptions name="Groovy">
|
||||
<option name="fileTypeOverride" value="1" />
|
||||
</LanguageOptions>
|
||||
|
||||
11
.idea/libraries/copyright_plugin.xml
generated
Normal file
11
.idea/libraries/copyright_plugin.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="copyright-plugin">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/copyright/lib/copyright.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/plugins/copyright/src" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
1
.idea/libraries/idea_full.xml
generated
1
.idea/libraries/idea_full.xml
generated
@@ -190,6 +190,7 @@
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/simple" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/tools/lexer/jflex-1.4/examples/java" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-12.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/jetbrains-asm-all-4.0-src.zip!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/lib" recursive="false" />
|
||||
</library>
|
||||
|
||||
20
.idea/libraries/jps.xml
generated
Normal file
20
.idea/libraries/jps.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
<component name="libraryTable">
|
||||
<library name="jps">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/ideaSDK/jps" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-api/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/antLayout/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/src" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/standalone-builder/src" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/jps" recursive="false" />
|
||||
</library>
|
||||
</component>
|
||||
14
.idea/libraries/jps_test.xml
generated
Normal file
14
.idea/libraries/jps_test.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<component name="libraryTable">
|
||||
<library name="jps-test">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/ideaSDK/jps/test" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/jps-builders/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-impl/testSrc" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.zip!/jps/model-serialization/testSrc" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/jps/test" recursive="false" />
|
||||
</library>
|
||||
</component>
|
||||
22
.idea/misc.xml
generated
22
.idea/misc.xml
generated
@@ -43,28 +43,6 @@
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
|
||||
<option name="myDefaultNotNull" value="org.jetbrains.annotations.NotNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="3">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="3">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectResources">
|
||||
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
|
||||
</component>
|
||||
|
||||
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -24,6 +24,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-plugin.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.tests/js.tests.iml" filepath="$PROJECT_DIR$/js/js.tests/js.tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.translator/js.translator.iml" filepath="$PROJECT_DIR$/js/js.translator/js.translator.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml" filepath="$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/runtime/runtime.iml" filepath="$PROJECT_DIR$/runtime/runtime.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/util/util.iml" filepath="$PROJECT_DIR$/compiler/util/util.iml" />
|
||||
</modules>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="wholeProject" />
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
@@ -28,6 +28,9 @@
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" additional-options2=onexit\=snapshot " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
|
||||
2
.idea/runConfigurations/IDEA.xml
generated
2
.idea/runConfigurations/IDEA.xml
generated
@@ -2,7 +2,7 @@
|
||||
<configuration default="false" name="IDEA" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=450m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=450m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Didea.ProcessCanceledException=disabled" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Didea.ProcessCanceledException=disabled" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
|
||||
31
.idea/runConfigurations/KAnnotator_Jps_Plugin_Test.xml
generated
Normal file
31
.idea/runConfigurations/KAnnotator_Jps_Plugin_Test.xml
generated
Normal file
@@ -0,0 +1,31 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="KAnnotator Jps Plugin Test" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="kannotator-jps-plugin-test" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="PACKAGE_NAME" value="org.jetbrains.jet.jps.build.kannotator" />
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
3
.idea/scopes/all_except_testData.xml
generated
Normal file
3
.idea/scopes/all_except_testData.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<scope name="all except testData" pattern="!file[*]:*//testData//*&&!file[*]:testData//*" />
|
||||
</component>
|
||||
19
Kotlin.iml
19
Kotlin.iml
@@ -10,6 +10,25 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/ideaSDK/config" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ideaSDK/system" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ideaSDK/system-idea" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/.idea" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/docs/apidoc/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/docs/website/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/examples/browser-example/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/examples/js-example/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/examples/kotlin-java-example/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/kotlin-jdbc/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/kotlin-swing/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/kunit/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/.idea" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kdoc-maven-plugin/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kdoc/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-js-library/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-js-tests-junit/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-js-tests/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-maven-plugin/local-repo" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-maven-plugin/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/kotlin-stdlib-gen/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/libraries/tools/runtime/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
32
bin/kotlin
32
bin/kotlin
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
die() {
|
||||
echo "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
root=`cd $(dirname $0)/..; pwd`
|
||||
|
||||
ideaRoot=
|
||||
for d in $root/ideaSDK /Applications/Nika-*.app; do
|
||||
if [ -d "$d/lib" ]; then
|
||||
ideaRoot="$d"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
test -n "$ideaRoot" || die "Idea root not found"
|
||||
|
||||
classpath="$root/out/production/cli"
|
||||
classpath="$classpath:$root/out/production/backend:$root/out/production/frontend:$root/out/production/frontend.java:$root/out/production/jet.as.java.psi:$root/out/production/util"
|
||||
classpath="$classpath:$root/out/production/stdlib:$root/out/production/runtime"
|
||||
classpath="$classpath:$root/lib/*:$ideaRoot/lib/*:$ideaRoot/lib/rt/*"
|
||||
classpath="$classpath:$root/dependencies/jline-2.6.jar"
|
||||
|
||||
exec java $JAVA_OPTS \
|
||||
-ea \
|
||||
-classpath "$classpath" \
|
||||
org.jetbrains.jet.cli.jvm.K2JVMCompiler \
|
||||
"$@"
|
||||
|
||||
# vim: set ts=4 sw=4 et:
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
DEPLOY_SETTINGS=~/.kotlin-deploy-settings.xml
|
||||
|
||||
BUILD=$1
|
||||
[ -z "$BUILD" ] && {
|
||||
echo "Usage: ./publish-maven-artifacts BUILD"
|
||||
echo " where BUILD is like 0.1.XXXX"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ ! -f "$DEPLOY_SETTINGS" ] && {
|
||||
echo "Maven deploy settings are not found at $DEPLOY_SETTINGS"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ ! -f "update_dependencies.xml" -o ! -f "Kotlin.iml" ] && {
|
||||
echo "Run this script from Kotlin checkout root"
|
||||
exit 1
|
||||
}
|
||||
|
||||
for cmd in java javac ant mvn git; do
|
||||
command -v $cmd >/dev/null 2>&1 || {
|
||||
echo "$cmd must available in \$PATH"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
(javac -version 2>&1 | fgrep -q 1.6.) || {
|
||||
echo "javac must report report 1.6.X version"
|
||||
exit 1
|
||||
}
|
||||
|
||||
uncommitted=`git status --porcelain -uno`
|
||||
[ -n "$uncommitted" ] && {
|
||||
echo "Uncommited changes detected, commit them and run this script again"
|
||||
echo "$uncommitted"
|
||||
exit 1
|
||||
}
|
||||
|
||||
LOG=/tmp/kotlin-build-`date +%Y%m%d-%H%M%S`.log
|
||||
echo "*** Writing build log to $LOG"
|
||||
|
||||
(
|
||||
export MAVEN_OPTS="-Xms512m -Xmx1024M -XX:PermSize=256m -XX:MaxPermSize=512m"
|
||||
export ANT_OPTS="-Xms512m -Xmx1024M -XX:PermSize=256m -XX:MaxPermSize=512m"
|
||||
|
||||
set -x -e
|
||||
|
||||
rm -rfv ~/.m2/repository/org/jetbrains/kotlin
|
||||
|
||||
rm -rf /tmp/kotlin-dependencies
|
||||
git clean -f -d -x
|
||||
git reset --hard
|
||||
|
||||
ant -f update_dependencies.xml
|
||||
ant -f build.xml -Dbuild.number=$BUILD dist
|
||||
cd libraries
|
||||
mvn versions:set -DnewVersion=$BUILD
|
||||
mvn package -PnoTest -DskipTests
|
||||
find . -name target -type d -prune -print -exec rm -rf {} \;
|
||||
mvn -s "$DEPLOY_SETTINGS" -PnoTest -DskipTests deploy
|
||||
echo "*** Successfully uploaded version $BUILD to maven repository"
|
||||
) 2>&1 | tee "$LOG"
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
exec java -classpath 'dist/classes/tests:compiler/frontend/src:dist/classes/runtime:dist/classes/compiler:lib/*:ideaSDL/core/*:ideaSDK/lib/*' "$@"
|
||||
|
||||
# vim: set ts=4 sw=4 et ft=sh:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -25,6 +25,8 @@ import org.jetbrains.jet.cli.common.messages.MessageCollectorPlainTextToStream;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.*;
|
||||
import org.jetbrains.jet.config.CommonConfigurationKeys;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.utils.KotlinPaths;
|
||||
import org.jetbrains.jet.utils.KotlinPathsFromHomeDir;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -62,14 +64,15 @@ public class BytecodeCompiler {
|
||||
}
|
||||
|
||||
private CompilerConfiguration createConfiguration(String stdlib, String[] classpath, String[] sourceRoots) {
|
||||
KotlinPaths paths = getKotlinPathsForAntTask();
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.add(CLASSPATH_KEY, PathUtil.findRtJar());
|
||||
if ((stdlib != null) && (stdlib.trim().length() > 0)) {
|
||||
configuration.add(CLASSPATH_KEY, new File(stdlib));
|
||||
}
|
||||
else {
|
||||
File path = PathUtil.getDefaultRuntimePath();
|
||||
if (path != null) {
|
||||
File path = paths.getRuntimePath();
|
||||
if (path.exists()) {
|
||||
configuration.add(CLASSPATH_KEY, path);
|
||||
}
|
||||
}
|
||||
@@ -78,8 +81,8 @@ public class BytecodeCompiler {
|
||||
configuration.add(CLASSPATH_KEY, new File(path));
|
||||
}
|
||||
}
|
||||
File jdkAnnotationsPath = PathUtil.getJdkAnnotationsPath();
|
||||
if (jdkAnnotationsPath != null) {
|
||||
File jdkAnnotationsPath = paths.getJdkAnnotationsPath();
|
||||
if (jdkAnnotationsPath.exists()) {
|
||||
configuration.add(ANNOTATIONS_PATH_KEY, jdkAnnotationsPath);
|
||||
}
|
||||
|
||||
@@ -91,7 +94,6 @@ public class BytecodeCompiler {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves compilation error message.
|
||||
*
|
||||
@@ -172,7 +174,7 @@ public class BytecodeCompiler {
|
||||
@Nullable String stdlib,
|
||||
@Nullable String[] classpath) {
|
||||
try {
|
||||
List<Module> modules = CompileEnvironmentUtil.loadModuleScript(module, MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
List<Module> modules = CompileEnvironmentUtil.loadModuleScript(getKotlinPathsForAntTask(), module, MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
List<String> sourcesRoots = new ArrayList<String>();
|
||||
for (Module m : modules) {
|
||||
sourcesRoots.addAll(m.getSourceFiles());
|
||||
@@ -196,4 +198,9 @@ public class BytecodeCompiler {
|
||||
public void setCompilerPlugins(List<CompilerPlugin> compilerPlugins) {
|
||||
this.compilerPlugins = compilerPlugins;
|
||||
}
|
||||
|
||||
private static KotlinPaths getKotlinPathsForAntTask() {
|
||||
return new KotlinPathsFromHomeDir(PathUtil.getJarPathForClass(BytecodeCompiler.class).getParentFile().getParentFile());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
|
||||
356
build.xml
356
build.xml
@@ -9,18 +9,12 @@
|
||||
<property name="output" value="${basedir}/${output.relative}"/>
|
||||
<property name="kotlin-home" value="${output}/kotlinc"/>
|
||||
<property name="build.number" value="snapshot"/>
|
||||
<property name="output.name" value="kotlin-${build.number}"/>
|
||||
<property name="output.name" value="kotlin-compiler-${build.number}"/>
|
||||
<property name="idea.sdk" value="${basedir}/ideaSDK"/>
|
||||
|
||||
<path id="classpath">
|
||||
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
|
||||
|
||||
<!--
|
||||
Work around this problem: https://gist.github.com/1c4a7d51b61ec81d581b
|
||||
Somebody please fix it properly or delete this comment if this is OK
|
||||
-->
|
||||
<pathelement path="${idea.sdk}/lib/resources_en.jar"/>
|
||||
|
||||
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
|
||||
<fileset dir="${basedir}/dependencies" includes="jline.jar"/>
|
||||
<fileset dir="${basedir}/dependencies" includes="jansi.jar"/>
|
||||
@@ -35,7 +29,7 @@
|
||||
<include name="compiler/cli/src"/>
|
||||
<include name="compiler/cli/cli-common/src"/>
|
||||
<include name="compiler/util/src"/>
|
||||
<include name="j2k/src"/>
|
||||
<!--<include name="j2k/src"/>-->
|
||||
<include name="compiler/jet.as.java.psi/src"/>
|
||||
|
||||
<include name="runtime/src"/>
|
||||
@@ -64,13 +58,14 @@
|
||||
<target name="init" depends="clean">
|
||||
<mkdir dir="${kotlin-home}"/>
|
||||
<mkdir dir="${kotlin-home}/lib"/>
|
||||
<mkdir dir="${kotlin-home}/lib/alt"/>
|
||||
<mkdir dir="${kotlin-home}/lib/tools"/>
|
||||
</target>
|
||||
|
||||
<target name="prepareDist">
|
||||
<copy todir="${kotlin-home}/bin">
|
||||
<fileset dir="${basedir}/compiler/cli/bin"/>
|
||||
</copy>
|
||||
<fixcrlf srcdir="${kotlin-home}/bin" excludes="**/*.bat" eol="unix"/>
|
||||
|
||||
<copy todir="${kotlin-home}/license">
|
||||
<fileset dir="${basedir}/license"/>
|
||||
@@ -81,51 +76,59 @@
|
||||
<chmod dir="${kotlin-home}/bin" includes="*" perm="755"/>
|
||||
</target>
|
||||
|
||||
<target name="injectorsGenerator">
|
||||
<cleandir dir="${output}/classes/injectorsGenerator"/>
|
||||
<javac destdir="${output}/classes/injectorsGenerator" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
||||
<target name="compileGenerators">
|
||||
<cleandir dir="${output}/classes/generators"/>
|
||||
<javac destdir="${output}/classes/generators" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
||||
<src path="injector-generator/src"/>
|
||||
<src path="generators/org/jetbrains/jet/generators/injectors"/>
|
||||
<src path="generators/org/jetbrains/jet/generators/jvm"/>
|
||||
<src refid="compilerSources.path"/>
|
||||
<classpath refid="classpath"/>
|
||||
</javac>
|
||||
<copy todir="${output}/classes/generators">
|
||||
<fileset dir="compiler/frontend/src" includes="**/*.jet"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="generateInjectors" depends="injectorsGenerator">
|
||||
<target name="invokeGenerators" depends="compileGenerators">
|
||||
<java classname="org.jetbrains.jet.generators.injectors.GenerateInjectors" failonerror="true">
|
||||
<classpath refid="classpath"/>
|
||||
<classpath path="${output}/classes/injectorsGenerator"/>
|
||||
<classpath path="${output}/classes/generators"/>
|
||||
</java>
|
||||
<java classname="org.jetbrains.jet.generators.jvm.GenerateJavaToKotlinMethodMap" failonerror="true">
|
||||
<classpath refid="classpath"/>
|
||||
<classpath path="${output}/classes/generators"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="compilerSources">
|
||||
<jar jarfile="${output}/kotlin-compiler-sources.jar">
|
||||
<!-- TODO How to convert it from pathset or dirset ? -->
|
||||
<fileset dir="compiler/frontend/src"/>
|
||||
<fileset dir="compiler/frontend.java/src"/>
|
||||
<fileset dir="compiler/backend/src"/>
|
||||
<fileset dir="compiler/cli/src"/>
|
||||
<fileset dir="j2k/src"/>
|
||||
<fileset dir="compiler/util/src"/>
|
||||
<fileset dir="compiler/jet.as.java.psi/src"/>
|
||||
<fileset dir="runtime/src"/>
|
||||
<fileset dir="js/js.translator/src"/>
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="JetBrains"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="JetBrains"/>
|
||||
<attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
<if>
|
||||
<istrue value="${generate.javadoc}"/>
|
||||
|
||||
<then>
|
||||
<jar jarfile="${output}/kotlin-compiler-sources.jar">
|
||||
<!-- TODO How to convert it from pathset or dirset ? -->
|
||||
<fileset dir="compiler/frontend/src"/>
|
||||
<fileset dir="compiler/frontend.java/src"/>
|
||||
<fileset dir="compiler/backend/src"/>
|
||||
<fileset dir="compiler/cli/src"/>
|
||||
<fileset dir="j2k/src"/>
|
||||
<fileset dir="compiler/util/src"/>
|
||||
<fileset dir="compiler/jet.as.java.psi/src"/>
|
||||
<fileset dir="runtime/src"/>
|
||||
<fileset dir="js/js.translator/src"/>
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="JetBrains"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="JetBrains"/>
|
||||
<attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
<delete dir="${output}/kotlin-compiler-javadoc" failonerror="false" />
|
||||
<delete dir="${output}/kotlin-compiler-javadoc" failonerror="false"/>
|
||||
<javadoc destdir="${output}/kotlin-compiler-javadoc"
|
||||
sourcepathref="compilerSources.path"
|
||||
classpathref="classpath"
|
||||
@@ -144,62 +147,73 @@
|
||||
</manifest>
|
||||
</jar>
|
||||
</then>
|
||||
|
||||
<else>
|
||||
<jar jarfile="${output}/kotlin-compiler-javadoc.jar">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="JetBrains"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="JetBrains"/>
|
||||
<attribute name="Implementation-Title" value="Kotlin Compiler Javadoc"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="jslib">
|
||||
<jar jarfile="${kotlin-home}/lib/kotlin-jslib.jar">
|
||||
<fileset dir="${basedir}/js/js.libraries/src">
|
||||
<include name="core/**"/>
|
||||
<include name="jquery/**"/>
|
||||
<include name="dom/**"/>
|
||||
<include name="html5/**"/>
|
||||
<include name="stdlib/TuplesCode.kt"/>
|
||||
</fileset>
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
</jar>
|
||||
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}\js\js.tests\testLib\closure-compiler.jar"/>
|
||||
</classpath>
|
||||
<arg value="--formatting"/>
|
||||
<arg value="PRETTY_PRINT"/>
|
||||
<arg value="--language_in"/>
|
||||
<arg value="ECMASCRIPT5_STRICT"/>
|
||||
<arg value="--compilation_level"/>
|
||||
<arg value="SIMPLE_OPTIMIZATIONS"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma5.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
|
||||
<arg value="--js_output_file"/>
|
||||
<arg value="${kotlin-home}/lib/kotlinEcma5.js"/>
|
||||
</java>
|
||||
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/js/js.tests/testLib/closure-compiler.jar"/>
|
||||
</classpath>
|
||||
<arg value="--formatting"/>
|
||||
<arg value="PRETTY_PRINT"/>
|
||||
<arg value="--language_in"/>
|
||||
<arg value="ECMASCRIPT3"/>
|
||||
<arg value="--compilation_level"/>
|
||||
<arg value="SIMPLE_OPTIMIZATIONS"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma3.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
|
||||
<arg value="--js_output_file"/>
|
||||
<arg value="${kotlin-home}/lib/kotlinEcma3.js"/>
|
||||
</java>
|
||||
</target>
|
||||
<target name="jslib">
|
||||
<jar jarfile="${kotlin-home}/lib/kotlin-jslib.jar">
|
||||
<fileset dir="${basedir}/js/js.libraries/src">
|
||||
<include name="core/**"/>
|
||||
<include name="jquery/**"/>
|
||||
<include name="dom/**"/>
|
||||
<include name="html5/**"/>
|
||||
<include name="stdlib/TuplesCode.kt"/>
|
||||
</fileset>
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
</jar>
|
||||
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}\js\js.tests\testLib\closure-compiler.jar"/>
|
||||
</classpath>
|
||||
<arg value="--formatting"/>
|
||||
<arg value="PRETTY_PRINT"/>
|
||||
<arg value="--language_in"/>
|
||||
<arg value="ECMASCRIPT5_STRICT"/>
|
||||
<arg value="--compilation_level"/>
|
||||
<arg value="SIMPLE_OPTIMIZATIONS"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma5.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
|
||||
<arg value="--js_output_file"/>
|
||||
<arg value="${kotlin-home}/lib/kotlinEcma5.js"/>
|
||||
</java>
|
||||
<java classname="com.google.javascript.jscomp.CommandLineRunner" failonerror="true">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/js/js.tests/testLib/closure-compiler.jar"/>
|
||||
</classpath>
|
||||
<arg value="--formatting"/>
|
||||
<arg value="PRETTY_PRINT"/>
|
||||
<arg value="--language_in"/>
|
||||
<arg value="ECMASCRIPT3"/>
|
||||
<arg value="--compilation_level"/>
|
||||
<arg value="SIMPLE_OPTIMIZATIONS"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib_ecma3.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/kotlin_lib.js"/>
|
||||
<arg value="--js"/>
|
||||
<arg value="${basedir}/js/js.translator/testFiles/maps.js"/>
|
||||
<arg value="--js_output_file"/>
|
||||
<arg value="${kotlin-home}/lib/kotlinEcma3.js"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="compiler">
|
||||
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${basedir}/dependencies/jarjar.jar"/>
|
||||
<taskdef resource="proguard/ant/task.properties" classpath="${basedir}/dependencies/proguard.jar"/>
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${basedir}/dependencies/ant-contrib.jar"/>
|
||||
|
||||
@@ -209,54 +223,18 @@
|
||||
<classpath refid="classpath"/>
|
||||
</javac>
|
||||
|
||||
<!-- JarJar Kotlin compiler & dependencies -->
|
||||
<jarjar jarfile="${output}/kotlin-compiler-jarjar.jar">
|
||||
<jar jarfile="${output}/kotlin-compiler-before-shrink.jar">
|
||||
<fileset dir="${output}/classes/compiler"/>
|
||||
<fileset dir="${basedir}/compiler/frontend/src" includes="jet/**"/>
|
||||
|
||||
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar" excludes="util.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/ideaSDK/lib" includes="jna-utils.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/ideaSDK/lib" includes="oromatcher.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/js/js.translator/lib" includes="*.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/dependencies" includes="jline.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/dependencies" includes="jansi.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/dependencies" includes="jetbrains-asm-util-4.0.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/dependencies" includes="jetbrains-asm-analysis-4.0.jar"/>
|
||||
|
||||
<zap pattern="com.thoughtworks.xstream.converters.extended.ISO8601*"/>
|
||||
<zap pattern="com.thoughtworks.xstream.converters.reflection.CGLIBEnhancedConverter*"/>
|
||||
<zap pattern="com.thoughtworks.xstream.io.xml.Dom4J*"/>
|
||||
<zap pattern="com.thoughtworks.xstream.io.xml.Xom*"/>
|
||||
<zap pattern="com.thoughtworks.xstream.mapper.CGLIBMapper*"/>
|
||||
|
||||
<zap pattern="org.apache.log4j.jmx.Agent"/>
|
||||
<zap pattern="org.apache.log4j.net.JMS*"/>
|
||||
<zap pattern="org.apache.log4j.net.SMTP*"/>
|
||||
<zap pattern="org.apache.log4j.or.jms.MessageRenderer"/>
|
||||
|
||||
<zap pattern="org.jdom.xpath.Jaxen*"/>
|
||||
|
||||
<zap pattern="org.mozilla.javascript.xml.impl.xmlbeans.**"/>
|
||||
|
||||
<rule pattern="com.intellij.**" result="org.jetbrains.jet.internal.com.intellij.@1"/>
|
||||
<rule pattern="com.sun.jna.**" result="org.jetbrains.jet.internal.com.sun.jna.@1"/>
|
||||
<rule pattern="org.apache.log4j.**" result="org.jetbrains.jet.internal.org.apache.log4j.@1"/>
|
||||
<rule pattern="org.jdom.**" result="org.jetbrains.jet.internal.org.jdom.@1"/>
|
||||
<rule pattern="JDOMAbout**" result="org.jetbrains.jet.internal.org.jdom.JDOMAbout@1"/>
|
||||
<rule pattern="org.intellij.lang.annotations.**" result="org.jetbrains.jet.internal.org.intellij.lang.annotations.@1"/>
|
||||
<rule pattern="com.google.**" result="org.jetbrains.jet.internal.com.google.@1"/>
|
||||
<rule pattern="org.objectweb.asm.**" result="org.jetbrains.jet.internal.org.objectweb.asm.@1"/>
|
||||
<rule pattern="com.sampullara.cli.**" result="org.jetbrains.jet.internal.com.sampullara.cli.@1"/>
|
||||
<rule pattern="org.picocontainer.**" result="org.jetbrains.jet.internal.org.picocontainer.@1"/>
|
||||
<rule pattern="gnu.trove.**" result="org.jetbrains.jet.internal.gnu.trove.@1"/>
|
||||
<rule pattern="javax.inject.**" result="org.jetbrains.jet.internal.javax.inject.@1"/>
|
||||
<rule pattern="com.thoughtworks.xstream.**" result="org.jetbrains.jet.internal.com.thoughtworks.xstream.@1"/>
|
||||
<rule pattern="org.json.**" result="org.jetbrains.jet.internal.org.json.@1"/>
|
||||
<rule pattern="org.mozilla.**" result="org.jetbrains.jet.internal.org.mozilla.@1"/>
|
||||
<rule pattern="org.xmlpull.**" result="org.jetbrains.jet.internal.org.xmlpull.@1"/>
|
||||
<rule pattern="org.kohsuke.args4j.**" result="org.jetbrains.jet.internal.org.kohsuke.args4j.@1"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="JetBrains"/>
|
||||
|
||||
@@ -266,7 +244,7 @@
|
||||
|
||||
<attribute name="Main-Class" value="org.jetbrains.jet.cli.jvm.K2JVMCompiler"/>
|
||||
</manifest>
|
||||
</jarjar>
|
||||
</jar>
|
||||
|
||||
<delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/>
|
||||
|
||||
@@ -274,39 +252,41 @@
|
||||
<isfalse value="${shrink}"/>
|
||||
|
||||
<then>
|
||||
<copy file="${output}/kotlin-compiler-jarjar.jar"
|
||||
<copy file="${output}/kotlin-compiler-before-shrink.jar"
|
||||
tofile="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
||||
</then>
|
||||
|
||||
<else>
|
||||
<cleandir dir="${output}/kotlin-compiler.exploded"/>
|
||||
<unzip src="${output}/kotlin-compiler-jarjar.jar" dest="${output}/kotlin-compiler.exploded"/>
|
||||
|
||||
<!-- Clean JarJar result -->
|
||||
<jar jarfile="${output}/kotlin-compiler-before-proguard.jar"
|
||||
manifest="${output}/kotlin-compiler.exploded/META-INF/MANIFEST.MF">
|
||||
|
||||
<fileset dir="${output}/kotlin-compiler.exploded">
|
||||
<include name="**/*.class"/>
|
||||
<include name="**/*.jet"/>
|
||||
<include name="**/*.kt"/>
|
||||
<include name="META-INF/services/**"/>
|
||||
<include name="messages/**"/>
|
||||
</fileset>
|
||||
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
||||
</jar>
|
||||
<delete dir="${output}/kotlin-compiler.exploded"/>
|
||||
|
||||
<available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar"/>
|
||||
<available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar"/>
|
||||
|
||||
<proguard><![CDATA[
|
||||
-injars '${output}/kotlin-compiler-before-proguard.jar'
|
||||
-injars '${output}/kotlin-compiler-before-shrink.jar'(
|
||||
!com/thoughtworks/xstream/converters/extended/ISO8601**,
|
||||
!com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter**,
|
||||
!com/thoughtworks/xstream/io/xml/Dom4J**,
|
||||
!com/thoughtworks/xstream/io/xml/Xom**,
|
||||
!com/thoughtworks/xstream/io/xml/Wstx**,
|
||||
!com/thoughtworks/xstream/io/xml/KXml2**,
|
||||
!com/thoughtworks/xstream/io/xml/BEAStax**,
|
||||
!com/thoughtworks/xstream/io/json/Jettison**,
|
||||
!com/thoughtworks/xstream/mapper/CGLIBMapper**,
|
||||
!org/apache/log4j/jmx/Agent*,
|
||||
!org/apache/log4j/net/JMS*,
|
||||
!org/apache/log4j/net/SMTP*,
|
||||
!org/apache/log4j/or/jms/MessageRenderer*,
|
||||
!org/jdom/xpath/Jaxen*,
|
||||
!org/mozilla/javascript/xml/impl/xmlbeans/**,
|
||||
!META-INF/maven**,
|
||||
**.class,**.properties,**.jet,**.kt,
|
||||
META-INF/services/**,META-INF/native/**,META-INF/MANIFEST.MF,
|
||||
messages/**)
|
||||
|
||||
-outjars '${kotlin-home}/lib/kotlin-compiler.jar'
|
||||
|
||||
-dontwarn org.jetbrains.jet.internal.com.intellij.util.**
|
||||
-dontwarn org.jetbrains.jet.internal.com.intellij.codeInsight.**
|
||||
-dontwarn org.jetbrains.jet.internal.com.thoughtworks.xstream.**
|
||||
-dontwarn com.intellij.util.ui.IsRetina*
|
||||
-dontwarn com.intellij.util.RetinaImage*
|
||||
-dontwarn org.fusesource.**
|
||||
|
||||
-libraryjars '${rtjar}'
|
||||
|
||||
@@ -314,9 +294,8 @@
|
||||
-dontoptimize
|
||||
-dontobfuscate
|
||||
|
||||
-keepclasseswithmembers public class * {
|
||||
public static void main(java.lang.String[]);
|
||||
}
|
||||
-keep class org.fusesource.** { *; }
|
||||
-keep class org.jdom.input.JAXPParserFactory { *; }
|
||||
|
||||
-keep class org.jetbrains.annotations.** {
|
||||
public protected *;
|
||||
@@ -334,27 +313,12 @@
|
||||
public protected *;
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * { void start(); }
|
||||
-keep class com.intellij.psi.** {
|
||||
public protected *;
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * { void stop(); }
|
||||
-keepclasseswithmembers class * { void dispose(); }
|
||||
|
||||
-keepclasseswithmembers class * { ** getFileSystem(); }
|
||||
-keepclasseswithmembers class * { ** isVarArgs(); }
|
||||
-keepclasseswithmembers class * { ** getApplication(); }
|
||||
-keepclasseswithmembers class * { ** finalizeReferent(); }
|
||||
-keepclasseswithmembers class * { ** newBuilder(); }
|
||||
-keepclasseswithmembers class * { ** startFinalizer(java.lang.Class,java.lang.Object); }
|
||||
-keepclasseswithmembers class * { ** executeOnPooledThread(java.lang.Runnable); }
|
||||
-keepclasseswithmembers class * { ** getUserData(java.lang.String); }
|
||||
-keepclasseswithmembers class * { int getBooleanAttributes(java.io.File); }
|
||||
|
||||
-keepclasseswithmembers class * { ** project(); }
|
||||
|
||||
-keepclasseswithmembers class * { ** TYPE; }
|
||||
-keepclasseswithmembers class * { ** ourInstance; }
|
||||
|
||||
-keepclasseswithmembers class * { <init>(kotlinc.internal.com.intellij.lang.ASTNode); }
|
||||
# for kdoc
|
||||
-keep class com.intellij.openapi.util.TextRange { *; }
|
||||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
@@ -364,6 +328,9 @@
|
||||
-keepclassmembers class * {
|
||||
** toString();
|
||||
** hashCode();
|
||||
void start();
|
||||
void stop();
|
||||
void dispose();
|
||||
}
|
||||
]]></proguard>
|
||||
</else>
|
||||
@@ -458,30 +425,33 @@
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="lang">
|
||||
<cleandir dir="${output}/classes/lang"/>
|
||||
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true">
|
||||
<classpath>
|
||||
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
||||
</classpath>
|
||||
<arg value="-src"/>
|
||||
<arg value="${basedir}/compiler/frontend/src"/>
|
||||
<arg value="-output"/>
|
||||
<arg value="${output}/classes/lang"/>
|
||||
<arg value="-noStdlib"/>
|
||||
<arg value="-builtins"/>
|
||||
</java>
|
||||
<target name="j2kConverter">
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${basedir}/dependencies/ant-contrib.jar"/>
|
||||
|
||||
<!-- Not used yet -->
|
||||
<!--
|
||||
<jar destfile="${kotlin-home}/lib/lang.jar">
|
||||
<fileset dir="${output}/classes/lang"/>
|
||||
<cleandir dir="${output}/classes/j2k"/>
|
||||
|
||||
<javac destdir="${output}/classes/j2k" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
||||
<src path="${basedir}/j2k/src"/>
|
||||
<classpath path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
||||
</javac>
|
||||
|
||||
<jar jarfile="${kotlin-home}/lib/tools/j2k.jar">
|
||||
<fileset dir="${output}/classes/j2k" includes="org/jetbrains/jet/j2k/**"/>
|
||||
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="JetBrains"/>
|
||||
|
||||
<attribute name="Implementation-Vendor" value="JetBrains"/>
|
||||
<attribute name="Implementation-Title" value="Java to Kotlin Converter"/>
|
||||
<attribute name="Implementation-Version" value="${build.number}"/>
|
||||
|
||||
<attribute name="Main-Class" value="org.jetbrains.jet.j2k.JavaToKotlinTranslator"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
-->
|
||||
</target>
|
||||
|
||||
<target name="dist"
|
||||
depends="init,prepareDist,injectorsGenerator,generateInjectors,compiler,compilerSources,antTools,jdkAnnotations,runtime,lang,jslib"/>
|
||||
depends="init,prepareDist,compileGenerators,invokeGenerators,compiler,compilerSources,antTools,jdkAnnotations,runtime,jslib,j2kConverter"/>
|
||||
|
||||
<target name="zip" depends="dist">
|
||||
<zip destfile="${output}/${output.name}.zip">
|
||||
@@ -491,4 +461,4 @@
|
||||
</target>
|
||||
</project>
|
||||
|
||||
<!-- vim: set ts=4 sw=4 et nowrap: -->
|
||||
<!-- vim: set ts=4 sw=4 et nowrap: -->
|
||||
|
||||
43
compiler/android-tests/android-module/android-module.iml
Normal file
43
compiler/android-tests/android-module/android-module.iml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/assets" />
|
||||
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/libs" />
|
||||
<option name="USE_CUSTOM_APK_RESOURCE_FOLDER" value="false" />
|
||||
<option name="CUSTOM_APK_RESOURCE_FOLDER" value="" />
|
||||
<option name="USE_CUSTOM_COMPILER_MANIFEST" value="false" />
|
||||
<option name="CUSTOM_COMPILER_MANIFEST" value="" />
|
||||
<option name="APK_PATH" value="" />
|
||||
<option name="LIBRARY_PROJECT" value="false" />
|
||||
<option name="RUN_PROCESS_RESOURCES_MAVEN_TASK" value="true" />
|
||||
<option name="GENERATE_UNSIGNED_APK" value="false" />
|
||||
<option name="CUSTOM_DEBUG_KEYSTORE_PATH" value="" />
|
||||
<option name="PACK_TEST_CODE" value="false" />
|
||||
<option name="RUN_PROGUARD" value="false" />
|
||||
<option name="PROGUARD_CFG_PATH" value="/proguard-project.txt" />
|
||||
<resOverlayFolders>
|
||||
<path>/res-overlay</path>
|
||||
</resOverlayFolders>
|
||||
<includeSystemProguardFile>true</includeSystemProguardFile>
|
||||
<includeAssetsFromLibraries>false</includeAssetsFromLibraries>
|
||||
<additionalNativeLibs />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android 2.3.3 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
18
compiler/android-tests/android-module/android-module.ipr
Normal file
18
compiler/android-tests/android-module/android-module.ipr
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<excludeFromCompile>
|
||||
<directory url="file://$PROJECT_DIR$/gen" includeSubdirectories="true" />
|
||||
</excludeFromCompile>
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/android-module.iml" filepath="$PROJECT_DIR$/android_module.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Android_SDK" project-jdk-type="Android SDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
target=android-16
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">android1</string>
|
||||
</resources>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -21,16 +21,14 @@ import junit.framework.TestCase;
|
||||
import java.lang.String;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class AbstractCodegenTestCaseOnAndroid extends TestCase {
|
||||
|
||||
protected void invokeBoxMethod(String filePath, String expectedResult) throws Exception {
|
||||
try {
|
||||
Class clazz;
|
||||
clazz = Class.forName(filePath.replaceAll("\\\\|-|\\.|/", "_") + ".namespace");
|
||||
String packageName = filePath.replaceAll("\\\\|-|\\.|/", "_");
|
||||
clazz = Class.forName(packageName + "." + getPackageClassName(packageName));
|
||||
Method method;
|
||||
method = clazz.getMethod("box");
|
||||
assertEquals(expectedResult, method.invoke(null));
|
||||
@@ -39,4 +37,8 @@ public class AbstractCodegenTestCaseOnAndroid extends TestCase {
|
||||
throw new RuntimeException("File: " + filePath, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getPackageClassName(String packageName) {
|
||||
return Character.toUpperCase(packageName.charAt(0)) + packageName.substring(1, packageName.length()) + "Package";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package test;
|
||||
package org.jetbrains.jet.compiler.android;
|
||||
|
||||
import awt.Frame;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class JFrame extends Frame {
|
||||
public JFrame() {
|
||||
public class MyActivity extends Activity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
System.out.println(R.string.app_name);
|
||||
}
|
||||
|
||||
protected String accessibleContext = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
<orderEntry type="module" module-name="frontend.java" />
|
||||
<orderEntry type="module" module-name="frontend" />
|
||||
<orderEntry type="module" module-name="backend" />
|
||||
<orderEntry type="library" name="jps-test" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import junit.framework.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.compiler.ant.AntRunner;
|
||||
import org.jetbrains.jet.compiler.download.SDKDownloader;
|
||||
@@ -32,9 +33,6 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class CodegenTestsOnAndroidRunner {
|
||||
private static final Pattern ERROR_IN_TEST_OUTPUT_PATTERN =
|
||||
@@ -56,20 +54,19 @@ public class CodegenTestsOnAndroidRunner {
|
||||
TestSuite suite = new TestSuite("MySuite");
|
||||
|
||||
String resultOutput = runTests();
|
||||
if (resultOutput == null) return suite;
|
||||
|
||||
// Test name -> stackTrace
|
||||
final Map<String, String> resultMap = parseOutputForFailedTests(resultOutput);
|
||||
final Statistics statistics;
|
||||
|
||||
// If map is empty => there are no failed tests
|
||||
if (resultMap.isEmpty()) {
|
||||
// Clear tmp folder where we run android tests
|
||||
FileUtil.delete(new File(pathManager.getTmpFolder()));
|
||||
|
||||
statistics = parseOutputForTestsNumberIfTestsPassed(resultOutput);
|
||||
}
|
||||
else {
|
||||
statistics = parseOutputForTestsNumberIfThereIsFailedTests(resultOutput);
|
||||
|
||||
|
||||
for (final Map.Entry<String, String> entry : resultMap.entrySet()) {
|
||||
|
||||
suite.addTest(new TestCase("run") {
|
||||
@@ -85,7 +82,7 @@ public class CodegenTestsOnAndroidRunner {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Assert.assertNotNull("Cannot parse number of failed tests from final line", statistics);
|
||||
Assert.assertEquals("Number of stackTraces != failed tests on the final line", resultMap.size(),
|
||||
statistics.failed + statistics.errors);
|
||||
@@ -125,7 +122,7 @@ public class CodegenTestsOnAndroidRunner {
|
||||
[exec] ...............
|
||||
[exec] Error in testKt529:
|
||||
*/
|
||||
private Map<String, String> parseOutputForFailedTests(String output) {
|
||||
private Map<String, String> parseOutputForFailedTests(@NotNull String output) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
String failedTestNamePrefix = " Error in ";
|
||||
@@ -171,6 +168,7 @@ public class CodegenTestsOnAndroidRunner {
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public String runTests() {
|
||||
ApplicationManager.setApplication(null, new Disposable() {
|
||||
@Override
|
||||
@@ -193,23 +191,31 @@ public class CodegenTestsOnAndroidRunner {
|
||||
|
||||
antRunner.packLibraries();
|
||||
|
||||
emulator.createEmulator();
|
||||
emulator.startEmulator();
|
||||
try {
|
||||
emulator.waitEmulatorStart();
|
||||
antRunner.cleanOutput();
|
||||
antRunner.compileSources();
|
||||
antRunner.installApplicationOnEmulator();
|
||||
return antRunner.runTestsOnEmulator();
|
||||
}
|
||||
finally {
|
||||
emulator.createEmulator();
|
||||
emulator.startEmulator();
|
||||
|
||||
try {
|
||||
emulator.waitEmulatorStart();
|
||||
antRunner.cleanOutput();
|
||||
antRunner.compileSources();
|
||||
antRunner.installApplicationOnEmulator();
|
||||
return antRunner.runTestsOnEmulator();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
emulator.stopEmulator();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
System.err.println("Exception during stopping emulator:");
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
emulator.finishEmulatorProcesses();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -25,9 +25,6 @@ import org.jetbrains.jet.compiler.run.result.RunResult;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class OutputUtils {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -18,9 +18,6 @@ package org.jetbrains.jet.compiler;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class PathManager {
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.compiler;
|
||||
|
||||
import java.lang.InterruptedException;
|
||||
import java.lang.RuntimeException;
|
||||
import java.lang.Thread;
|
||||
|
||||
public class ThreadUtils {
|
||||
public static void wait(Thread thread, int seconds) {
|
||||
try {
|
||||
thread.wait(seconds * 1000);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sleep(int seconds) {
|
||||
try {
|
||||
Thread.sleep(seconds * 1000);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -20,15 +20,13 @@ import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import org.jetbrains.jet.compiler.OutputUtils;
|
||||
import org.jetbrains.jet.compiler.PathManager;
|
||||
import org.jetbrains.jet.compiler.ThreadUtils;
|
||||
import org.jetbrains.jet.compiler.run.RunUtils;
|
||||
import org.jetbrains.jet.compiler.run.result.RunResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class AntRunner {
|
||||
private final List<String> listOfAntCommands;
|
||||
@@ -71,7 +69,9 @@ public class AntRunner {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
System.out.println(resultOutput);
|
||||
if (result.getStatus()) {
|
||||
System.out.println(resultOutput);
|
||||
}
|
||||
}
|
||||
OutputUtils.checkResult(result);
|
||||
}
|
||||
@@ -86,14 +86,9 @@ public class AntRunner {
|
||||
|
||||
private static boolean isInstallSuccessful(String output) {
|
||||
if (output.contains("Is the system running?")) {
|
||||
try {
|
||||
System.out.println("Device not ready. Waiting for 20 sec.");
|
||||
Thread.sleep(20000);
|
||||
return false;
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.out.println("Device not ready. Waiting for 20 sec.");
|
||||
ThreadUtils.sleep(20);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -27,12 +27,10 @@ import java.net.URLConnection;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class SDKDownloader {
|
||||
private final String platformZipPath;
|
||||
private final String systemImages;
|
||||
private final String platformToolsZipPath;
|
||||
private final String toolsZipPath;
|
||||
private final String antZipPath;
|
||||
@@ -42,25 +40,30 @@ public class SDKDownloader {
|
||||
public SDKDownloader(PathManager pathManager) {
|
||||
this.pathManager = pathManager;
|
||||
platformZipPath = pathManager.getRootForDownload() + "/platforms.zip";
|
||||
systemImages = pathManager.getRootForDownload() + "/system-images.zip";
|
||||
platformToolsZipPath = pathManager.getRootForDownload() + "/platform-tools.zip";
|
||||
toolsZipPath = pathManager.getRootForDownload() + "/tools.zip";
|
||||
antZipPath = pathManager.getRootForDownload() + "/apache-ant-1.8.0.zip";
|
||||
}
|
||||
|
||||
public void downloadPlatform() {
|
||||
download("https://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip", platformZipPath); //Same for all platforms
|
||||
download("http://dl-ssl.google.com/android/repository/android-16_r04.zip", platformZipPath); //Same for all platforms
|
||||
}
|
||||
|
||||
private void downloadAbi() {
|
||||
download("http://dl.google.com/android/repository/sysimg_armv7a-16_r03.zip", systemImages); //Same for all platforms
|
||||
}
|
||||
|
||||
public void downloadPlatformTools() {
|
||||
String downloadURL;
|
||||
if (SystemInfo.isWindows) {
|
||||
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r11-windows.zip";
|
||||
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r16-windows.zip";
|
||||
}
|
||||
else if (SystemInfo.isMac) {
|
||||
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r11-macosx.zip";
|
||||
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r16-macosx.zip";
|
||||
}
|
||||
else if (SystemInfo.isUnix) {
|
||||
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r11-linux.zip";
|
||||
downloadURL = "http://dl-ssl.google.com/android/repository/platform-tools_r16-linux.zip";
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Your operating system doesn't supported yet.");
|
||||
@@ -71,13 +74,13 @@ public class SDKDownloader {
|
||||
public void downloadTools() {
|
||||
String downloadURL;
|
||||
if (SystemInfo.isWindows) {
|
||||
downloadURL = "http://dl.google.com/android/repository/tools_r19-windows.zip";
|
||||
downloadURL = "http://dl.google.com/android/repository/tools_r16-windows.zip";
|
||||
}
|
||||
else if (SystemInfo.isMac) {
|
||||
downloadURL = "http://dl.google.com/android/repository/tools_r19-macosx.zip";
|
||||
downloadURL = "http://dl.google.com/android/repository/tools_r16-macosx.zip";
|
||||
}
|
||||
else if (SystemInfo.isUnix) {
|
||||
downloadURL = "http://dl.google.com/android/repository/tools_r19-linux.zip";
|
||||
downloadURL = "http://dl.google.com/android/repository/tools_r16-linux.zip";
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Your operating system doesn't supported yet.");
|
||||
@@ -91,13 +94,16 @@ public class SDKDownloader {
|
||||
|
||||
public void downloadAll() {
|
||||
downloadTools();
|
||||
downloadAbi();
|
||||
downloadPlatform();
|
||||
downloadPlatformTools();
|
||||
downloadAnt();
|
||||
}
|
||||
|
||||
|
||||
public void unzipAll() {
|
||||
unzip(platformZipPath, pathManager.getPlatformFolderInAndroidSdk());
|
||||
unzip(systemImages, pathManager.getAndroidSdkRoot() + "/system-images/android-16/");
|
||||
unzip(platformToolsZipPath, pathManager.getAndroidSdkRoot());
|
||||
unzip(toolsZipPath, pathManager.getAndroidSdkRoot());
|
||||
unzip(antZipPath, pathManager.getDependenciesRoot());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -19,8 +19,10 @@ package org.jetbrains.jet.compiler.emulator;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.compiler.OutputUtils;
|
||||
import org.jetbrains.jet.compiler.PathManager;
|
||||
import org.jetbrains.jet.compiler.ThreadUtils;
|
||||
import org.jetbrains.jet.compiler.run.RunUtils;
|
||||
import org.jetbrains.jet.compiler.run.result.RunResult;
|
||||
|
||||
@@ -28,15 +30,11 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class Emulator {
|
||||
|
||||
private final static Pattern EMULATOR_PATTERN = Pattern.compile("emulator-([0-9])*");
|
||||
|
||||
|
||||
|
||||
private final PathManager pathManager;
|
||||
|
||||
public Emulator(PathManager pathManager) {
|
||||
@@ -86,34 +84,50 @@ public class Emulator {
|
||||
return commandLine;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private GeneralCommandLine getStopCommand() {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
if (SystemInfo.isWindows) {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
commandLine.setExePath("taskkill");
|
||||
commandLine.addParameter("/F");
|
||||
commandLine.addParameter("/IM");
|
||||
commandLine.addParameter("emulator-arm.exe");
|
||||
return commandLine;
|
||||
}
|
||||
else {
|
||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/adb");
|
||||
commandLine.addParameter("emu");
|
||||
commandLine.addParameter("kill");
|
||||
}
|
||||
return commandLine;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void createEmulator() {
|
||||
System.out.println("Creating emulator...");
|
||||
OutputUtils.checkResult(RunUtils.execute(getCreateCommand(), "no"));
|
||||
OutputUtils.checkResult(RunUtils.execute(new RunUtils.RunSettings(getCreateCommand(), "no", true, null, false)));
|
||||
}
|
||||
|
||||
public void startServer() {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
||||
commandLine.addParameter("start-server");
|
||||
System.out.println("Start adb server...");
|
||||
OutputUtils.checkResult(RunUtils.execute(commandLine));
|
||||
}
|
||||
|
||||
public void startEmulator() {
|
||||
startServer();
|
||||
System.out.println("Starting emulator...");
|
||||
stopRedundantEmulators(pathManager);
|
||||
OutputUtils.checkResult(RunUtils.executeOnSeparateThread(getStartCommand(), false));
|
||||
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(getStartCommand(), null, false, "START: ", true));
|
||||
printLog();
|
||||
}
|
||||
|
||||
public void printLog() {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
||||
commandLine.addParameter("logcat");
|
||||
commandLine.addParameter("-v");
|
||||
commandLine.addParameter("time");
|
||||
commandLine.addParameter("*:I");
|
||||
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(commandLine, null, false, "LOGCAT: ", true));
|
||||
}
|
||||
|
||||
public void waitEmulatorStart() {
|
||||
System.out.println("Waiting for emulator start...");
|
||||
@@ -122,46 +136,53 @@ public class Emulator {
|
||||
|
||||
public void stopEmulator() {
|
||||
System.out.println("Stopping emulator...");
|
||||
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
|
||||
System.out.println("Stopping adb...");
|
||||
OutputUtils.checkResult(RunUtils.execute(getStopCommandForAdb()));
|
||||
if (SystemInfo.isUnix) {
|
||||
finishProcess("emulator-arm");
|
||||
finishProcess("adb");
|
||||
stopDdmsProcess();
|
||||
if (SystemInfo.isWindows) {
|
||||
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
|
||||
}
|
||||
finishProcess("emulator-arm");
|
||||
}
|
||||
|
||||
//Only for Unix
|
||||
private void stopDdmsProcess() {
|
||||
GeneralCommandLine listOfEmulatorProcess = new GeneralCommandLine();
|
||||
listOfEmulatorProcess.setExePath("sh");
|
||||
listOfEmulatorProcess.addParameter("-c");
|
||||
listOfEmulatorProcess.addParameter("ps aux | grep emulator");
|
||||
RunResult runResult = RunUtils.execute(listOfEmulatorProcess);
|
||||
OutputUtils.checkResult(runResult);
|
||||
String pidFromPsCommand = OutputUtils.getPidFromPsCommand(runResult.getOutput());
|
||||
if (pidFromPsCommand != null) {
|
||||
GeneralCommandLine killCommand = new GeneralCommandLine();
|
||||
killCommand.setExePath("kill");
|
||||
killCommand.addParameter(pidFromPsCommand);
|
||||
OutputUtils.checkResult(RunUtils.execute(killCommand));
|
||||
if (SystemInfo.isUnix) {
|
||||
GeneralCommandLine listOfEmulatorProcess = new GeneralCommandLine();
|
||||
listOfEmulatorProcess.setExePath("sh");
|
||||
listOfEmulatorProcess.addParameter("-c");
|
||||
listOfEmulatorProcess.addParameter("ps aux | grep emulator");
|
||||
RunResult runResult = RunUtils.execute(listOfEmulatorProcess);
|
||||
OutputUtils.checkResult(runResult);
|
||||
String pidFromPsCommand = OutputUtils.getPidFromPsCommand(runResult.getOutput());
|
||||
if (pidFromPsCommand != null) {
|
||||
GeneralCommandLine killCommand = new GeneralCommandLine();
|
||||
killCommand.setExePath("kill");
|
||||
killCommand.addParameter(pidFromPsCommand);
|
||||
RunUtils.execute(killCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void finishEmulatorProcesses() {
|
||||
System.out.println("Stopping adb...");
|
||||
OutputUtils.checkResult(RunUtils.execute(getStopCommandForAdb()));
|
||||
finishProcess("adb");
|
||||
stopDdmsProcess();
|
||||
}
|
||||
|
||||
//Only for Unix
|
||||
private void finishProcess(String processName) {
|
||||
GeneralCommandLine pidOfProcess = new GeneralCommandLine();
|
||||
pidOfProcess.setExePath("pidof");
|
||||
pidOfProcess.addParameter(processName);
|
||||
RunResult runResult = RunUtils.execute(pidOfProcess);
|
||||
String processIdsStr = runResult.getOutput().substring(("pidof " + processName).length());
|
||||
List<String> processIds = StringUtil.getWordsIn(processIdsStr);
|
||||
for (String pid : processIds) {
|
||||
GeneralCommandLine killCommand = new GeneralCommandLine();
|
||||
killCommand.setExePath("kill");
|
||||
killCommand.addParameter(pid);
|
||||
OutputUtils.checkResult(RunUtils.execute(killCommand));
|
||||
if (SystemInfo.isUnix) {
|
||||
GeneralCommandLine pidOfProcess = new GeneralCommandLine();
|
||||
pidOfProcess.setExePath("pidof");
|
||||
pidOfProcess.addParameter(processName);
|
||||
RunResult runResult = RunUtils.execute(pidOfProcess);
|
||||
String processIdsStr = runResult.getOutput().substring(("pidof " + processName).length());
|
||||
List<String> processIds = StringUtil.getWordsIn(processIdsStr);
|
||||
for (String pid : processIds) {
|
||||
GeneralCommandLine killCommand = new GeneralCommandLine();
|
||||
killCommand.setExePath("kill");
|
||||
killCommand.addParameter(pid);
|
||||
RunUtils.execute(killCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,5 +223,4 @@ public class Emulator {
|
||||
}
|
||||
OutputUtils.checkResult(RunUtils.execute(commandLineForListOfDevices));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -20,9 +20,6 @@ import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import org.jetbrains.jet.compiler.PathManager;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class PermissionManager {
|
||||
private PermissionManager() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -23,11 +23,13 @@ import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessOutputTypes;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.compiler.OutputUtils;
|
||||
import org.jetbrains.jet.compiler.ThreadUtils;
|
||||
import org.jetbrains.jet.compiler.run.result.RunResult;
|
||||
|
||||
import java.io.Closeable;
|
||||
@@ -35,60 +37,81 @@ import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class RunUtils {
|
||||
private RunUtils() {
|
||||
}
|
||||
|
||||
public static RunResult execute(final GeneralCommandLine commandLine) {
|
||||
return run(commandLine, null);
|
||||
public static class RunSettings {
|
||||
public final GeneralCommandLine commandLine;
|
||||
public final String input;
|
||||
public final boolean waitForEnd;
|
||||
public final String outputPrefix;
|
||||
public final boolean printOutputAtAppearance;
|
||||
|
||||
public RunSettings(
|
||||
GeneralCommandLine commandLine,
|
||||
@Nullable String input,
|
||||
boolean waitForEnd,
|
||||
@Nullable String outputPrefix,
|
||||
boolean printOutputAtAppearance
|
||||
) {
|
||||
this.commandLine = commandLine;
|
||||
this.input = input;
|
||||
this.waitForEnd = waitForEnd;
|
||||
this.outputPrefix = outputPrefix;
|
||||
this.printOutputAtAppearance = printOutputAtAppearance;
|
||||
}
|
||||
|
||||
public RunSettings(GeneralCommandLine commandLine) {
|
||||
this.commandLine = commandLine;
|
||||
this.input = null;
|
||||
this.waitForEnd = true;
|
||||
this.outputPrefix = null;
|
||||
this.printOutputAtAppearance = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "commandLine=" + commandLine.getCommandLineString() + " " +
|
||||
"input=" + input + " " +
|
||||
"waitForEnd=" + waitForEnd + " " +
|
||||
"outputPrefix=" + outputPrefix + " " +
|
||||
"printOutputAtAppearance=" + printOutputAtAppearance + " ";
|
||||
}
|
||||
}
|
||||
|
||||
public static RunResult execute(final GeneralCommandLine commandLine, @Nullable String input) {
|
||||
return run(commandLine, input);
|
||||
public static RunResult execute(@NotNull GeneralCommandLine commandLine) {
|
||||
return run(new RunSettings(commandLine));
|
||||
}
|
||||
|
||||
public static RunResult executeOnSeparateThread(final GeneralCommandLine commandLine, boolean waitForEnd) {
|
||||
return executeOnSeparateThread(commandLine, waitForEnd, null);
|
||||
public static RunResult execute(@NotNull RunSettings settings) {
|
||||
assert settings.waitForEnd == true : "Use executeOnSeparateThread() instead";
|
||||
return run(settings);
|
||||
}
|
||||
|
||||
public static RunResult executeOnSeparateThread(final GeneralCommandLine commandLine,
|
||||
boolean waitForEnd,
|
||||
@Nullable final String input) {
|
||||
final Ref<RunResult> resultRef = new Ref<RunResult>();
|
||||
public static void executeOnSeparateThread(@NotNull final RunSettings settings) {
|
||||
assert settings.waitForEnd == false : "Use execute() instead";
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
resultRef.set(RunUtils.run(commandLine, input));
|
||||
RunUtils.run(settings);
|
||||
}
|
||||
});
|
||||
|
||||
t.start();
|
||||
|
||||
if (waitForEnd) {
|
||||
try {
|
||||
t.wait(300000);
|
||||
return resultRef.get();
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
new RunResult(false, getStackTrace(e));
|
||||
}
|
||||
}
|
||||
return new RunResult(true, "OK");
|
||||
}
|
||||
|
||||
private static RunResult run(final GeneralCommandLine commandLine, @Nullable final String input) {
|
||||
private static RunResult run(final RunSettings settings) {
|
||||
System.out.println("RUN COMMAND: " + settings);
|
||||
final StringBuilder stdOut = new StringBuilder();
|
||||
final StringBuilder stdErr = new StringBuilder();
|
||||
|
||||
final OSProcessHandler handler;
|
||||
try {
|
||||
handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString(), Charsets.UTF_8);
|
||||
if (input != null) {
|
||||
handler.getProcessInput().write(input.getBytes());
|
||||
handler = new OSProcessHandler(settings.commandLine.createProcess(), settings.commandLine.getCommandLineString(), Charsets.UTF_8);
|
||||
if (settings.input != null) {
|
||||
handler.getProcessInput().write(settings.input.getBytes());
|
||||
}
|
||||
close(handler.getProcessInput());
|
||||
}
|
||||
@@ -99,38 +122,56 @@ public class RunUtils {
|
||||
return new RunResult(false, getStackTrace(e));
|
||||
}
|
||||
|
||||
final ProcessAdapter listener = new ProcessAdapter() {
|
||||
handler.addProcessListener(new ProcessAdapter() {
|
||||
@Override
|
||||
public void onTextAvailable(final ProcessEvent event, final Key outputType) {
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
System.out.println("TERMINATED: " + settings.commandLine);
|
||||
super.processTerminated(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextAvailable(ProcessEvent event, Key outputType) {
|
||||
String str = event.getText();
|
||||
if (outputType == ProcessOutputTypes.STDOUT || outputType == ProcessOutputTypes.SYSTEM) {
|
||||
stdOut.append(str);
|
||||
if (!commandLine.getCommandLineString().contains("install")) {
|
||||
System.out.print(str);
|
||||
}
|
||||
appendToContent(stdOut, str);
|
||||
}
|
||||
else if (outputType == ProcessOutputTypes.STDERR) {
|
||||
stdErr.append(str);
|
||||
System.err.print(str);
|
||||
appendToContent(stdErr, str);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handler.addProcessListener(listener);
|
||||
private synchronized void appendToContent(StringBuilder content, String line) {
|
||||
if (settings.printOutputAtAppearance) {
|
||||
System.out.println(getPrefixString() + StringUtil.trimTrailing(line));
|
||||
System.out.flush();
|
||||
}
|
||||
else {
|
||||
content.append(getPrefixString());
|
||||
content.append(StringUtil.trimTrailing(line));
|
||||
content.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
private String getPrefixString() {
|
||||
return (settings.outputPrefix != null) ? settings.outputPrefix + " " : "";
|
||||
}
|
||||
});
|
||||
|
||||
handler.startNotify();
|
||||
|
||||
try {
|
||||
handler.waitFor(300000);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
return new RunResult(false, getStackTrace(e));
|
||||
}
|
||||
if (settings.waitForEnd) {
|
||||
handler.waitFor(400000);
|
||||
|
||||
if (!handler.isProcessTerminated()) {
|
||||
return new RunResult(false, "Timeout exception: execution was terminated after 5 min.");
|
||||
if (!handler.isProcessTerminated()) {
|
||||
System.out.println("Output before handler.isProcessTerminated() " + settings.commandLine);
|
||||
System.out.println(stdOut);
|
||||
System.err.println(stdErr);
|
||||
return new RunResult(false, "Timeout exception: execution was terminated after ~7 min.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
handler.waitFor();
|
||||
}
|
||||
|
||||
handler.removeProcessListener(listener);
|
||||
|
||||
int exitCode = handler.getProcess().exitValue();
|
||||
|
||||
@@ -142,6 +183,9 @@ public class RunUtils {
|
||||
if (OutputUtils.isBuildFailed(output)) {
|
||||
return new RunResult(false, output);
|
||||
}
|
||||
if (!settings.commandLine.getCommandLineString().contains("install")) {
|
||||
System.out.print(output);
|
||||
}
|
||||
return new RunResult(true, output);
|
||||
}
|
||||
}
|
||||
@@ -174,5 +218,5 @@ public class RunUtils {
|
||||
}
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.compiler.run.result;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class RunResult {
|
||||
private final boolean status;
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.compiler.android;
|
||||
|
||||
import org.jetbrains.jps.builders.JpsBuildTestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AndroidJpsBuildTestCase extends JpsBuildTestCase {
|
||||
private static final String PROJECT_NAME = "android-module";
|
||||
private static final String SDK_NAME = "Android_SDK";
|
||||
|
||||
private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
|
||||
|
||||
public void doTest() {
|
||||
initProject();
|
||||
rebuildAll();
|
||||
makeAll().assertSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProjectName() {
|
||||
return "android-module";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AndroidJpsTest";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File doGetProjectDir() throws IOException {
|
||||
return workDir;
|
||||
}
|
||||
|
||||
private void initProject() {
|
||||
addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
|
||||
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -19,35 +19,43 @@ package org.jetbrains.jet.compiler.android;
|
||||
import com.google.common.io.Files;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import junit.framework.TestSuite;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.compiler.CodegenTestsOnAndroidRunner;
|
||||
import org.jetbrains.jet.compiler.PathManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class AndroidRunner extends TestSuite {
|
||||
|
||||
private static PathManager pathManager;
|
||||
|
||||
@NotNull
|
||||
public static PathManager getPathManager() {
|
||||
if (pathManager == null) {
|
||||
File tmpFolder = Files.createTempDir();
|
||||
System.out.println("Created temporary folder for running android tests: " + tmpFolder.getAbsolutePath());
|
||||
File rootFolder = new File("");
|
||||
pathManager = new PathManager(rootFolder.getAbsolutePath(), tmpFolder.getAbsolutePath());
|
||||
}
|
||||
return pathManager;
|
||||
}
|
||||
|
||||
public static TestSuite suite() throws Throwable {
|
||||
File tmpFolder = Files.createTempDir();
|
||||
System.out.println("Created temporary folder for running android tests: " + tmpFolder.getAbsolutePath());
|
||||
File rootFolder = new File("");
|
||||
PathManager pathManager = new PathManager(rootFolder.getAbsolutePath(), tmpFolder.getAbsolutePath());
|
||||
PathManager pathManager = getPathManager();
|
||||
|
||||
FileUtil.copyDir(new File(pathManager.getAndroidModuleRoot()), new File(pathManager.getTmpFolder()));
|
||||
|
||||
try {
|
||||
CodegenTestsOnAndroidGenerator.generate(pathManager);
|
||||
}
|
||||
catch(Throwable e) {
|
||||
FileUtil.delete(new File(pathManager.getTmpFolder()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
CodegenTestsOnAndroidGenerator.generate(pathManager);
|
||||
|
||||
System.out.println("Run tests on android...");
|
||||
return CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
|
||||
TestSuite suite = CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
|
||||
suite.addTest(new AndroidJpsBuildTestCase());
|
||||
return suite;
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
// Clear tmp folder where we run android tests
|
||||
FileUtil.delete(new File(pathManager.getTmpFolder()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.TestJdkKind;
|
||||
@@ -37,14 +36,10 @@ import org.jetbrains.jet.utils.Printer;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
|
||||
@@ -57,8 +52,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
|
||||
private JetCoreEnvironment environmentWithMockJdk = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS);
|
||||
private JetCoreEnvironment environmentWithFullJdk = JetTestUtils.createEnvironmentWithFullJdk(myTestRootDisposable);
|
||||
private JetCoreEnvironment environmentWithFullJdkAndJUnit;
|
||||
|
||||
|
||||
private final Pattern packagePattern = Pattern.compile("package (.*)");
|
||||
|
||||
private final List<String> generatedTestNames = Lists.newArrayList();
|
||||
@@ -69,16 +63,6 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
|
||||
private CodegenTestsOnAndroidGenerator(PathManager pathManager) {
|
||||
this.pathManager = pathManager;
|
||||
|
||||
File junitJar = new File("libraries/lib/junit-4.9.jar");
|
||||
|
||||
if (!junitJar.exists()) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
environmentWithFullJdkAndJUnit = new JetCoreEnvironment(myTestRootDisposable, CompileCompilerDependenciesTest.compilerConfigurationForTests(
|
||||
ConfigurationKind.ALL, TestJdkKind.FULL_JDK, JetTestUtils.getAnnotationsJar(), junitJar));
|
||||
|
||||
}
|
||||
|
||||
private void generateOutputFiles() throws Throwable {
|
||||
@@ -135,8 +119,6 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
Assert.assertNotNull("Folder with testData is empty: " + dir.getAbsolutePath(), files);
|
||||
Set<String> excludedFiles = SpecialFiles.getExcludedFiles();
|
||||
Set<String> filesCompiledWithoutStdLib = SpecialFiles.getFilesCompiledWithoutStdLib();
|
||||
Set<String> filesCompiledWithJUnit = SpecialFiles.getFilesCompiledWithJUnit();
|
||||
Map<String, String> filesWithSpecialResult = SpecialFiles.getFilesWithSpecialResult();
|
||||
for (File file : files) {
|
||||
if (excludedFiles.contains(file.getName())) {
|
||||
continue;
|
||||
@@ -155,21 +137,11 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
if (filesCompiledWithoutStdLib.contains(file.getName())) {
|
||||
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithMockJdk);
|
||||
}
|
||||
else if (filesCompiledWithJUnit.contains(file.getName())) {
|
||||
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdkAndJUnit);
|
||||
}
|
||||
else {
|
||||
factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdk);
|
||||
}
|
||||
|
||||
String specialResult = filesWithSpecialResult.get(file.getName());
|
||||
if (specialResult != null) {
|
||||
generateTestMethodWithExpectedResult(p, generatedTestName, StringUtil.escapeStringCharacters(file.getPath()),
|
||||
specialResult);
|
||||
}
|
||||
else {
|
||||
generateTestMethod(p, generatedTestName, StringUtil.escapeStringCharacters(file.getPath()));
|
||||
}
|
||||
generateTestMethod(p, generatedTestName, StringUtil.escapeStringCharacters(file.getPath()));
|
||||
File outputDir = new File(pathManager.getOutputForCompiledFiles());
|
||||
if (!outputDir.exists()) {
|
||||
outputDir.mkdirs();
|
||||
@@ -208,19 +180,15 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateTestMethodWithExpectedResult(Printer p, String testName, String namespace, String expectedResult) {
|
||||
private static void generateTestMethod(Printer p, String testName, String namespace) {
|
||||
p.println("public void test" + testName + "() throws Exception {");
|
||||
p.pushIndent();
|
||||
p.println("invokeBoxMethod(\"" + namespace + "\", \"" + expectedResult + "\");");
|
||||
p.println("invokeBoxMethod(\"" + namespace + "\", \"OK\");");
|
||||
p.popIndent();
|
||||
p.println("}");
|
||||
p.println();
|
||||
}
|
||||
|
||||
private static void generateTestMethod(Printer p, String testName, String namespace) {
|
||||
generateTestMethodWithExpectedResult(p, testName, namespace, "OK");
|
||||
}
|
||||
|
||||
private String generateTestName(String fileName) {
|
||||
String result = FileUtil.getNameWithoutExtension(StringUtil.capitalize(fileName));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -16,34 +16,21 @@
|
||||
|
||||
package org.jetbrains.jet.compiler.android;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Natalia.Ukhorskaya
|
||||
*/
|
||||
|
||||
public class SpecialFiles {
|
||||
private static final Set<String> excludedFiles = Sets.newHashSet();
|
||||
private static final Set<String> filesCompiledWithoutStdLib = Sets.newHashSet();
|
||||
private static final Set<String> filesCompiledWithJUnit = Sets.newHashSet();
|
||||
private static final Map<String, String> filesWithSpecialResult = Maps.newHashMap();
|
||||
|
||||
static {
|
||||
fillExcludedFiles();
|
||||
fillFilesCompiledWithoutStdLib();
|
||||
fillFilesCompiledWithJUnit();
|
||||
fillFilesWithSpecialResult();
|
||||
}
|
||||
|
||||
|
||||
public static Set<String> getFilesCompiledWithJUnit() {
|
||||
return filesCompiledWithJUnit;
|
||||
}
|
||||
|
||||
public static Set<String> getExcludedFiles() {
|
||||
return excludedFiles;
|
||||
}
|
||||
@@ -52,82 +39,39 @@ public class SpecialFiles {
|
||||
return filesCompiledWithoutStdLib;
|
||||
}
|
||||
|
||||
public static Map<String, String> getFilesWithSpecialResult() {
|
||||
return filesWithSpecialResult;
|
||||
}
|
||||
|
||||
private static void fillFilesWithSpecialResult() {
|
||||
filesWithSpecialResult.put("kt2398.kt", "OKKO");
|
||||
}
|
||||
|
||||
private static void fillFilesCompiledWithJUnit() {
|
||||
filesCompiledWithJUnit.add("kt2334.kt");
|
||||
}
|
||||
|
||||
private static void fillFilesCompiledWithoutStdLib() {
|
||||
filesCompiledWithoutStdLib.add("kt1980.kt");
|
||||
filesCompiledWithoutStdLib.add("kt1953_class.kt"); // Exception in code
|
||||
filesCompiledWithoutStdLib.add("basicmethodSuperClass.jet"); // Exception in code
|
||||
filesCompiledWithoutStdLib.add("kt503.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt504.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt772.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt773.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt796_797.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt950.jet"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("basicmethodSuperClass.kt"); // Exception in code
|
||||
filesCompiledWithoutStdLib.add("kt503.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt504.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt772.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt773.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt796_797.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt950.kt"); // OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
filesCompiledWithoutStdLib.add("kt2395.kt"); // With MOCK_JDK
|
||||
}
|
||||
|
||||
private static void fillExcludedFiles() {
|
||||
excludedFiles.add("kt2781.kt"); // Must compile Java files before
|
||||
excludedFiles.add("simpleJavaInnerEnum.kt"); // Must compile Java files before
|
||||
excludedFiles.add("referencesStaticInnerClassMethod.kt"); // Must compile Java files before
|
||||
excludedFiles.add("referencesStaticInnerClassMethodL2.kt"); // Must compile Java files before
|
||||
excludedFiles.add("simpleJavaEnum.kt"); // Must compile Java files before
|
||||
excludedFiles.add("simpleJavaEnumWithFunction.kt"); // Must compile Java files before
|
||||
excludedFiles.add("simpleJavaEnumWithStaticImport.kt"); // Must compile Java files before
|
||||
excludedFiles.add("removeInIterator.kt"); // Must compile Java files before
|
||||
excludedFiles.add("namespaceQualifiedMethod.jet"); // Cannot change package name
|
||||
excludedFiles.add("kt1482_2279.kt"); // Cannot change package name
|
||||
excludedFiles.add("kt1482.kt"); // Cannot change package name
|
||||
excludedFiles.add("importFromClassObject.jet"); // Cannot find usages in Codegen tests
|
||||
excludedFiles.add("withtypeparams.jet"); // Cannot find usages in Codegen tests
|
||||
excludedFiles.add("kt1113.kt"); // Commented
|
||||
excludedFiles.add("kt326.jet"); // Commented
|
||||
excludedFiles.add("kt694.jet"); // Commented
|
||||
excludedFiles.add("kt285.jet"); // Commented
|
||||
excludedFiles.add("kt857.jet"); // Commented
|
||||
excludedFiles.add("kt1120.kt"); // Commented
|
||||
excludedFiles.add("boxWithJava"); // Must compile Java files before
|
||||
excludedFiles.add("boxMultiFile"); // MultiFileTest not supported yet
|
||||
|
||||
excludedFiles.add("kt3238.kt"); // Reflection
|
||||
excludedFiles.add("kt1482_2279.kt"); // Reflection
|
||||
|
||||
excludedFiles.add("nestedInPackage.kt"); // Cannot change package name
|
||||
excludedFiles.add("importNestedClass.kt"); // Cannot change package name
|
||||
excludedFiles.add("namespaceQualifiedMethod.kt"); // Cannot change package name
|
||||
|
||||
excludedFiles.add("kt326.kt"); // Commented
|
||||
excludedFiles.add("kt1213.kt"); // Commented
|
||||
excludedFiles.add("kt882.jet"); // Commented
|
||||
excludedFiles.add("kt789.jet"); // Commented
|
||||
excludedFiles.add("enum.kt"); // Commented
|
||||
excludedFiles.add("withclosure.kt"); // Commented
|
||||
excludedFiles.add("isTypeParameter.jet"); // Commented
|
||||
excludedFiles.add("nullability.jet"); // Commented
|
||||
excludedFiles.add("genericFunction.jet"); // Commented
|
||||
excludedFiles.add("forwardTypeParameter.jet"); // Commented
|
||||
excludedFiles.add("kt259.jet"); // Commented
|
||||
excludedFiles.add("classObjectMethod.jet"); // Commented
|
||||
|
||||
excludedFiles.add("inRangeConditionsInWhen.jet"); // Commented
|
||||
excludedFiles.add("kt1592.kt"); // Codegen don't execute blackBoxFile() on it
|
||||
|
||||
excludedFiles.add("box.kt"); // MultiFileTest not supported yet
|
||||
excludedFiles.add("kt2060_1.kt"); // MultiFileTest not supported yet
|
||||
excludedFiles.add("kt2257_1.kt"); // MultiFileTest not supported yet
|
||||
excludedFiles.add("kt1528_1.kt"); // MultiFileTest not supported yet
|
||||
excludedFiles.add("thisPackage.kt"); // MultiFileTest not supported yet
|
||||
excludedFiles.add("kt684.kt"); // StackOverflow with StringBuilder (escape())
|
||||
|
||||
excludedFiles.add("kt684.jet"); // StackOverflow with StringBuilder (escape())
|
||||
|
||||
excludedFiles.add("kt344.jet"); // Bug KT-2251
|
||||
excludedFiles.add("kt529.kt"); // Bug
|
||||
excludedFiles.add("kt344.kt"); // Bug
|
||||
|
||||
excludedFiles.add("noClassObjectForJavaClass.kt");
|
||||
|
||||
excludedFiles.add("doGenerateAssertions.kt"); // Multi-file + Java
|
||||
excludedFiles.add("doNotGenerateAssertions.kt"); // Multi-file + Java
|
||||
excludedFiles.add("doGenerateParamAssertions.kt"); // Java
|
||||
excludedFiles.add("comparisonWithNullCallsFun.kt"); // java.lang.NoClassDefFoundError: jet.Nothing
|
||||
}
|
||||
|
||||
private SpecialFiles() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
@@ -25,9 +26,6 @@ import java.util.Collections;
|
||||
|
||||
import static org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class AccessorForFunctionDescriptor extends SimpleFunctionDescriptorImpl {
|
||||
public AccessorForFunctionDescriptor(DeclarationDescriptor descriptor, DeclarationDescriptor containingDeclaration, int index) {
|
||||
super(containingDeclaration, Collections.<AnnotationDescriptor>emptyList(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -18,16 +18,17 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.PropertyGetterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.PropertySetterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class AccessorForPropertyDescriptor extends PropertyDescriptor {
|
||||
public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl {
|
||||
public AccessorForPropertyDescriptor(PropertyDescriptor pd, DeclarationDescriptor containingDeclaration, int index) {
|
||||
super(containingDeclaration, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC,
|
||||
pd.isVar(), Name.identifier(pd.getName() + "$b$" + index),
|
||||
@@ -38,7 +39,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptor {
|
||||
initialize(new Getter(this), new Setter(this));
|
||||
}
|
||||
|
||||
public static class Getter extends PropertyGetterDescriptor {
|
||||
public static class Getter extends PropertyGetterDescriptorImpl {
|
||||
public Getter(AccessorForPropertyDescriptor property) {
|
||||
super(property, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC,
|
||||
false,
|
||||
@@ -47,7 +48,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Setter extends PropertySetterDescriptor {
|
||||
public static class Setter extends PropertySetterDescriptorImpl {
|
||||
public Setter(AccessorForPropertyDescriptor property) {
|
||||
super(property, Collections.<AnnotationDescriptor>emptyList(), Modality.FINAL, Visibilities.PUBLIC,
|
||||
false,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -43,9 +43,6 @@ import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public abstract class AnnotationCodegen {
|
||||
private final JetTypeMapper typeMapper;
|
||||
private final BindingContext bindingContext;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
|
||||
@@ -46,12 +47,10 @@ import java.util.Set;
|
||||
|
||||
import static org.jetbrains.asm4.Opcodes.*;
|
||||
import static org.jetbrains.jet.codegen.CodegenUtil.isInterface;
|
||||
import static org.jetbrains.jet.codegen.CodegenUtil.isNullableType;
|
||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isClassObject;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.JAVA_STRING_TYPE;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class AsmUtil {
|
||||
private static final Set<ClassDescriptor> PRIMITIVE_NUMBER_CLASSES = Sets.newHashSet(
|
||||
KotlinBuiltIns.getInstance().getByte(),
|
||||
@@ -70,6 +69,8 @@ public class AsmUtil {
|
||||
private static final Map<Visibility, Integer> visibilityToAccessFlag = ImmutableMap.<Visibility, Integer>builder()
|
||||
.put(Visibilities.PRIVATE, ACC_PRIVATE)
|
||||
.put(Visibilities.PROTECTED, ACC_PROTECTED)
|
||||
.put(JavaDescriptorResolver.PROTECTED_STATIC_VISIBILITY, ACC_PROTECTED)
|
||||
.put(JavaDescriptorResolver.PROTECTED_AND_PACKAGE, ACC_PROTECTED)
|
||||
.put(Visibilities.PUBLIC, ACC_PUBLIC)
|
||||
.put(Visibilities.INTERNAL, ACC_PUBLIC)
|
||||
.put(Visibilities.LOCAL, NO_FLAG_LOCAL)
|
||||
@@ -130,6 +131,51 @@ public class AsmUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAbstract(FunctionDescriptor functionDescriptor, OwnerKind kind) {
|
||||
return (functionDescriptor.getModality() == Modality.ABSTRACT
|
||||
|| isInterface(functionDescriptor.getContainingDeclaration()))
|
||||
&& !isStatic(kind)
|
||||
&& kind != OwnerKind.TRAIT_IMPL;
|
||||
}
|
||||
|
||||
public static boolean isStatic(OwnerKind kind) {
|
||||
return kind == OwnerKind.NAMESPACE || kind instanceof OwnerKind.StaticDelegateKind;
|
||||
}
|
||||
|
||||
public static int getMethodAsmFlags(FunctionDescriptor functionDescriptor, OwnerKind kind) {
|
||||
boolean isStatic = isStatic(kind);
|
||||
boolean isAbstract = isAbstract(functionDescriptor, kind);
|
||||
|
||||
int flags = getCommonCallableFlags(functionDescriptor);
|
||||
|
||||
if (functionDescriptor.getModality() == Modality.FINAL) {
|
||||
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
|
||||
if (!(containingDeclaration instanceof ClassDescriptor) ||
|
||||
((ClassDescriptor) containingDeclaration).getKind() != ClassKind.TRAIT) {
|
||||
flags |= ACC_FINAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (isStatic || kind == OwnerKind.TRAIT_IMPL) {
|
||||
flags |= ACC_STATIC;
|
||||
}
|
||||
|
||||
if (isAbstract) flags |= ACC_ABSTRACT;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public static int getConstructorAsmFlags(FunctionDescriptor functionDescriptor) {
|
||||
return getCommonCallableFlags(functionDescriptor);
|
||||
}
|
||||
|
||||
private static int getCommonCallableFlags(FunctionDescriptor functionDescriptor) {
|
||||
int flags = getVisibilityAccessFlag(functionDescriptor);
|
||||
flags |= getVarargsFlag(functionDescriptor);
|
||||
flags |= getDeprecatedAccessFlag(functionDescriptor);
|
||||
return flags;
|
||||
}
|
||||
|
||||
//TODO: move mapping logic to front-end java
|
||||
public static int getVisibilityAccessFlag(@NotNull MemberDescriptor descriptor) {
|
||||
Integer specialCase = specialCaseVisibility(descriptor);
|
||||
@@ -143,6 +189,20 @@ public class AsmUtil {
|
||||
return defaultMapping;
|
||||
}
|
||||
|
||||
/*
|
||||
Use this method to get visibility flag for class to define it in byte code (v.defineClass method).
|
||||
For other cases use getVisibilityAccessFlag(MemberDescriptor descriptor)
|
||||
Classes in byte code should be public or package private
|
||||
*/
|
||||
public static int getVisibilityAccessFlagForClass(ClassDescriptor descriptor) {
|
||||
if (DescriptorUtils.isTopLevelDeclaration(descriptor) ||
|
||||
descriptor.getVisibility() == Visibilities.PUBLIC ||
|
||||
descriptor.getVisibility() == Visibilities.INTERNAL) {
|
||||
return ACC_PUBLIC;
|
||||
}
|
||||
return NO_FLAG_PACKAGE_PRIVATE;
|
||||
}
|
||||
|
||||
public static int getModalityAccessFlag(@NotNull MemberDescriptor descriptor) {
|
||||
switch (descriptor.getModality()) {
|
||||
case ABSTRACT: return ACC_ABSTRACT;
|
||||
@@ -164,6 +224,15 @@ public class AsmUtil {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int getVarargsFlag(FunctionDescriptor functionDescriptor) {
|
||||
if (!functionDescriptor.getValueParameters().isEmpty()
|
||||
&& functionDescriptor.getValueParameters().get(functionDescriptor.getValueParameters().size() - 1)
|
||||
.getVarargElementType() != null) {
|
||||
return ACC_VARARGS;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Integer specialCaseVisibility(@NotNull MemberDescriptor memberDescriptor) {
|
||||
DeclarationDescriptor containingDeclaration = memberDescriptor.getContainingDeclaration();
|
||||
@@ -193,7 +262,7 @@ public class AsmUtil {
|
||||
return ACC_PROTECTED;
|
||||
}
|
||||
}
|
||||
if (containingDeclaration instanceof NamespaceDescriptor) {
|
||||
if (DescriptorUtils.isTopLevelDeclaration(memberDescriptor)) {
|
||||
return ACC_PUBLIC;
|
||||
}
|
||||
return null;
|
||||
@@ -224,7 +293,7 @@ public class AsmUtil {
|
||||
|
||||
public static void genClosureFields(CalculatedClosure closure, ClassBuilder v, JetTypeMapper typeMapper) {
|
||||
final ClassifierDescriptor captureThis = closure.getCaptureThis();
|
||||
final int access = ACC_PUBLIC | ACC_SYNTHETIC | ACC_FINAL;
|
||||
final int access = NO_FLAG_PACKAGE_PRIVATE | ACC_SYNTHETIC | ACC_FINAL;
|
||||
if (captureThis != null) {
|
||||
v.newField(null, access, CAPTURED_THIS_FIELD, typeMapper.mapType(captureThis).getDescriptor(), null,
|
||||
null);
|
||||
@@ -243,10 +312,18 @@ public class AsmUtil {
|
||||
}
|
||||
|
||||
public static void genInitSingletonField(Type classAsmType, InstructionAdapter iv) {
|
||||
iv.anew(classAsmType);
|
||||
genInitSingletonField(classAsmType, JvmAbi.INSTANCE_FIELD, classAsmType, iv);
|
||||
}
|
||||
|
||||
public static void genInitSingletonField(FieldInfo info, InstructionAdapter iv) {
|
||||
genInitSingletonField(info.getOwnerType(), info.getFieldName(), info.getFieldType(), iv);
|
||||
}
|
||||
|
||||
public static void genInitSingletonField(Type fieldOwnerType, String fieldName, Type fieldAsmType, InstructionAdapter iv) {
|
||||
iv.anew(fieldAsmType);
|
||||
iv.dup();
|
||||
iv.invokespecial(classAsmType.getInternalName(), "<init>", "()V");
|
||||
iv.putstatic(classAsmType.getInternalName(), JvmAbi.INSTANCE_FIELD, classAsmType.getDescriptor());
|
||||
iv.invokespecial(fieldAsmType.getInternalName(), "<init>", "()V");
|
||||
iv.putstatic(fieldOwnerType.getInternalName(), fieldName, fieldAsmType.getDescriptor());
|
||||
}
|
||||
|
||||
public static void genStringBuilderConstructor(InstructionAdapter v) {
|
||||
@@ -311,75 +388,6 @@ public class AsmUtil {
|
||||
mv.visitInsn(L2I);
|
||||
}
|
||||
|
||||
static StackValue compareExpressionsOnStack(InstructionAdapter v, IElementType opToken, Type operandType) {
|
||||
if (operandType.getSort() == Type.OBJECT) {
|
||||
v.invokeinterface("java/lang/Comparable", "compareTo", "(Ljava/lang/Object;)I");
|
||||
v.iconst(0);
|
||||
operandType = Type.INT_TYPE;
|
||||
}
|
||||
return StackValue.cmp(opToken, operandType);
|
||||
}
|
||||
|
||||
static StackValue genNullSafeEquals(
|
||||
InstructionAdapter v,
|
||||
IElementType opToken,
|
||||
boolean leftNullable,
|
||||
boolean rightNullable
|
||||
) {
|
||||
if (!leftNullable) {
|
||||
v.invokevirtual("java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
|
||||
if (opToken == JetTokens.EXCLEQ) {
|
||||
genInvertBoolean(v);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (rightNullable) {
|
||||
v.dup2(); // left right left right
|
||||
Label rightNull = new Label();
|
||||
v.ifnull(rightNull);
|
||||
Label leftNull = new Label();
|
||||
v.ifnull(leftNull);
|
||||
v.invokevirtual("java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
|
||||
if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
|
||||
genInvertBoolean(v);
|
||||
}
|
||||
Label end = new Label();
|
||||
v.goTo(end);
|
||||
v.mark(rightNull);
|
||||
// left right left
|
||||
Label bothNull = new Label();
|
||||
v.ifnull(bothNull);
|
||||
v.mark(leftNull);
|
||||
v.pop2();
|
||||
v.iconst(opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ ? 1 : 0);
|
||||
v.goTo(end);
|
||||
v.mark(bothNull);
|
||||
v.pop2();
|
||||
v.iconst(opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ ? 0 : 1);
|
||||
v.mark(end);
|
||||
}
|
||||
else {
|
||||
v.dup2(); // left right left right
|
||||
v.pop();
|
||||
Label leftNull = new Label();
|
||||
v.ifnull(leftNull);
|
||||
v.invokevirtual("java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
|
||||
if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
|
||||
genInvertBoolean(v);
|
||||
}
|
||||
Label end = new Label();
|
||||
v.goTo(end);
|
||||
// left right
|
||||
v.mark(leftNull);
|
||||
v.pop2();
|
||||
v.iconst(opToken == JetTokens.EXCLEQ ? 1 : 0);
|
||||
v.mark(end);
|
||||
}
|
||||
}
|
||||
|
||||
return StackValue.onStack(Type.BOOLEAN_TYPE);
|
||||
}
|
||||
|
||||
static void genInvertBoolean(InstructionAdapter v) {
|
||||
v.iconst(1);
|
||||
v.xor(Type.INT_TYPE);
|
||||
@@ -389,19 +397,23 @@ public class AsmUtil {
|
||||
InstructionAdapter v,
|
||||
IElementType opToken,
|
||||
Type leftType,
|
||||
Type rightType,
|
||||
boolean leftNullable,
|
||||
boolean rightNullable
|
||||
Type rightType
|
||||
) {
|
||||
if ((isNumberPrimitive(leftType) || leftType.getSort() == Type.BOOLEAN) && leftType == rightType) {
|
||||
return compareExpressionsOnStack(v, opToken, leftType);
|
||||
return StackValue.cmp(opToken, leftType);
|
||||
}
|
||||
else {
|
||||
if (opToken == JetTokens.EQEQEQ || opToken == JetTokens.EXCLEQEQEQ) {
|
||||
return StackValue.cmp(opToken, leftType);
|
||||
}
|
||||
else {
|
||||
return genNullSafeEquals(v, opToken, leftNullable, rightNullable);
|
||||
v.invokestatic("jet/runtime/Intrinsics", "areEqual", "(Ljava/lang/Object;Ljava/lang/Object;)Z");
|
||||
|
||||
if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
|
||||
genInvertBoolean(v);
|
||||
}
|
||||
|
||||
return StackValue.onStack(Type.BOOLEAN_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -443,6 +455,24 @@ public class AsmUtil {
|
||||
genMethodThrow(mv, STUB_EXCEPTION, STUB_EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public static void swap(InstructionAdapter v, Type stackTop, Type afterTop) {
|
||||
if (stackTop.getSize() == 1) {
|
||||
if (afterTop.getSize() == 1) {
|
||||
v.swap();
|
||||
} else {
|
||||
v.dupX2();
|
||||
v.pop();
|
||||
}
|
||||
} else {
|
||||
if (afterTop.getSize() == 1) {
|
||||
v.dup2X1();
|
||||
} else {
|
||||
v.dup2X2();
|
||||
}
|
||||
v.pop2();
|
||||
}
|
||||
}
|
||||
|
||||
public static void genNotNullAssertionsForParameters(
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull GenerationState state,
|
||||
@@ -456,7 +486,7 @@ public class AsmUtil {
|
||||
|
||||
for (ValueParameterDescriptor parameter : descriptor.getValueParameters()) {
|
||||
JetType type = parameter.getReturnType();
|
||||
if (type == null || type.isNullable()) continue;
|
||||
if (type == null || isNullableType(type)) continue;
|
||||
|
||||
int index = frameMap.getIndex(parameter);
|
||||
Type asmType = state.getTypeMapper().mapReturnType(type);
|
||||
@@ -495,10 +525,10 @@ public class AsmUtil {
|
||||
) {
|
||||
if (!state.isGenerateNotNullAssertions()) return;
|
||||
|
||||
if (!Boolean.TRUE.equals(state.getBindingContext().get(BindingContext.IS_DECLARED_IN_JAVA, descriptor))) return;
|
||||
if (!isDeclaredInJava(descriptor, state.getBindingContext())) return;
|
||||
|
||||
JetType type = descriptor.getReturnType();
|
||||
if (type == null || type.isNullable()) return;
|
||||
if (type == null || isNullableType(type)) return;
|
||||
|
||||
Type asmType = state.getTypeMapper().mapReturnType(type);
|
||||
if (asmType.getSort() == Type.OBJECT || asmType.getSort() == Type.ARRAY) {
|
||||
@@ -508,4 +538,48 @@ public class AsmUtil {
|
||||
v.invokestatic("jet/runtime/Intrinsics", assertMethodToCall, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isDeclaredInJava(@NotNull CallableDescriptor callableDescriptor, @NotNull BindingContext context) {
|
||||
CallableDescriptor descriptor = callableDescriptor;
|
||||
while (true) {
|
||||
if (Boolean.TRUE.equals(context.get(BindingContext.IS_DECLARED_IN_JAVA, descriptor))) {
|
||||
return true;
|
||||
}
|
||||
CallableDescriptor original = descriptor.getOriginal();
|
||||
if (descriptor == original) break;
|
||||
descriptor = original;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void pushDefaultValueOnStack(@NotNull Type type, @NotNull InstructionAdapter v) {
|
||||
if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
|
||||
v.aconst(null);
|
||||
}
|
||||
else {
|
||||
pushDefaultPrimitiveValueOnStack(type, v);
|
||||
}
|
||||
}
|
||||
|
||||
public static void pushDefaultPrimitiveValueOnStack(@NotNull Type type, @NotNull InstructionAdapter v) {
|
||||
if (type.getSort() == Type.FLOAT) {
|
||||
v.fconst(0);
|
||||
}
|
||||
else if (type.getSort() == Type.DOUBLE) {
|
||||
v.dconst(0);
|
||||
}
|
||||
else if (type.getSort() == Type.LONG) {
|
||||
v.lconst(0);
|
||||
}
|
||||
else {
|
||||
v.iconst(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static Type comparisonOperandType(Type left, Type right) {
|
||||
if (left == Type.DOUBLE_TYPE || right == Type.DOUBLE_TYPE) return Type.DOUBLE_TYPE;
|
||||
if (left == Type.FLOAT_TYPE || right == Type.FLOAT_TYPE) return Type.FLOAT_TYPE;
|
||||
if (left == Type.LONG_TYPE || right == Type.LONG_TYPE) return Type.LONG_TYPE;
|
||||
return Type.INT_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -20,9 +20,6 @@ package org.jetbrains.jet.codegen;
|
||||
* Marks if backend's JetTypeMapper should map built-in types to Java types (e.g., jet.String into java.lang.String).
|
||||
* Disabling is needed for compiling builtins: we want types to be jet.* instead of java.util* to make it possible to load
|
||||
* builtins without JDK.
|
||||
*
|
||||
* @author Evgeny Gerashchenko
|
||||
* @since 7/5/12
|
||||
*/
|
||||
public enum BuiltinToJavaTypesMapping {
|
||||
ENABLED,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -16,8 +16,5 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public interface Callable {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -32,10 +32,6 @@ import java.util.List;
|
||||
import static org.jetbrains.asm4.Opcodes.INVOKESPECIAL;
|
||||
import static org.jetbrains.asm4.Opcodes.INVOKESTATIC;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
* @author alex.tkacman
|
||||
*/
|
||||
public class CallableMethod implements Callable {
|
||||
@NotNull
|
||||
private final JvmClassName owner;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -35,10 +35,6 @@ import java.util.List;
|
||||
import static org.jetbrains.asm4.Opcodes.*;
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.*;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class ClassBodyCodegen extends MemberCodegen {
|
||||
protected final JetClassOrObject myClass;
|
||||
protected final OwnerKind kind;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -81,7 +78,7 @@ public abstract class ClassBuilder {
|
||||
String superName,
|
||||
String[] interfaces
|
||||
) {
|
||||
getVisitor().visit(version, access & ~Opcodes.ACC_STATIC, name, signature, superName, interfaces);
|
||||
getVisitor().visit(version, access, name, signature, superName, interfaces);
|
||||
}
|
||||
|
||||
public void visitSource(String name, @Nullable String debug) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -23,9 +23,6 @@ import org.jetbrains.asm4.util.TraceClassVisitor;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
||||
public class ClassBuilderFactories {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -18,9 +18,6 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public interface ClassBuilderFactory {
|
||||
@NotNull
|
||||
ClassBuilderMode getClassBuilderMode();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public enum ClassBuilderMode {
|
||||
/**
|
||||
* Full function bodies
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -21,9 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public abstract class ClassBuilderOnDemand {
|
||||
|
||||
private ClassBuilder classBuilder;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.GenerationStateAware;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapperMode;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SubModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
@@ -34,10 +35,6 @@ import java.util.*;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.isPrimitive;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public final class ClassFileFactory extends GenerationStateAware {
|
||||
@NotNull private ClassBuilderFactory builderFactory;
|
||||
|
||||
@@ -118,13 +115,25 @@ public final class ClassFileFactory extends GenerationStateAware {
|
||||
);
|
||||
}
|
||||
};
|
||||
codegen = new NamespaceCodegen(onDemand, fqName, state, files);
|
||||
codegen = new NamespaceCodegen(onDemand, getSubModule(files), fqName, state, files);
|
||||
ns2codegen.put(fqName, codegen);
|
||||
}
|
||||
|
||||
return codegen;
|
||||
}
|
||||
|
||||
private SubModuleDescriptor getSubModule(Collection<JetFile> files) {
|
||||
assert !files.isEmpty() : "Don't generate namespaces from no files";
|
||||
SubModuleDescriptor subModule = state.getModuleSourcesManager().getSubModuleForFile(files.iterator().next());
|
||||
for (JetFile file : files) {
|
||||
SubModuleDescriptor fileSubModule = state.getModuleSourcesManager().getSubModuleForFile(file);
|
||||
assert fileSubModule.equals(subModule)
|
||||
: "Attempt to generate namespace from files originating from different sub-modules: " +
|
||||
fileSubModule + " != " + subModule;
|
||||
}
|
||||
return subModule;
|
||||
}
|
||||
|
||||
public ClassBuilder forClassImplementation(ClassDescriptor aClass, PsiFile sourceFile) {
|
||||
Type type = state.getTypeMapper().mapType(aClass.getDefaultType(), JetTypeMapperMode.IMPL);
|
||||
if (isPrimitive(type)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -14,10 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -18,9 +18,6 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public interface CodeChunk {
|
||||
void generate(InstructionAdapter v);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
|
||||
public class CodegenStatementVisitor extends JetVisitor<StackValue, StackValue> {
|
||||
private final ExpressionCodegen codegen;
|
||||
|
||||
public CodegenStatementVisitor(ExpressionCodegen codegen) {
|
||||
this.codegen = codegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackValue visitJetElement(JetElement element, StackValue receiver) {
|
||||
return element.accept(codegen, receiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackValue visitIfExpression(JetIfExpression expression, StackValue receiver) {
|
||||
return codegen.generateIfExpression(expression, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackValue visitTryExpression(JetTryExpression expression, StackValue data) {
|
||||
return codegen.generateTryExpression(expression, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackValue visitWhenExpression(JetWhenExpression expression, StackValue data) {
|
||||
return codegen.generateWhenExpression(expression, true);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -17,7 +17,9 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -29,6 +31,8 @@ import org.jetbrains.jet.codegen.signature.JvmMethodParameterKind;
|
||||
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.psi.JetClassObject;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
|
||||
@@ -39,16 +43,14 @@ import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeUtils;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.jet.lang.descriptors.Modality.ABSTRACT;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class CodegenUtil {
|
||||
|
||||
private CodegenUtil() {
|
||||
@@ -267,4 +269,31 @@ public class CodegenUtil {
|
||||
(context.getParentContext() instanceof NamespaceContext && context.getParentContext().getContextDescriptor() == containingDeclaration))
|
||||
&& context.getContextKind() != OwnerKind.TRAIT_IMPL);
|
||||
}
|
||||
|
||||
public static boolean hasAbstractMembers(@NotNull ClassDescriptor classDescriptor) {
|
||||
return ContainerUtil.exists(classDescriptor.getDefaultType().getMemberScope().getAllDescriptors(),
|
||||
new Condition<DeclarationDescriptor>() {
|
||||
@Override
|
||||
public boolean value(DeclarationDescriptor declaration) {
|
||||
if (!(declaration instanceof MemberDescriptor)) {
|
||||
return false;
|
||||
}
|
||||
return ((MemberDescriptor) declaration).getModality() == ABSTRACT;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A work-around of the generic nullability problem in the type checker
|
||||
* @return true if a value of this type can be null
|
||||
*/
|
||||
public static boolean isNullableType(@NotNull JetType type) {
|
||||
if (type.isNullable()) {
|
||||
return true;
|
||||
}
|
||||
if (type.getConstructor().getDeclarationDescriptor() instanceof TypeParameterDescriptor) {
|
||||
return TypeUtils.hasNullableSuperType(type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface CompilationErrorHandler {
|
||||
|
||||
CompilationErrorHandler THROW_EXCEPTION = new CompilationErrorHandler() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -23,10 +23,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
* @author abreslav
|
||||
*/
|
||||
public class CompilationException extends RuntimeException {
|
||||
private final PsiElement element;
|
||||
|
||||
@@ -64,6 +60,7 @@ public class CompilationException extends RuntimeException {
|
||||
message.append("Cause: ").append(causeMessage == null ? cause.toString() : causeMessage).append("\n");
|
||||
}
|
||||
message.append("File being compiled and position: ").append(DiagnosticUtils.atLocation(element)).append("\n");
|
||||
message.append("PsiElement: ").append(element.getText()).append("\n");
|
||||
message.append("The root cause was thrown at: ").append(where());
|
||||
|
||||
return message.toString();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -28,10 +28,6 @@ import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ConstructorFrameMap extends FrameMap {
|
||||
private int myOuterThisIndex = -1;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.codegen;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassKind;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
|
||||
public class FieldInfo {
|
||||
|
||||
private final Type fieldType;
|
||||
|
||||
private final Type ownerType;
|
||||
|
||||
private final String fieldName;
|
||||
|
||||
private FieldInfo(@NotNull Type ownerType, @NotNull Type fieldType, @NotNull String fieldName) {
|
||||
this.ownerType = ownerType;
|
||||
this.fieldType = fieldType;
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type getOwnerType() {
|
||||
return ownerType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getOwnerInternalName() {
|
||||
return ownerType.getInternalName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static FieldInfo createForSingleton(@NotNull ClassDescriptor fieldClassDescriptor, @NotNull JetTypeMapper typeMapper) {
|
||||
ClassKind kind = fieldClassDescriptor.getKind();
|
||||
if (kind != ClassKind.OBJECT && kind != ClassKind.CLASS_OBJECT && kind != ClassKind.ENUM_ENTRY) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
Type fieldType = typeMapper.mapType(fieldClassDescriptor.getDefaultType());
|
||||
|
||||
ClassDescriptor ownerDescriptor = kind == ClassKind.OBJECT
|
||||
? fieldClassDescriptor: DescriptorUtils.getParentOfType(fieldClassDescriptor, ClassDescriptor.class);
|
||||
assert ownerDescriptor != null;
|
||||
Type ownerType = typeMapper.mapType(ownerDescriptor.getDefaultType());
|
||||
|
||||
String fieldName = kind == ClassKind.ENUM_ENTRY
|
||||
? fieldClassDescriptor.getName().getName()
|
||||
: fieldClassDescriptor.getKind() == ClassKind.CLASS_OBJECT ? JvmAbi.CLASS_OBJECT_FIELD : JvmAbi.INSTANCE_FIELD;
|
||||
return new FieldInfo(ownerType, fieldType, fieldName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -27,9 +27,6 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class FrameMap {
|
||||
private final TObjectIntHashMap<DeclarationDescriptor> myVarIndex = new TObjectIntHashMap<DeclarationDescriptor>();
|
||||
private final TObjectIntHashMap<DeclarationDescriptor> myVarSizes = new TObjectIntHashMap<DeclarationDescriptor>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.asm4.MethodVisitor;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
import org.jetbrains.jet.codegen.binding.CodegenBinding;
|
||||
import org.jetbrains.jet.codegen.context.CodegenContext;
|
||||
import org.jetbrains.jet.codegen.context.MethodContext;
|
||||
import org.jetbrains.jet.codegen.signature.JvmMethodParameterSignature;
|
||||
@@ -46,7 +47,6 @@ import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.lang.resolve.java.kt.DescriptorKindUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -58,11 +58,6 @@ import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescrip
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class FunctionCodegen extends GenerationStateAware {
|
||||
private final CodegenContext owner;
|
||||
private final ClassBuilder v;
|
||||
@@ -342,50 +337,6 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
iv.areturn(asmMethod.getReturnType());
|
||||
}
|
||||
|
||||
private static boolean isAbstract(FunctionDescriptor functionDescriptor, OwnerKind kind) {
|
||||
return (functionDescriptor.getModality() == Modality.ABSTRACT
|
||||
|| isInterface(functionDescriptor.getContainingDeclaration())
|
||||
)
|
||||
&& !isStatic(kind)
|
||||
&& kind != OwnerKind.TRAIT_IMPL;
|
||||
}
|
||||
|
||||
public static int getMethodAsmFlags(FunctionDescriptor functionDescriptor, OwnerKind kind) {
|
||||
boolean isStatic = isStatic(kind);
|
||||
boolean isAbstract = isAbstract(functionDescriptor, kind);
|
||||
|
||||
int flags = getVisibilityAccessFlag(functionDescriptor);
|
||||
|
||||
if (!functionDescriptor.getValueParameters().isEmpty()
|
||||
&& functionDescriptor.getValueParameters().get(functionDescriptor.getValueParameters().size() - 1)
|
||||
.getVarargElementType() != null) {
|
||||
flags |= ACC_VARARGS;
|
||||
}
|
||||
|
||||
if (functionDescriptor.getModality() == Modality.FINAL) {
|
||||
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
|
||||
if (!(containingDeclaration instanceof ClassDescriptor) ||
|
||||
((ClassDescriptor) containingDeclaration).getKind() != ClassKind.TRAIT) {
|
||||
flags |= ACC_FINAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (isStatic || kind == OwnerKind.TRAIT_IMPL) {
|
||||
flags |= ACC_STATIC;
|
||||
}
|
||||
|
||||
if (isAbstract) flags |= ACC_ABSTRACT;
|
||||
|
||||
if (KotlinBuiltIns.getInstance().isDeprecated(functionDescriptor)) {
|
||||
flags |= ACC_DEPRECATED;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
private static boolean isStatic(OwnerKind kind) {
|
||||
return kind == OwnerKind.NAMESPACE || kind instanceof OwnerKind.StaticDelegateKind;
|
||||
}
|
||||
|
||||
public static void genJetAnnotations(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull FunctionDescriptor functionDescriptor,
|
||||
@@ -449,6 +400,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
JetValueParameterAnnotationWriter av = JetValueParameterAnnotationWriter.visitParameterAnnotation(mv, i + start);
|
||||
av.writeName(parameterDescriptor.getName().getName());
|
||||
av.writeHasDefaultValue(parameterDescriptor.declaresDefaultValue());
|
||||
av.writeVararg(parameterDescriptor.getVarargElementType() != null);
|
||||
if (kotlinParameterTypes.get(i) != null) {
|
||||
av.writeType(kotlinParameterTypes.get(i + start).getKotlinSignature());
|
||||
}
|
||||
@@ -528,6 +480,46 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
}
|
||||
}
|
||||
|
||||
static void generateConstructorWithoutParametersIfNeeded(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull CallableMethod method,
|
||||
@NotNull ConstructorDescriptor constructorDescriptor,
|
||||
@NotNull ClassBuilder classBuilder
|
||||
) {
|
||||
if (!isDefaultConstructorNeeded(state.getBindingContext(), constructorDescriptor)) {
|
||||
return;
|
||||
}
|
||||
int flags = getVisibilityAccessFlag(constructorDescriptor);
|
||||
MethodVisitor mv = classBuilder.newMethod(null, flags, "<init>", "()V", null, null);
|
||||
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES) {
|
||||
return;
|
||||
}
|
||||
else if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
|
||||
genStubCode(mv);
|
||||
}
|
||||
else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
||||
InstructionAdapter v = new InstructionAdapter(mv);
|
||||
mv.visitCode();
|
||||
|
||||
JvmClassName ownerInternalName = method.getOwner();
|
||||
Method jvmSignature = method.getSignature().getAsmMethod();
|
||||
v.load(0, ownerInternalName.getAsmType()); // Load this on stack
|
||||
|
||||
int mask = 0;
|
||||
for (ValueParameterDescriptor parameterDescriptor : constructorDescriptor.getValueParameters()) {
|
||||
Type paramType = state.getTypeMapper().mapType(parameterDescriptor.getType());
|
||||
pushDefaultValueOnStack(paramType, v);
|
||||
mask |= (1 << parameterDescriptor.getIndex());
|
||||
}
|
||||
v.iconst(mask);
|
||||
String desc = jvmSignature.getDescriptor().replace(")", "I)");
|
||||
v.invokespecial(ownerInternalName.getInternalName(), "<init>", desc);
|
||||
v.areturn(Type.VOID_TYPE);
|
||||
endVisit(mv, "default constructor for " + ownerInternalName.getInternalName(), null);
|
||||
}
|
||||
}
|
||||
|
||||
static void generateDefaultIfNeeded(
|
||||
MethodContext owner,
|
||||
GenerationState state,
|
||||
@@ -551,6 +543,10 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
|
||||
ReceiverParameterDescriptor receiverParameter = functionDescriptor.getReceiverParameter();
|
||||
boolean hasReceiver = receiverParameter != null;
|
||||
|
||||
// Has outer in local variables (constructor for inner class)
|
||||
boolean hasOuter = functionDescriptor instanceof ConstructorDescriptor &&
|
||||
CodegenBinding.canHaveOuter(state.getBindingContext(), ((ConstructorDescriptor) functionDescriptor).getContainingDeclaration());
|
||||
boolean isStatic = isStatic(kind);
|
||||
|
||||
if (kind == OwnerKind.TRAIT_IMPL) {
|
||||
@@ -561,7 +557,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
int flags = ACC_PUBLIC | ACC_SYNTHETIC; // TODO.
|
||||
|
||||
JvmClassName ownerInternalName;
|
||||
if (contextClass instanceof NamespaceDescriptor) {
|
||||
if (DescriptorUtils.isTopLevelDeclaration(owner.getContextDescriptor())) {
|
||||
ownerInternalName = NamespaceCodegen.getJVMClassNameForKotlinNs(DescriptorUtils.getFQName(contextClass).toSafe());
|
||||
}
|
||||
else {
|
||||
@@ -583,7 +579,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
genStubCode(mv);
|
||||
}
|
||||
else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
||||
generateDefaultImpl(owner, state, jvmSignature, functionDescriptor, kind, receiverParameter, hasReceiver, isStatic,
|
||||
generateDefaultImpl(owner, state, jvmSignature, functionDescriptor, kind, receiverParameter, hasReceiver, hasOuter, isStatic,
|
||||
ownerInternalName,
|
||||
isConstructor, mv, iv, loadStrategy);
|
||||
}
|
||||
@@ -596,7 +592,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
FunctionDescriptor functionDescriptor,
|
||||
OwnerKind kind,
|
||||
ReceiverParameterDescriptor receiverParameter,
|
||||
boolean hasReceiver,
|
||||
boolean hasReceiver, boolean hasOuter,
|
||||
boolean aStatic,
|
||||
JvmClassName ownerInternalName,
|
||||
boolean constructor,
|
||||
@@ -606,55 +602,53 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
) {
|
||||
mv.visitCode();
|
||||
|
||||
boolean isEnumConstructor = functionDescriptor instanceof ConstructorDescriptor &&
|
||||
DescriptorUtils.isEnumClass(functionDescriptor.getContainingDeclaration());
|
||||
|
||||
FrameMap frameMap = owner.prepareFrame(state.getTypeMapper());
|
||||
|
||||
if (kind instanceof OwnerKind.StaticDelegateKind) {
|
||||
frameMap.leaveTemp(OBJECT_TYPE);
|
||||
}
|
||||
|
||||
if (hasOuter) {
|
||||
frameMap.enterTemp(OBJECT_TYPE);
|
||||
}
|
||||
|
||||
if (isEnumConstructor) {
|
||||
frameMap.enterTemp(OBJECT_TYPE);
|
||||
frameMap.enterTemp(Type.INT_TYPE);
|
||||
}
|
||||
|
||||
ExpressionCodegen codegen = new ExpressionCodegen(mv, frameMap, jvmSignature.getReturnType(), owner, state);
|
||||
|
||||
int var = 0;
|
||||
if (!aStatic) {
|
||||
var++;
|
||||
}
|
||||
|
||||
Type receiverType;
|
||||
Type receiverType = null;
|
||||
if (hasReceiver) {
|
||||
receiverType = state.getTypeMapper().mapType(receiverParameter.getType());
|
||||
var += receiverType.getSize();
|
||||
}
|
||||
else {
|
||||
receiverType = Type.DOUBLE_TYPE;
|
||||
}
|
||||
|
||||
final int extraInLocalVariablesTable = getSizeOfExplicitArgumentsInLocalVariablesTable(aStatic, hasOuter, isEnumConstructor, receiverType);
|
||||
final int countOfExtraVarsInMethodArgs = getCountOfExplicitArgumentsInMethodArguments(hasOuter, hasReceiver, isEnumConstructor);
|
||||
|
||||
Type[] argTypes = jvmSignature.getArgumentTypes();
|
||||
List<ValueParameterDescriptor> paramDescrs = functionDescriptor.getValueParameters();
|
||||
int paramSizeInLocalVariablesTable = 0;
|
||||
for (int i = 0; i < paramDescrs.size(); i++) {
|
||||
Type argType = argTypes[i + (hasReceiver ? 1 : 0)];
|
||||
Type argType = argTypes[i + countOfExtraVarsInMethodArgs];
|
||||
int size = argType.getSize();
|
||||
frameMap.enter(paramDescrs.get(i), argType);
|
||||
var += size;
|
||||
paramSizeInLocalVariablesTable += size;
|
||||
}
|
||||
|
||||
int maskIndex = var;
|
||||
final int maskIndex = extraInLocalVariablesTable + paramSizeInLocalVariablesTable;
|
||||
|
||||
var = 0;
|
||||
if (!aStatic) {
|
||||
mv.visitVarInsn(ALOAD, var++);
|
||||
}
|
||||
|
||||
if (hasReceiver) {
|
||||
iv.load(var, receiverType);
|
||||
var += receiverType.getSize();
|
||||
}
|
||||
|
||||
int extra = hasReceiver ? 1 : 0;
|
||||
loadExplicitArgumentsOnStack(iv, OBJECT_TYPE, receiverType, ownerInternalName.getAsmType(), aStatic, hasOuter, isEnumConstructor);
|
||||
|
||||
int indexInLocalVariablesTable = extraInLocalVariablesTable;
|
||||
for (int index = 0; index < paramDescrs.size(); index++) {
|
||||
ValueParameterDescriptor parameterDescriptor = paramDescrs.get(index);
|
||||
|
||||
Type t = argTypes[extra + index];
|
||||
Type t = argTypes[countOfExtraVarsInMethodArgs + index];
|
||||
|
||||
if (frameMap.getIndex(parameterDescriptor) < 0) {
|
||||
frameMap.enter(parameterDescriptor, t);
|
||||
@@ -675,8 +669,8 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
iv.mark(loadArg);
|
||||
}
|
||||
|
||||
iv.load(var, t);
|
||||
var += t.getSize();
|
||||
iv.load(indexInLocalVariablesTable, t);
|
||||
indexInLocalVariablesTable += t.getSize();
|
||||
}
|
||||
|
||||
final String internalName = ownerInternalName.getInternalName();
|
||||
@@ -687,7 +681,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
iv.invokeinterface(internalName, jvmSignatureName, jvmSignatureDescriptor);
|
||||
}
|
||||
else {
|
||||
if (!constructor) {
|
||||
if (!constructor && functionDescriptor.getVisibility() != Visibilities.PRIVATE) {
|
||||
iv.invokevirtual(internalName, jvmSignatureName, jvmSignatureDescriptor);
|
||||
}
|
||||
else {
|
||||
@@ -705,6 +699,54 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
mv.visitEnd();
|
||||
}
|
||||
|
||||
private static int getSizeOfExplicitArgumentsInLocalVariablesTable(
|
||||
boolean isStatic,
|
||||
boolean hasOuter,
|
||||
boolean isEnumConstructor,
|
||||
@Nullable Type receiverType
|
||||
) {
|
||||
int result = 0;
|
||||
if (!isStatic) result++;
|
||||
if (receiverType != null) result += receiverType.getSize();
|
||||
if (hasOuter) result++;
|
||||
if (isEnumConstructor) result += 2;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int getCountOfExplicitArgumentsInMethodArguments(
|
||||
boolean hasOuter,
|
||||
boolean hasReceiver,
|
||||
boolean isEnumConstructor
|
||||
) {
|
||||
int result = 0;
|
||||
if (hasReceiver) result++;
|
||||
if (hasOuter) result++;
|
||||
if (isEnumConstructor) result += 2;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void loadExplicitArgumentsOnStack(@NotNull InstructionAdapter iv,
|
||||
@NotNull Type ownerType, @Nullable Type receiverType, @NotNull Type outerType,
|
||||
boolean isStatic, boolean hasOuter, boolean isEnumConstructor) {
|
||||
int var = 0;
|
||||
if (!isStatic) {
|
||||
iv.load(var++, ownerType);
|
||||
}
|
||||
|
||||
if (hasOuter) {
|
||||
iv.load(var++, outerType);
|
||||
}
|
||||
|
||||
if (isEnumConstructor) {
|
||||
iv.load(var++, OBJECT_TYPE);
|
||||
iv.load(var++, Type.INT_TYPE);
|
||||
}
|
||||
|
||||
if (receiverType != null) {
|
||||
iv.load(var, receiverType);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isDefaultNeeded(FunctionDescriptor functionDescriptor) {
|
||||
boolean needed = false;
|
||||
if (functionDescriptor != null) {
|
||||
@@ -718,6 +760,24 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
return needed;
|
||||
}
|
||||
|
||||
private static boolean isDefaultConstructorNeeded(@NotNull BindingContext context, @NotNull ConstructorDescriptor constructorDescriptor) {
|
||||
ClassDescriptor classDescriptor = constructorDescriptor.getContainingDeclaration();
|
||||
|
||||
if (CodegenBinding.canHaveOuter(context, classDescriptor)) return false;
|
||||
|
||||
if (classDescriptor.getVisibility() == Visibilities.PRIVATE ||
|
||||
constructorDescriptor.getVisibility() == Visibilities.PRIVATE) return false;
|
||||
|
||||
if (constructorDescriptor.getValueParameters().isEmpty()) return false;
|
||||
|
||||
for (ValueParameterDescriptor parameterDescriptor : constructorDescriptor.getValueParameters()) {
|
||||
if (!parameterDescriptor.declaresDefaultValue()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean differentMethods(Method method, Method overridden) {
|
||||
if (!method.getReturnType().equals(overridden.getReturnType())) {
|
||||
return true;
|
||||
@@ -743,7 +803,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
||||
FunctionDescriptor functionDescriptor,
|
||||
Method overridden
|
||||
) {
|
||||
int flags = ACC_PUBLIC | ACC_BRIDGE; // TODO.
|
||||
int flags = ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC; // TODO.
|
||||
|
||||
final MethodVisitor mv = v.newMethod(null, flags, jvmSignature.getName(), overridden.getDescriptor(), null, null);
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -21,10 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class GeneratedClassLoader extends URLClassLoader {
|
||||
private ClassFileFactory state;
|
||||
|
||||
@@ -33,8 +29,9 @@ public class GeneratedClassLoader extends URLClassLoader {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
||||
protected Class<?> findClass(@NotNull String name) throws ClassNotFoundException {
|
||||
String file = name.replace('.', '/') + ".class";
|
||||
if (state.files().contains(file)) {
|
||||
byte[] bytes = state.asBytes(file);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -21,10 +21,7 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.AnnotationVisitor;
|
||||
import org.jetbrains.asm4.Label;
|
||||
import org.jetbrains.asm4.MethodVisitor;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.*;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
import org.jetbrains.jet.codegen.binding.CalculatedClosure;
|
||||
@@ -41,16 +38,12 @@ import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapperMode;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.OverridingUtil;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.lang.resolve.java.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.kt.DescriptorKindUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
@@ -66,11 +59,6 @@ import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescrip
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.JAVA_STRING_TYPE;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
private static final String VALUES = "$VALUES";
|
||||
private JetDelegationSpecifier superCall;
|
||||
@@ -112,7 +100,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
isAnnotation = true;
|
||||
signature.getInterfaces().add("java/lang/annotation/Annotation");
|
||||
}
|
||||
else if (jetClass.hasModifier(JetTokens.ENUM_KEYWORD)) {
|
||||
else if (jetClass.isEnum()) {
|
||||
isAbstract = hasAbstractMembers(descriptor);
|
||||
isEnum = true;
|
||||
}
|
||||
|
||||
@@ -123,6 +112,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
if (!jetClass.hasModifier(JetTokens.OPEN_KEYWORD) && !isAbstract) {
|
||||
isFinal = true;
|
||||
}
|
||||
isStatic = !jetClass.isInner();
|
||||
}
|
||||
else {
|
||||
isStatic = myClass.getParent() instanceof JetClassObject;
|
||||
@@ -130,7 +120,21 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
int access = 0;
|
||||
access |= ACC_PUBLIC;
|
||||
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES && !DescriptorUtils.isTopLevelDeclaration(descriptor)) {
|
||||
// ClassBuilderMode.SIGNATURES means we are generating light classes & looking at a nested or inner class
|
||||
// Light class generation is implemented so that Cls-classes only read bare code of classes,
|
||||
// without knowing whether these classes are inner or not (see ClassStubBuilder.EMPTY_STRATEGY)
|
||||
// Thus we must write full accessibility flags on inner classes in this mode
|
||||
access |= getVisibilityAccessFlag(descriptor);
|
||||
// Same for STATIC
|
||||
if (isStatic) {
|
||||
access |= ACC_STATIC;
|
||||
}
|
||||
}
|
||||
else {
|
||||
access |= getVisibilityAccessFlagForClass(descriptor);
|
||||
}
|
||||
if (isAbstract) {
|
||||
access |= ACC_ABSTRACT;
|
||||
}
|
||||
@@ -143,9 +147,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
if (isFinal) {
|
||||
access |= ACC_FINAL;
|
||||
}
|
||||
if (isStatic) {
|
||||
access |= ACC_STATIC;
|
||||
}
|
||||
if (isAnnotation) {
|
||||
access |= ACC_ANNOTATION;
|
||||
}
|
||||
@@ -182,43 +183,74 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
private void writeOuterClass() {
|
||||
ClassDescriptor container = getContainingClassDescriptor(descriptor);
|
||||
//JVMS7: A class must have an EnclosingMethod attribute if and only if it is a local class or an anonymous class.
|
||||
DeclarationDescriptor parentDescriptor = descriptor.getContainingDeclaration();
|
||||
|
||||
boolean isObjectLiteral = descriptor.getName().isSpecial() && descriptor.getKind() == ClassKind.OBJECT;
|
||||
|
||||
boolean isLocalOrAnonymousClass = isObjectLiteral ||
|
||||
!(DescriptorUtils.isTopLevelDeclaration(descriptor) || parentDescriptor instanceof ClassDescriptor);
|
||||
if (isLocalOrAnonymousClass) {
|
||||
String outerClassName = getOuterClassName(descriptor, typeMapper, bindingContext, state);
|
||||
FunctionDescriptor function = DescriptorUtils.getParentOfType(descriptor, FunctionDescriptor.class);
|
||||
|
||||
//Function descriptor could be null only for object literal in package namespace
|
||||
assert (!isObjectLiteral && function != null) || isObjectLiteral:
|
||||
"Function descriptor should be present: " + descriptor.getName();
|
||||
|
||||
Name functionName = function != null ? function.getName() : null;
|
||||
|
||||
v.visitOuterClass(outerClassName,
|
||||
functionName != null ? functionName.getName() : null,
|
||||
functionName != null ? typeMapper.mapSignature(functionName, function).getAsmMethod().getDescriptor() : null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getOuterClassName(
|
||||
@NotNull ClassDescriptor classDescriptor,
|
||||
@NotNull JetTypeMapper typeMapper,
|
||||
@NotNull BindingContext bindingContext,
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
ClassDescriptor container = DescriptorUtils.getParentOfType(classDescriptor, ClassDescriptor.class);
|
||||
if (container != null) {
|
||||
v.visitOuterClass(typeMapper.mapType(container.getDefaultType(), JetTypeMapperMode.IMPL).getInternalName(), null, null);
|
||||
return typeMapper.mapType(container.getDefaultType(), JetTypeMapperMode.IMPL).getInternalName();
|
||||
}
|
||||
else {
|
||||
PackageFragmentDescriptor packageFragmentDescriptor = DescriptorUtils.getParentOfType(classDescriptor, PackageFragmentDescriptor.class);
|
||||
assert packageFragmentDescriptor != null : "Namespace descriptor should be present: " + classDescriptor.getName();
|
||||
FqName namespaceQN = packageFragmentDescriptor.getFqName();
|
||||
|
||||
JetFile containingFile = BindingContextUtils.getContainingFile(bindingContext, classDescriptor);
|
||||
ModuleSourcesManager sourcesManager = state.getModuleSourcesManager();
|
||||
ModuleDescriptor module = sourcesManager.getSubModuleForFile(containingFile).getContainingDeclaration();
|
||||
|
||||
boolean isMultiFile = CodegenBinding.isMultiFileNamespace(sourcesManager, module, namespaceQN);
|
||||
return isMultiFile
|
||||
? NamespaceCodegen.getNamespacePartInternalName(containingFile)
|
||||
: NamespaceCodegen.getJVMClassNameForKotlinNs(namespaceQN).getInternalName();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeInnerClasses() {
|
||||
// Inner enums are moved by frontend to a class object of outer class, but we want them to be inner for the outer class itself
|
||||
// (to avoid publicly visible names like A$ClassObject$$B), so they are handled specially in this method
|
||||
|
||||
for (ClassDescriptor innerClass : getInnerClassesAndObjects(descriptor)) {
|
||||
// If it's an inner enum inside a class object, don't write it
|
||||
// (instead write it to inner classes of this class object's containing class)
|
||||
if (!isEnumMovedToClassObject(innerClass)) {
|
||||
writeInnerClass(innerClass, false);
|
||||
}
|
||||
writeInnerClass(innerClass);
|
||||
}
|
||||
|
||||
ClassDescriptor classObjectDescriptor = descriptor.getClassObjectDescriptor();
|
||||
if (classObjectDescriptor != null) {
|
||||
// Process all enums here which were moved to our class object
|
||||
for (ClassDescriptor innerClass : getInnerClassesAndObjects(classObjectDescriptor)) {
|
||||
if (isEnumMovedToClassObject(innerClass)) {
|
||||
writeInnerClass(innerClass, true);
|
||||
}
|
||||
}
|
||||
|
||||
int innerClassAccess = ACC_PUBLIC | ACC_FINAL | ACC_STATIC;
|
||||
int innerClassAccess = getVisibilityAccessFlag(classObjectDescriptor) | ACC_FINAL | ACC_STATIC;
|
||||
v.visitInnerClass(classAsmType.getInternalName() + JvmAbi.CLASS_OBJECT_SUFFIX, classAsmType.getInternalName(),
|
||||
JvmAbi.CLASS_OBJECT_CLASS_NAME,
|
||||
innerClassAccess);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeInnerClass(ClassDescriptor innerClass, boolean isStatic) {
|
||||
private void writeInnerClass(ClassDescriptor innerClass) {
|
||||
// TODO: proper access
|
||||
int innerClassAccess = ACC_PUBLIC;
|
||||
int innerClassAccess = getVisibilityAccessFlag(innerClass);
|
||||
if (innerClass.getModality() == Modality.FINAL) {
|
||||
innerClassAccess |= ACC_FINAL;
|
||||
}
|
||||
@@ -233,7 +265,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
innerClassAccess |= ACC_ENUM;
|
||||
}
|
||||
|
||||
if (isStatic) {
|
||||
if (!innerClass.isInner()) {
|
||||
innerClassAccess |= ACC_STATIC;
|
||||
}
|
||||
|
||||
@@ -243,32 +275,20 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
v.visitInnerClass(innerClassInternalName, outerClassInternalName, innerClass.getName().getName(), innerClassAccess);
|
||||
}
|
||||
|
||||
private boolean isEnumMovedToClassObject(ClassDescriptor innerClass) {
|
||||
// Checks if this is enum, moved to class object by frontend
|
||||
|
||||
return Boolean.TRUE.equals(bindingContext.get(BindingContext.IS_ENUM_MOVED_TO_CLASS_OBJECT, innerClass));
|
||||
}
|
||||
|
||||
private void writeClassSignatureIfNeeded(JvmClassSignature signature) {
|
||||
if (signature.getKotlinGenericSignature() != null || descriptor.getVisibility() != Visibilities.PUBLIC) {
|
||||
AnnotationVisitor annotationVisitor = v.newAnnotation(JvmStdlibNames.JET_CLASS.getDescriptor(), true);
|
||||
annotationVisitor.visit(JvmStdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature());
|
||||
int flags = getFlagsForVisibility(descriptor.getVisibility()) | getFlagsForClassKind(descriptor);
|
||||
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flags) {
|
||||
annotationVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flags);
|
||||
}
|
||||
annotationVisitor.visitEnd();
|
||||
AnnotationVisitor annotationVisitor = v.newAnnotation(JvmStdlibNames.JET_CLASS.getDescriptor(), true);
|
||||
annotationVisitor.visit(JvmStdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature());
|
||||
int flags = getFlagsForVisibility(descriptor.getVisibility()) | getFlagsForClassKind(descriptor);
|
||||
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flags) {
|
||||
annotationVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flags);
|
||||
}
|
||||
}
|
||||
annotationVisitor.visit(JvmStdlibNames.ABI_VERSION_NAME, JvmAbi.VERSION);
|
||||
annotationVisitor.visitEnd();
|
||||
|
||||
@Nullable
|
||||
private static ClassDescriptor getContainingClassDescriptor(ClassDescriptor decl) {
|
||||
DeclarationDescriptor container = decl.getContainingDeclaration();
|
||||
while (container != null && !(container instanceof NamespaceDescriptor)) {
|
||||
if (container instanceof ClassDescriptor) return (ClassDescriptor) container;
|
||||
container = container.getContainingDeclaration();
|
||||
if (descriptor.getKind() == ClassKind.CLASS_OBJECT) {
|
||||
AnnotationVisitor classObjectVisitor = v.newAnnotation(JvmStdlibNames.JET_CLASS_OBJECT.getDescriptor(), true);
|
||||
classObjectVisitor.visitEnd();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JvmClassSignature signature() {
|
||||
@@ -320,7 +340,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
signatureVisitor.writeSupersEnd();
|
||||
|
||||
return new JvmClassSignature(jvmName(), superClassAsmType.getInternalName(), superInterfaces, signatureVisitor.makeJavaString(),
|
||||
return new JvmClassSignature(jvmName(), superClassAsmType.getInternalName(), superInterfaces, signatureVisitor.makeJavaGenericSignature(),
|
||||
signatureVisitor.makeKotlinClassSignature());
|
||||
}
|
||||
|
||||
@@ -477,8 +497,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
iv.store(2, AsmTypeConstants.OBJECT_TYPE);
|
||||
|
||||
for (PropertyDescriptor propertyDescriptor : properties) {
|
||||
final JetType type = propertyDescriptor.getType();
|
||||
final Type asmType = typeMapper.mapType(type);
|
||||
Type asmType = typeMapper.mapType(propertyDescriptor.getType());
|
||||
|
||||
genPropertyOnStack(iv, propertyDescriptor, 0);
|
||||
genPropertyOnStack(iv, propertyDescriptor, 2);
|
||||
@@ -493,8 +512,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
}
|
||||
else {
|
||||
final StackValue value =
|
||||
genEqualsForExpressionsOnStack(iv, JetTokens.EQEQ, asmType, asmType, type.isNullable(), type.isNullable());
|
||||
StackValue value = genEqualsForExpressionsOnStack(iv, JetTokens.EQEQ, asmType, asmType);
|
||||
value.put(Type.BOOLEAN_TYPE, iv);
|
||||
}
|
||||
|
||||
@@ -527,14 +545,14 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
genPropertyOnStack(iv, propertyDescriptor, 0);
|
||||
|
||||
Label ifNull = null;
|
||||
if (propertyDescriptor.getType().isNullable()) {
|
||||
Type asmType = typeMapper.mapType(propertyDescriptor.getType());
|
||||
if (!isPrimitive(asmType)) {
|
||||
ifNull = new Label();
|
||||
|
||||
iv.dup();
|
||||
iv.ifnull(ifNull);
|
||||
}
|
||||
|
||||
genHashCode(mv, iv, typeMapper.mapType(propertyDescriptor.getType()));
|
||||
genHashCode(mv, iv, asmType);
|
||||
|
||||
if (ifNull != null) {
|
||||
Label end = new Label();
|
||||
@@ -632,7 +650,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
final String desc = "()" + componentType.getDescriptor();
|
||||
MethodVisitor mv = v.newMethod(myClass,
|
||||
FunctionCodegen.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
|
||||
AsmUtil.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
|
||||
function.getName().getName(),
|
||||
desc,
|
||||
null, null);
|
||||
@@ -657,7 +675,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
JvmMethodSignature methodSignature = typeMapper.mapSignature(function.getName(), function);
|
||||
final String methodDesc = methodSignature.getAsmMethod().getDescriptor();
|
||||
|
||||
MethodVisitor mv = v.newMethod(myClass, FunctionCodegen.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
|
||||
MethodVisitor mv = v.newMethod(myClass, AsmUtil.getMethodAsmFlags(function, OwnerKind.IMPLEMENTATION),
|
||||
function.getName().getName(), methodDesc,
|
||||
null, null);
|
||||
|
||||
@@ -900,14 +918,22 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
private void generateFieldForSingleton() {
|
||||
if (!(isNonLiteralObject(myClass) || descriptor.getKind() == ClassKind.CLASS_OBJECT)) return;
|
||||
boolean hasClassObject = descriptor.getClassObjectDescriptor() != null;
|
||||
boolean isEnumClass = DescriptorUtils.isEnumClass(descriptor);
|
||||
|
||||
v.newField(myClass, ACC_PUBLIC | ACC_STATIC | ACC_FINAL, JvmAbi.INSTANCE_FIELD, classAsmType.getDescriptor(), null, null);
|
||||
if (!(isNonLiteralObject(myClass) || hasClassObject) || isEnumClass) return;
|
||||
|
||||
ClassDescriptor fieldTypeDescriptor = hasClassObject ? descriptor.getClassObjectDescriptor() : descriptor;
|
||||
assert fieldTypeDescriptor != null;
|
||||
final FieldInfo info = FieldInfo.createForSingleton(fieldTypeDescriptor, typeMapper);
|
||||
JetClassOrObject original = hasClassObject ? ((JetClass)myClass).getClassObject().getObjectDeclaration() : myClass;
|
||||
|
||||
v.newField(original, ACC_PUBLIC | ACC_STATIC | ACC_FINAL, info.getFieldName(), info.getFieldType().getDescriptor(), null, null);
|
||||
|
||||
staticInitializerChunks.add(new CodeChunk() {
|
||||
@Override
|
||||
public void generate(InstructionAdapter iv) {
|
||||
genInitSingletonField(classAsmType, iv);
|
||||
genInitSingletonField(info, iv);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -934,30 +960,34 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
final JvmMethodSignature constructorMethod = callableMethod.getSignature();
|
||||
|
||||
assert constructorDescriptor != null;
|
||||
int flags = getVisibilityAccessFlag(constructorDescriptor);
|
||||
int flags = getConstructorAsmFlags(constructorDescriptor);
|
||||
final MethodVisitor mv = v.newMethod(myClass, flags, constructorMethod.getName(), constructorMethod.getAsmMethod().getDescriptor(),
|
||||
constructorMethod.getGenericsSignature(), null);
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES) return;
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.SIGNATURES) {
|
||||
|
||||
AnnotationVisitor jetConstructorVisitor = mv.visitAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getDescriptor(), true);
|
||||
AnnotationVisitor jetConstructorVisitor = mv.visitAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getDescriptor(), true);
|
||||
|
||||
int flagsValue = getFlagsForVisibility(constructorDescriptor.getVisibility());
|
||||
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flagsValue) {
|
||||
jetConstructorVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flagsValue);
|
||||
int flagsValue = getFlagsForVisibility(constructorDescriptor.getVisibility());
|
||||
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flagsValue) {
|
||||
jetConstructorVisitor.visit(JvmStdlibNames.JET_FLAGS_FIELD, flagsValue);
|
||||
}
|
||||
|
||||
jetConstructorVisitor.visitEnd();
|
||||
|
||||
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(constructorDescriptor);
|
||||
|
||||
writeParameterAnnotations(constructorDescriptor, constructorMethod, hasCapturedThis, mv);
|
||||
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
|
||||
genStubCode(mv);
|
||||
return;
|
||||
}
|
||||
|
||||
generatePrimaryConstructorImpl(constructorDescriptor, constructorContext, constructorMethod, callableMethod, hasCapturedThis,
|
||||
closure, mv);
|
||||
}
|
||||
|
||||
jetConstructorVisitor.visitEnd();
|
||||
|
||||
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(constructorDescriptor);
|
||||
|
||||
writeParameterAnnotations(constructorDescriptor, constructorMethod, hasCapturedThis, mv);
|
||||
|
||||
if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
|
||||
genStubCode(mv);
|
||||
return;
|
||||
}
|
||||
|
||||
generatePrimaryConstructorImpl(constructorDescriptor, constructorContext, constructorMethod, callableMethod, hasCapturedThis, closure, mv);
|
||||
FunctionCodegen.generateConstructorWithoutParametersIfNeeded(state, callableMethod, constructorDescriptor, v);
|
||||
}
|
||||
|
||||
private void generatePrimaryConstructorImpl(
|
||||
@@ -1008,7 +1038,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
if (captureReceiver != null) {
|
||||
iv.load(0, OBJECT_TYPE);
|
||||
final Type asmType = typeMapper.mapType(captureReceiver.getDefaultType(), JetTypeMapperMode.IMPL);
|
||||
iv.load(1, asmType);
|
||||
iv.load(k, asmType);
|
||||
iv.putfield(internalName, CAPTURED_RECEIVER_FIELD, asmType.getDescriptor());
|
||||
k += asmType.getSize();
|
||||
}
|
||||
@@ -1114,6 +1144,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
JetValueParameterAnnotationWriter.visitParameterAnnotation(mv, i);
|
||||
jetValueParameterAnnotation.writeName(valueParameter.getName().getName());
|
||||
jetValueParameterAnnotation.writeHasDefaultValue(valueParameter.declaresDefaultValue());
|
||||
jetValueParameterAnnotation.writeVararg(valueParameter.getVarargElementType() != null);
|
||||
jetValueParameterAnnotation.writeType(constructorMethod.getKotlinParameterType(i));
|
||||
jetValueParameterAnnotation.visitEnd();
|
||||
++i;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -14,13 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.codegen.state;
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||
import org.jetbrains.jet.codegen.NamespaceCodegen;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
@@ -35,25 +34,11 @@ import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.registerClassNameForScript;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class GenerationStrategy {
|
||||
public static final GenerationStrategy STANDARD = new GenerationStrategy();
|
||||
|
||||
protected GenerationStrategy () {
|
||||
}
|
||||
|
||||
public void generateNamespace(GenerationState state,
|
||||
FqName fqName,
|
||||
Collection<JetFile> jetFiles,
|
||||
CompilationErrorHandler errorHandler
|
||||
public class KotlinCodegenFacade {
|
||||
public static void compileCorrectFiles(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull CompilationErrorHandler errorHandler
|
||||
) {
|
||||
NamespaceCodegen codegen = state.getFactory().forNamespace(fqName, jetFiles);
|
||||
codegen.generate(errorHandler, state.getProgress());
|
||||
}
|
||||
|
||||
public final void compileCorrectFiles(GenerationState state, @NotNull CompilationErrorHandler errorHandler) {
|
||||
for (JetFile file : state.getFiles()) {
|
||||
if (file.isScript()) {
|
||||
String name = ScriptNameUtil.classNameForScript(file);
|
||||
@@ -77,4 +62,16 @@ public class GenerationStrategy {
|
||||
generateNamespace(state, entry.getKey(), entry.getValue(), errorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public static void generateNamespace(
|
||||
@NotNull GenerationState state,
|
||||
@NotNull FqName fqName,
|
||||
@NotNull Collection<JetFile> jetFiles,
|
||||
@NotNull CompilationErrorHandler errorHandler
|
||||
) {
|
||||
NamespaceCodegen codegen = state.getFactory().forNamespace(fqName, jetFiles);
|
||||
codegen.generate(errorHandler);
|
||||
}
|
||||
|
||||
private KotlinCodegenFacade() {}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -30,9 +30,6 @@ import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.enumEntryNeedSubclass;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class MemberCodegen extends GenerationStateAware {
|
||||
public MemberCodegen(@NotNull GenerationState state) {
|
||||
super(state);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -22,39 +22,41 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.asm4.AnnotationVisitor;
|
||||
import org.jetbrains.asm4.MethodVisitor;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.jet.codegen.binding.CodegenBinding;
|
||||
import org.jetbrains.jet.codegen.context.CodegenContext;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SubModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.codegen.state.Progress;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.jetbrains.asm4.Opcodes.*;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class NamespaceCodegen extends MemberCodegen {
|
||||
@NotNull
|
||||
private final ClassBuilderOnDemand v;
|
||||
@NotNull private final FqName name;
|
||||
private final SubModuleDescriptor subModule;
|
||||
private final Collection<JetFile> files;
|
||||
|
||||
public NamespaceCodegen(
|
||||
@NotNull ClassBuilderOnDemand v,
|
||||
@NotNull SubModuleDescriptor subModule,
|
||||
@NotNull final FqName fqName,
|
||||
GenerationState state,
|
||||
Collection<JetFile> namespaceFiles
|
||||
@@ -63,35 +65,43 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
checkAllFilesHaveSameNamespace(namespaceFiles);
|
||||
|
||||
this.v = v;
|
||||
this.subModule = subModule;
|
||||
name = fqName;
|
||||
this.files = namespaceFiles;
|
||||
|
||||
final PsiFile sourceFile = namespaceFiles.iterator().next().getContainingFile();
|
||||
final PsiFile sourceFile = namespaceFiles.size() == 1 ? namespaceFiles.iterator().next().getContainingFile() : null;
|
||||
|
||||
v.addOptionalDeclaration(new ClassBuilderOnDemand.ClassBuilderCallback() {
|
||||
@Override
|
||||
public void doSomething(@NotNull ClassBuilder v) {
|
||||
v.defineClass(sourceFile, V1_6,
|
||||
ACC_PUBLIC/*|ACC_SUPER*/,
|
||||
ACC_PUBLIC | ACC_FINAL,
|
||||
getJVMClassNameForKotlinNs(fqName).getInternalName(),
|
||||
null,
|
||||
//"jet/lang/Namespace",
|
||||
"java/lang/Object",
|
||||
new String[0]
|
||||
);
|
||||
// TODO figure something out for a namespace that spans multiple files
|
||||
v.visitSource(sourceFile.getName(), null);
|
||||
//We don't generate any source information for namespace with multiple files
|
||||
if (sourceFile != null) {
|
||||
v.visitSource(sourceFile.getName(), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void generate(CompilationErrorHandler errorHandler, final Progress progress) {
|
||||
boolean multiFile = CodegenBinding.isMultiFileNamespace(state.getBindingContext(), name);
|
||||
public void generate(CompilationErrorHandler errorHandler) {
|
||||
boolean multiFile = CodegenBinding.isMultiFileNamespace(state.getModuleSourcesManager(), subModule.getContainingDeclaration(), name);
|
||||
|
||||
if (shouldGenerateNSClass(files)) {
|
||||
AnnotationVisitor packageClassAnnotation = v.getClassBuilder().newAnnotation(JvmStdlibNames.JET_PACKAGE_CLASS.getDescriptor(), true);
|
||||
packageClassAnnotation.visit(JvmStdlibNames.ABI_VERSION_NAME, JvmAbi.VERSION);
|
||||
packageClassAnnotation.visitEnd();
|
||||
}
|
||||
|
||||
for (JetFile file : files) {
|
||||
VirtualFile vFile = file.getVirtualFile();
|
||||
try {
|
||||
final String path = vFile != null ? vFile.getPath() : "no_virtual_file/" + file.getName();
|
||||
generate(file, multiFile);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
@@ -115,7 +125,8 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
}
|
||||
|
||||
private void generate(JetFile file, boolean multiFile) {
|
||||
NamespaceDescriptor descriptor = state.getBindingContext().get(BindingContext.FILE_TO_NAMESPACE, file);
|
||||
PackageViewDescriptor descriptor = subModule.getPackageView(JetPsiUtil.getFQName(file));
|
||||
assert descriptor != null : "No namespace found for file " + file + " declared package: " + file.getPackageName();
|
||||
for (JetDeclaration declaration : file.getDeclarations()) {
|
||||
if (declaration instanceof JetProperty) {
|
||||
final CodegenContext context = CodegenContext.STATIC.intoNamespace(descriptor);
|
||||
@@ -128,8 +139,9 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
}
|
||||
}
|
||||
else if (declaration instanceof JetClassOrObject) {
|
||||
final CodegenContext context = CodegenContext.STATIC.intoNamespace(descriptor);
|
||||
genClassOrObject(context, (JetClassOrObject) declaration);
|
||||
if (state.isGenerateDeclaredClasses()) {
|
||||
generateClassOrObject(descriptor, (JetClassOrObject) declaration);
|
||||
}
|
||||
}
|
||||
else if (declaration instanceof JetScript) {
|
||||
state.getScriptCodegen().generate((JetScript) declaration);
|
||||
@@ -145,12 +157,13 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
}
|
||||
|
||||
if (k > 0) {
|
||||
String namespaceInternalName = JvmClassName.byFqNameWithoutInnerClasses(name.child(Name.identifier(JvmAbi.PACKAGE_CLASS))).getInternalName();
|
||||
String namespaceInternalName = JvmClassName.byFqNameWithoutInnerClasses(
|
||||
PackageClassUtils.getPackageClassFqName(name)).getInternalName();
|
||||
String className = getMultiFileNamespaceInternalName(namespaceInternalName, file);
|
||||
ClassBuilder builder = state.getFactory().forNamespacepart(className, file);
|
||||
|
||||
builder.defineClass(file, V1_6,
|
||||
ACC_PUBLIC/*|ACC_SUPER*/,
|
||||
ACC_PUBLIC | ACC_FINAL,
|
||||
className,
|
||||
null,
|
||||
//"jet/lang/Namespace",
|
||||
@@ -179,6 +192,11 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
public void generateClassOrObject(@NotNull PackageViewDescriptor descriptor, @NotNull JetClassOrObject classOrObject) {
|
||||
CodegenContext context = CodegenContext.STATIC.intoNamespace(descriptor);
|
||||
genClassOrObject(context, classOrObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param namespaceFiles all files should have same package name
|
||||
* @return
|
||||
@@ -269,11 +287,12 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
|
||||
@NotNull
|
||||
public static JvmClassName getJVMClassNameForKotlinNs(@NotNull FqName fqName) {
|
||||
String packageClassName = PackageClassUtils.getPackageClassName(fqName);
|
||||
if (fqName.isRoot()) {
|
||||
return JvmClassName.byInternalName(JvmAbi.PACKAGE_CLASS);
|
||||
return JvmClassName.byInternalName(packageClassName);
|
||||
}
|
||||
|
||||
return JvmClassName.byFqNameWithoutInnerClasses(fqName.child(Name.identifier(JvmAbi.PACKAGE_CLASS)));
|
||||
return JvmClassName.byFqNameWithoutInnerClasses(fqName.child(Name.identifier(packageClassName)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class OwnerKind {
|
||||
private final String name;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -46,10 +46,6 @@ import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDec
|
||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isExternallyAccessible;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class PropertyCodegen extends GenerationStateAware {
|
||||
private final FunctionCodegen functionCodegen;
|
||||
private final ClassBuilder v;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -22,32 +22,39 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.lang.types.lang.PrimitiveType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.isPrimitiveNumberClassDescriptor;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class RangeCodegenUtil {
|
||||
private static final ImmutableMap<String, JetType> RANGE_TO_ELEMENT_TYPE = ImmutableMap.<String, JetType>builder()
|
||||
.put("ByteRange", KotlinBuiltIns.getInstance().getByteType())
|
||||
.put("ShortRange", KotlinBuiltIns.getInstance().getShortType())
|
||||
.put("IntRange", KotlinBuiltIns.getInstance().getIntType())
|
||||
.put("LongRange", KotlinBuiltIns.getInstance().getLongType())
|
||||
.put("FloatRange", KotlinBuiltIns.getInstance().getFloatType())
|
||||
.put("DoubleRange", KotlinBuiltIns.getInstance().getDoubleType())
|
||||
.put("CharRange", KotlinBuiltIns.getInstance().getCharType())
|
||||
.build();
|
||||
private static final ImmutableMap<FqName, PrimitiveType> RANGE_TO_ELEMENT_TYPE;
|
||||
private static final ImmutableMap<FqName, PrimitiveType> PROGRESSION_TO_ELEMENT_TYPE;
|
||||
|
||||
static {
|
||||
ImmutableMap.Builder<FqName, PrimitiveType> rangeBuilder = ImmutableMap.builder();
|
||||
ImmutableMap.Builder<FqName, PrimitiveType> progressionBuilder = ImmutableMap.builder();
|
||||
for (PrimitiveType primitiveType : PrimitiveType.values()) {
|
||||
rangeBuilder.put(primitiveType.getRangeClassName(), primitiveType);
|
||||
progressionBuilder.put(primitiveType.getProgressionClassName(), primitiveType);
|
||||
}
|
||||
RANGE_TO_ELEMENT_TYPE = rangeBuilder.build();
|
||||
PROGRESSION_TO_ELEMENT_TYPE = progressionBuilder.build();
|
||||
}
|
||||
|
||||
private RangeCodegenUtil() {}
|
||||
|
||||
public static boolean isIntRange(JetType rangeType) {
|
||||
return !rangeType.isNullable()
|
||||
&& KotlinBuiltIns.getInstance().getIntType().equals(getPrimitiveRangeElementType(rangeType));
|
||||
public static boolean isRange(JetType rangeType) {
|
||||
return !rangeType.isNullable() && getPrimitiveRangeElementType(rangeType) != null;
|
||||
}
|
||||
|
||||
public static boolean isProgression(JetType rangeType) {
|
||||
return !rangeType.isNullable() && getPrimitiveProgressionElementType(rangeType) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -81,14 +88,27 @@ public class RangeCodegenUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JetType getPrimitiveRangeElementType(JetType rangeType) {
|
||||
ClassifierDescriptor declarationDescriptor = rangeType.getConstructor().getDeclarationDescriptor();
|
||||
private static PrimitiveType getPrimitiveRangeElementType(JetType rangeType) {
|
||||
return getPrimitiveRangeOrProgressionElementType(rangeType, RANGE_TO_ELEMENT_TYPE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PrimitiveType getPrimitiveProgressionElementType(JetType rangeType) {
|
||||
return getPrimitiveRangeOrProgressionElementType(rangeType, PROGRESSION_TO_ELEMENT_TYPE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PrimitiveType getPrimitiveRangeOrProgressionElementType(
|
||||
@NotNull JetType rangeOrProgression,
|
||||
@NotNull ImmutableMap<FqName, PrimitiveType> map
|
||||
) {
|
||||
ClassifierDescriptor declarationDescriptor = rangeOrProgression.getConstructor().getDeclarationDescriptor();
|
||||
assert declarationDescriptor != null;
|
||||
if (declarationDescriptor != KotlinBuiltIns.getInstance().getBuiltInsScope().getClassifier(declarationDescriptor.getName())) {
|
||||
// Must be a standard library class
|
||||
return null;
|
||||
}
|
||||
return RANGE_TO_ELEMENT_TYPE.get(declarationDescriptor.getName().getName());
|
||||
return map.get(DescriptorUtils.getFQName(declarationDescriptor).toSafe());
|
||||
}
|
||||
|
||||
public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -27,7 +27,6 @@ import org.jetbrains.jet.codegen.context.CodegenContext;
|
||||
import org.jetbrains.jet.codegen.context.ScriptContext;
|
||||
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.GenerationStrategy;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
@@ -44,9 +43,6 @@ import static org.jetbrains.asm4.Opcodes.*;
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.*;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class ScriptCodegen extends MemberCodegen {
|
||||
|
||||
@NotNull
|
||||
@@ -254,7 +250,7 @@ public class ScriptCodegen extends MemberCodegen {
|
||||
registerClassNameForScript(state.getBindingTrace(), script, className);
|
||||
|
||||
state.beforeCompile();
|
||||
GenerationStrategy.STANDARD.generateNamespace(
|
||||
KotlinCodegenFacade.generateNamespace(
|
||||
state,
|
||||
JetPsiUtil.getFQName((JetFile) script.getContainingFile()),
|
||||
Collections.singleton((JetFile) script.getContainingFile()),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -23,14 +23,12 @@ import org.jetbrains.asm4.Label;
|
||||
import org.jetbrains.asm4.Type;
|
||||
import org.jetbrains.asm4.commons.InstructionAdapter;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
import org.jetbrains.jet.codegen.binding.CodegenBinding;
|
||||
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethod;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue;
|
||||
@@ -42,10 +40,6 @@ import static org.jetbrains.asm4.Opcodes.*;
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.*;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public abstract class StackValue {
|
||||
@NotNull
|
||||
public final Type type;
|
||||
@@ -134,7 +128,8 @@ public abstract class StackValue {
|
||||
return new CollectionElement(type, getter, setter, codegen, state);
|
||||
}
|
||||
|
||||
public static StackValue field(Type type, JvmClassName owner, String name, boolean isStatic) {
|
||||
@NotNull
|
||||
public static StackValue field(@NotNull Type type, @NotNull JvmClassName owner, @NotNull String name, boolean isStatic) {
|
||||
return new Field(type, owner, name, isStatic);
|
||||
}
|
||||
|
||||
@@ -235,42 +230,35 @@ public abstract class StackValue {
|
||||
public static void coerce(Type fromType, Type toType, InstructionAdapter v) {
|
||||
if (toType.equals(fromType)) return;
|
||||
|
||||
if (toType.getSort() == Type.VOID && fromType.getSort() != Type.VOID) {
|
||||
if (toType.getSort() == Type.VOID) {
|
||||
pop(fromType, v);
|
||||
}
|
||||
else if (toType.getSort() != Type.VOID && fromType.getSort() == Type.VOID) {
|
||||
else if (fromType.getSort() == Type.VOID) {
|
||||
if (toType.getSort() == Type.OBJECT) {
|
||||
putTuple0Instance(v);
|
||||
}
|
||||
else if (toType == Type.LONG_TYPE) {
|
||||
v.lconst(0);
|
||||
}
|
||||
else if (toType == Type.FLOAT_TYPE) {
|
||||
v.fconst(0);
|
||||
}
|
||||
else if (toType == Type.DOUBLE_TYPE) {
|
||||
v.dconst(0);
|
||||
}
|
||||
else {
|
||||
v.iconst(0);
|
||||
pushDefaultPrimitiveValueOnStack(toType, v);
|
||||
}
|
||||
}
|
||||
else if (toType.equals(JET_TUPLE0_TYPE) && !fromType.equals(JET_TUPLE0_TYPE)) {
|
||||
else if (toType.equals(JET_TUPLE0_TYPE)) {
|
||||
pop(fromType, v);
|
||||
putTuple0Instance(v);
|
||||
}
|
||||
else if (toType.getSort() == Type.OBJECT && fromType.equals(OBJECT_TYPE) || toType.getSort() == Type.ARRAY) {
|
||||
else if (toType.getSort() == Type.ARRAY) {
|
||||
v.checkcast(toType);
|
||||
}
|
||||
else if (toType.getSort() == Type.OBJECT) {
|
||||
if (fromType.getSort() == Type.OBJECT && !toType.equals(OBJECT_TYPE)) {
|
||||
v.checkcast(toType);
|
||||
if (fromType.getSort() == Type.OBJECT || fromType.getSort() == Type.ARRAY) {
|
||||
if (!toType.equals(OBJECT_TYPE)) {
|
||||
v.checkcast(toType);
|
||||
}
|
||||
}
|
||||
else {
|
||||
box(fromType, toType, v);
|
||||
}
|
||||
}
|
||||
else if (fromType.getSort() == Type.OBJECT && toType.getSort() <= Type.DOUBLE) {
|
||||
else if (fromType.getSort() == Type.OBJECT) {
|
||||
if (toType.getSort() == Type.BOOLEAN) {
|
||||
coerce(fromType, JvmPrimitiveType.BOOLEAN.getWrapper().getAsmType(), v);
|
||||
}
|
||||
@@ -351,20 +339,8 @@ public abstract class StackValue {
|
||||
}
|
||||
|
||||
public static StackValue singleton(ClassDescriptor classDescriptor, JetTypeMapper typeMapper) {
|
||||
final Type type = typeMapper.mapType(classDescriptor.getDefaultType());
|
||||
|
||||
final ClassKind kind = classDescriptor.getKind();
|
||||
if (kind == ClassKind.CLASS_OBJECT || kind == ClassKind.OBJECT) {
|
||||
return field(type, JvmClassName.byInternalName(type.getInternalName()), JvmAbi.INSTANCE_FIELD, true);
|
||||
}
|
||||
else if (kind == ClassKind.ENUM_ENTRY) {
|
||||
final JvmClassName owner = typeMapper.getBindingContext()
|
||||
.get(CodegenBinding.FQN, classDescriptor.getContainingDeclaration().getContainingDeclaration());
|
||||
return field(type, owner, classDescriptor.getName().getName(), true);
|
||||
}
|
||||
else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
FieldInfo info = FieldInfo.createForSingleton(classDescriptor, typeMapper);
|
||||
return field(info.getFieldType(), JvmClassName.byInternalName(info.getOwnerInternalName()), info.getFieldName(), true);
|
||||
}
|
||||
|
||||
private static class None extends StackValue {
|
||||
@@ -488,20 +464,8 @@ public abstract class StackValue {
|
||||
|
||||
@Override
|
||||
public void put(Type type, InstructionAdapter v) {
|
||||
if (type == Type.VOID_TYPE) {
|
||||
return;
|
||||
}
|
||||
if (type.equals(JET_TUPLE0_TYPE)) {
|
||||
putTuple0Instance(v);
|
||||
return;
|
||||
}
|
||||
if (type != Type.BOOLEAN_TYPE && !type.equals(OBJECT_TYPE) && !type.equals(getType(Boolean.class))) {
|
||||
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type " + type);
|
||||
}
|
||||
putAsBoolean(v);
|
||||
if (type != Type.BOOLEAN_TYPE) {
|
||||
box(Type.BOOLEAN_TYPE, type, v);
|
||||
}
|
||||
coerceTo(type, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -580,17 +544,8 @@ public abstract class StackValue {
|
||||
|
||||
@Override
|
||||
public void put(Type type, InstructionAdapter v) {
|
||||
if (type == Type.VOID_TYPE) {
|
||||
myOperand.put(type, v); // the operand will remove itself from the stack if needed
|
||||
return;
|
||||
}
|
||||
if (type != Type.BOOLEAN_TYPE && !type.equals(OBJECT_TYPE) && !type.equals(getType(Boolean.class))) {
|
||||
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type");
|
||||
}
|
||||
putAsBoolean(v);
|
||||
if (type != Type.BOOLEAN_TYPE) {
|
||||
box(Type.BOOLEAN_TYPE, type, v);
|
||||
}
|
||||
coerceTo(type, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1062,7 +1017,7 @@ public abstract class StackValue {
|
||||
public void store(Type topOfStackType, InstructionAdapter v) {
|
||||
coerceFrom(topOfStackType, v);
|
||||
v.load(index, OBJECT_TYPE);
|
||||
v.swap();
|
||||
AsmUtil.swap(v, sharedTypeForType(this.type), topOfStackType);
|
||||
Type refType = refType(this.type);
|
||||
Type sharedType = sharedTypeForType(this.type);
|
||||
v.visitFieldInsn(PUTFIELD, sharedType.getInternalName(), "ref", refType.getDescriptor());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -19,9 +19,6 @@ package org.jetbrains.jet.codegen.binding;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class BindingContextAware {
|
||||
@NotNull protected final BindingContext bindingContext;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -19,9 +19,6 @@ package org.jetbrains.jet.codegen.binding;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class BindingTraceAware extends BindingContextAware {
|
||||
@NotNull protected final BindingTrace bindingTrace;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -29,9 +29,6 @@ import org.jetbrains.jet.lang.psi.JetDelegatorToSuperCall;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public interface CalculatedClosure {
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -19,11 +19,15 @@ package org.jetbrains.jet.codegen.binding;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
@@ -36,9 +40,6 @@ import static org.jetbrains.jet.codegen.CodegenUtil.peekFromStack;
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.*;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
private final Map<String, Integer> anonymousSubclassesCount = new HashMap<String, Integer>();
|
||||
|
||||
@@ -67,7 +68,9 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
Collections.singleton((funDescriptor.getReceiverParameter() != null
|
||||
? KotlinBuiltIns.getInstance().getExtensionFunction(arity)
|
||||
: KotlinBuiltIns.getInstance().getFunction(arity)).getDefaultType()), JetScope.EMPTY,
|
||||
Collections.<ConstructorDescriptor>emptySet(), null);
|
||||
Collections.<ConstructorDescriptor>emptySet(),
|
||||
null,
|
||||
false);
|
||||
|
||||
assert PsiCodegenPredictor.checkPredictedClassNameForFun(bindingContext, funDescriptor, classDescriptor);
|
||||
bindingTrace.record(CLASS_FOR_FUNCTION, funDescriptor, classDescriptor);
|
||||
@@ -195,8 +198,8 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
|
||||
private String getName(ClassDescriptor classDescriptor) {
|
||||
String base = peekFromStack(nameStack);
|
||||
return classDescriptor.getContainingDeclaration() instanceof NamespaceDescriptor ? base.isEmpty() ? classDescriptor.getName()
|
||||
.getName() : base + '/' + classDescriptor.getName() : base + '$' + classDescriptor.getName();
|
||||
return DescriptorUtils.isTopLevelDeclaration(classDescriptor) ? base.isEmpty() ? classDescriptor.getName()
|
||||
.getName() : base + '/' + classDescriptor.getName() : base + '$' + classDescriptor.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -256,13 +259,15 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
super.visitNamedFunction(function);
|
||||
nameStack.pop();
|
||||
}
|
||||
else if (containingDeclaration instanceof NamespaceDescriptor) {
|
||||
else if (DescriptorUtils.isTopLevelDeclaration(functionDescriptor)) {
|
||||
String peek = peekFromStack(nameStack);
|
||||
FqName qualifiedName = ((PackageFragmentDescriptor) containingDeclaration).getFqName();
|
||||
String packageClassName = PackageClassUtils.getPackageClassName(qualifiedName);
|
||||
if (peek.isEmpty()) {
|
||||
peek = JvmAbi.PACKAGE_CLASS;
|
||||
peek = packageClassName;
|
||||
}
|
||||
else {
|
||||
peek += "/" + JvmAbi.PACKAGE_CLASS;
|
||||
peek += "/" + packageClassName;
|
||||
}
|
||||
nameStack.push(peek + '$' + function.getName());
|
||||
super.visitNamedFunction(function);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -16,15 +16,19 @@
|
||||
|
||||
package org.jetbrains.jet.codegen.binding;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.ModuleSourcesManager;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
@@ -41,9 +45,6 @@ import static org.jetbrains.jet.codegen.CodegenUtil.isInterface;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class CodegenBinding {
|
||||
public static final WritableSlice<ClassDescriptor, MutableClosure> CLOSURE = Slices.createSimpleSlice();
|
||||
|
||||
@@ -58,9 +59,9 @@ public class CodegenBinding {
|
||||
private CodegenBinding() {
|
||||
}
|
||||
|
||||
public static void initTrace(BindingTrace bindingTrace, Collection<JetFile> files) {
|
||||
public static void initTrace(@NotNull ModuleSourcesManager moduleManager, @NotNull BindingTrace bindingTrace, @NotNull Collection<JetFile> files) {
|
||||
CodegenAnnotatingVisitor visitor = new CodegenAnnotatingVisitor(bindingTrace);
|
||||
for (JetFile file : allFilesInNamespaces(bindingTrace.getBindingContext(), files)) {
|
||||
for (JetFile file : allFilesInNamespaces(moduleManager, files)) {
|
||||
file.accept(visitor);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +128,8 @@ public class CodegenBinding {
|
||||
Collections.singletonList(KotlinBuiltIns.getInstance().getAnyType()),
|
||||
JetScope.EMPTY,
|
||||
Collections.<ConstructorDescriptor>emptySet(),
|
||||
null);
|
||||
null,
|
||||
false);
|
||||
|
||||
recordClosure(bindingTrace, null, classDescriptor, null, className, false);
|
||||
|
||||
@@ -135,18 +137,26 @@ public class CodegenBinding {
|
||||
bindingTrace.record(CLASS_FOR_FUNCTION, scriptDescriptor, classDescriptor);
|
||||
}
|
||||
|
||||
private static boolean canHaveOuter(BindingContext bindingContext, @NotNull ClassDescriptor classDescriptor) {
|
||||
final ClassKind kind = classDescriptor.getKind();
|
||||
public static boolean canHaveOuter(BindingContext bindingContext, @NotNull ClassDescriptor classDescriptor) {
|
||||
if (isSingleton(bindingContext, classDescriptor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (kind == ClassKind.ENUM_CLASS) {
|
||||
ClassDescriptor enclosing = enclosingClassDescriptor(bindingContext, classDescriptor);
|
||||
if (enclosing == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ClassDescriptor enclosing = enclosingClassDescriptor(bindingContext, classDescriptor);
|
||||
return enclosing != null && !isSingleton(bindingContext, enclosing);
|
||||
ClassKind kind = classDescriptor.getKind();
|
||||
if (kind == ClassKind.CLASS) {
|
||||
return classDescriptor.isInner() || !(classDescriptor.getContainingDeclaration() instanceof ClassDescriptor);
|
||||
}
|
||||
else if (kind == ClassKind.OBJECT) {
|
||||
return !isSingleton(bindingContext, enclosing);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSingleton(BindingContext bindingContext, @NotNull ClassDescriptor classDescriptor) {
|
||||
@@ -208,25 +218,27 @@ public class CodegenBinding {
|
||||
registerClassNameForScript(bindingTrace, descriptor, className);
|
||||
}
|
||||
|
||||
@NotNull public static Collection<JetFile> allFilesInNamespaces(BindingContext bindingContext, Collection<JetFile> files) {
|
||||
@NotNull
|
||||
public static Collection<JetFile> allFilesInNamespaces(@NotNull ModuleSourcesManager moduleManager, @NotNull Collection<JetFile> files) {
|
||||
// todo: we use Set and add given files but ignoring other scripts because something non-clear kept in binding
|
||||
// for scripts especially in case of REPL
|
||||
|
||||
final HashSet<FqName> names = new HashSet<FqName>();
|
||||
for (JetFile file : files) {
|
||||
if (!file.isScript()) {
|
||||
names.add(JetPsiUtil.getFQName(file));
|
||||
}
|
||||
}
|
||||
|
||||
final HashSet<JetFile> answer = new HashSet<JetFile>();
|
||||
Set<JetFile> answer = new HashSet<JetFile>();
|
||||
answer.addAll(files);
|
||||
|
||||
for (FqName name : names) {
|
||||
final NamespaceDescriptor namespaceDescriptor = bindingContext.get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR, name);
|
||||
final Collection<JetFile> jetFiles = bindingContext.get(NAMESPACE_TO_FILES, namespaceDescriptor);
|
||||
if (jetFiles != null)
|
||||
answer.addAll(jetFiles);
|
||||
for (JetFile file : files) {
|
||||
if (file.isScript()) continue;
|
||||
|
||||
FqName fqName = JetPsiUtil.getFQName(file);
|
||||
ModuleDescriptor module = moduleManager.getSubModuleForFile(file).getContainingDeclaration();
|
||||
Collection<JetFile> filesByPackage = getPackageFragmentSources(moduleManager, module, fqName);
|
||||
|
||||
assert filesByPackage.contains(file) : "Inconsistent behavior of module manager: " +
|
||||
"file " + file + " does not belong to " +
|
||||
"its package " + fqName + " in " +
|
||||
"its module " + module;
|
||||
|
||||
answer.addAll(filesByPackage);
|
||||
}
|
||||
|
||||
List<JetFile> sortedAnswer = new ArrayList<JetFile>(answer);
|
||||
@@ -247,10 +259,27 @@ public class CodegenBinding {
|
||||
return sortedAnswer;
|
||||
}
|
||||
|
||||
public static boolean isMultiFileNamespace(BindingContext bindingContext, FqName fqName) {
|
||||
final NamespaceDescriptor namespaceDescriptor = bindingContext.get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR, fqName);
|
||||
final Collection<JetFile> jetFiles = bindingContext.get(NAMESPACE_TO_FILES, namespaceDescriptor);
|
||||
return jetFiles != null && jetFiles.size() > 1;
|
||||
@NotNull
|
||||
private static Collection<JetFile> getPackageFragmentSources(
|
||||
@NotNull ModuleSourcesManager moduleManager,
|
||||
@NotNull ModuleDescriptor module,
|
||||
@NotNull FqName packageFqName
|
||||
) {
|
||||
Collection<JetFile> result = Lists.newArrayList();
|
||||
|
||||
for (SubModuleDescriptor subModule : module.getSubModules()) {
|
||||
Collection<PackageFragmentDescriptor> fragments = subModule.getPackageFragmentProvider().getPackageFragments(packageFqName);
|
||||
|
||||
for (PackageFragmentDescriptor fragment : fragments) {
|
||||
result.addAll(moduleManager.getPackageFragmentSources(fragment));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean isMultiFileNamespace(@NotNull ModuleSourcesManager moduleSourcesManager, @NotNull ModuleDescriptor module, @NotNull FqName fqName) {
|
||||
return getPackageFragmentSources(moduleSourcesManager, module, fqName).size() > 1;
|
||||
}
|
||||
|
||||
public static boolean isObjectLiteral(BindingContext bindingContext, ClassDescriptor declaration) {
|
||||
@@ -334,17 +363,17 @@ public class CodegenBinding {
|
||||
}
|
||||
}
|
||||
|
||||
DeclarationDescriptor container = descriptor.getContainingDeclaration();
|
||||
|
||||
if (container == null) {
|
||||
throw new IllegalStateException("descriptor has no container: " + descriptor);
|
||||
}
|
||||
DeclarationDescriptor container = DescriptorUtils.getParentInPackageViewHierarchy(descriptor);
|
||||
|
||||
Name name = descriptor.getName();
|
||||
|
||||
if (container instanceof PackageViewDescriptor && DescriptorUtils.isRootNamespace((PackageViewDescriptor) container)) {
|
||||
return name.getIdentifier();
|
||||
}
|
||||
|
||||
String baseName = getJvmInternalName(bindingTrace, container).getInternalName();
|
||||
if (!baseName.isEmpty()) {
|
||||
return baseName + (container instanceof NamespaceDescriptor ? "/" : "$") + name.getIdentifier();
|
||||
return baseName + (DescriptorUtils.isTopLevelDeclaration(descriptor) ? "/" : "$") + name.getIdentifier();
|
||||
}
|
||||
|
||||
return name.getIdentifier();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -29,9 +29,6 @@ import org.jetbrains.jet.lang.psi.JetDelegatorToSuperCall;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public final class MutableClosure implements CalculatedClosure {
|
||||
private final JetDelegatorToSuperCall superCall;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -25,12 +25,10 @@ import org.jetbrains.jet.codegen.NamespaceCodegen;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.util.slicedmap.WritableSlice;
|
||||
@@ -79,6 +77,11 @@ public final class PsiCodegenPredictor {
|
||||
// TODO: Method won't give correct class name for traits implementations
|
||||
|
||||
JetDeclaration parentDeclaration = PsiTreeUtil.getParentOfType(declaration, JetDeclaration.class);
|
||||
if (parentDeclaration instanceof JetClassObject) {
|
||||
assert declaration instanceof JetObjectDeclaration : "Only object declarations can be children of JetClassObject: " + declaration;
|
||||
return getPredefinedJvmClassName(parentDeclaration);
|
||||
}
|
||||
|
||||
JvmClassName parentClassName = parentDeclaration != null ?
|
||||
getPredefinedJvmClassName(parentDeclaration) :
|
||||
getPredefinedJvmClassName((JetFile) declaration.getContainingFile(), false);
|
||||
@@ -139,9 +142,10 @@ public final class PsiCodegenPredictor {
|
||||
|
||||
private static JvmClassName addPackageClass(JvmClassName packageName) {
|
||||
FqName name = packageName.getFqName();
|
||||
String packageClassName = PackageClassUtils.getPackageClassName(name);
|
||||
return name.isRoot() ?
|
||||
JvmClassName.byFqNameWithoutInnerClasses(JvmAbi.PACKAGE_CLASS) :
|
||||
JvmClassName.byInternalName(packageName.getInternalName() + "/" + JvmAbi.PACKAGE_CLASS);
|
||||
JvmClassName.byFqNameWithoutInnerClasses(packageClassName) :
|
||||
JvmClassName.byInternalName(packageName.getInternalName() + "/" + packageClassName);
|
||||
}
|
||||
|
||||
public static boolean checkPredictedClassNameForFun(
|
||||
@@ -200,6 +204,7 @@ public final class PsiCodegenPredictor {
|
||||
@Nullable
|
||||
public static JetFile getFileForCodegenNamedClass(
|
||||
@NotNull BindingContext context,
|
||||
@NotNull ModuleSourcesManager moduleSourcesManager,
|
||||
@NotNull List<JetFile> allNamespaceFiles,
|
||||
@NotNull final JvmClassName className
|
||||
) {
|
||||
@@ -217,7 +222,7 @@ public final class PsiCodegenPredictor {
|
||||
}
|
||||
};
|
||||
|
||||
CodegenBinding.initTrace(trace, allNamespaceFiles);
|
||||
CodegenBinding.initTrace(moduleSourcesManager, trace, allNamespaceFiles);
|
||||
|
||||
return resultingDescriptor.isNull() ? null
|
||||
: BindingContextUtils.getContainingFile(trace.getBindingContext(), resultingDescriptor.get());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -22,9 +22,6 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLOSURE;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class AnonymousClassContext extends CodegenContext {
|
||||
public AnonymousClassContext(
|
||||
JetTypeMapper typeMapper,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -22,9 +22,6 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLOSURE;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ClassContext extends CodegenContext {
|
||||
public ClassContext(
|
||||
JetTypeMapper typeMapper,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -25,9 +25,6 @@ import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLOSURE;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
class ClosureContext extends CodegenContext {
|
||||
private final ClassDescriptor classDescriptor;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -26,20 +26,16 @@ import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.ConstructorDescriptorImpl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.CAPTURED_THIS_FIELD;
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.CLASS_FOR_FUNCTION;
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.FQN;
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.*;
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/*
|
||||
* @author max
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public abstract class CodegenContext {
|
||||
|
||||
public static final CodegenContext STATIC = new RootContext();
|
||||
@@ -94,7 +90,7 @@ public abstract class CodegenContext {
|
||||
while (true) {
|
||||
assert c != null;
|
||||
DeclarationDescriptor contextDescriptor = c.getContextDescriptor();
|
||||
if (!(contextDescriptor instanceof ClassDescriptor) && !(contextDescriptor instanceof NamespaceDescriptor)) {
|
||||
if (!(contextDescriptor instanceof ClassDescriptor) && !(contextDescriptor instanceof PackageViewDescriptor)) {
|
||||
c = c.getParentContext();
|
||||
}
|
||||
else {
|
||||
@@ -139,11 +135,11 @@ public abstract class CodegenContext {
|
||||
return contextKind;
|
||||
}
|
||||
|
||||
public CodegenContext intoNamespace(NamespaceDescriptor descriptor) {
|
||||
public CodegenContext intoNamespace(@NotNull PackageViewDescriptor descriptor) {
|
||||
return new NamespaceContext(descriptor, this, OwnerKind.NAMESPACE);
|
||||
}
|
||||
|
||||
public CodegenContext intoNamespacePart(String delegateTo, NamespaceDescriptor descriptor) {
|
||||
public CodegenContext intoNamespacePart(String delegateTo, PackageViewDescriptor descriptor) {
|
||||
return new NamespaceContext(descriptor, this, new OwnerKind.StaticDelegateKind(delegateTo));
|
||||
}
|
||||
|
||||
@@ -269,12 +265,12 @@ public abstract class CodegenContext {
|
||||
}
|
||||
|
||||
protected void initOuterExpression(JetTypeMapper typeMapper, ClassDescriptor classDescriptor) {
|
||||
final ClassDescriptor enclosingClass = getEnclosingClass();
|
||||
outerExpression = enclosingClass != null
|
||||
? StackValue
|
||||
.field(typeMapper.mapType(enclosingClass), CodegenBinding.getJvmInternalName(typeMapper.getBindingTrace(), classDescriptor),
|
||||
CAPTURED_THIS_FIELD,
|
||||
false)
|
||||
ClassDescriptor enclosingClass = getEnclosingClass();
|
||||
outerExpression = enclosingClass != null && canHaveOuter(typeMapper.getBindingContext(), classDescriptor)
|
||||
? StackValue.field(typeMapper.mapType(enclosingClass),
|
||||
CodegenBinding.getJvmInternalName(typeMapper.getBindingTrace(), classDescriptor),
|
||||
CAPTURED_THIS_FIELD,
|
||||
false)
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -23,9 +23,6 @@ import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ConstructorContext extends MethodContext {
|
||||
private static final StackValue local1 = StackValue.local(1, OBJECT_TYPE);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package org.jetbrains.jet.codegen.context;
|
||||
|
||||
import org.jetbrains.asm4.Type;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -31,9 +31,6 @@ import static org.jetbrains.jet.codegen.binding.CodegenBinding.classNameForAnony
|
||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.isLocalNamedFun;
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescriptorToDeclaration;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public interface LocalLookup {
|
||||
boolean lookupLocal(DeclarationDescriptor descriptor);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -26,9 +26,6 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyAccessorDescriptor;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class MethodContext extends CodegenContext {
|
||||
public MethodContext(
|
||||
@NotNull FunctionDescriptor contextType,
|
||||
@@ -44,7 +41,7 @@ public class MethodContext extends CodegenContext {
|
||||
@Override
|
||||
public StackValue lookupInContext(DeclarationDescriptor d, @Nullable StackValue result, GenerationState state, boolean ignoreNoOuter) {
|
||||
if (getContextDescriptor() == d) {
|
||||
return StackValue.local(0, AsmTypeConstants.OBJECT_TYPE);
|
||||
return result != null ? result : StackValue.local(0, AsmTypeConstants.OBJECT_TYPE);
|
||||
}
|
||||
|
||||
//noinspection ConstantConditions
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -18,13 +18,10 @@ package org.jetbrains.jet.codegen.context;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.OwnerKind;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class NamespaceContext extends CodegenContext {
|
||||
public NamespaceContext(NamespaceDescriptor contextDescriptor, CodegenContext parent, @NotNull OwnerKind kind) {
|
||||
public NamespaceContext(@NotNull PackageViewDescriptor contextDescriptor, CodegenContext parent, @NotNull OwnerKind kind) {
|
||||
super(contextDescriptor, kind, parent, null, null, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -26,9 +26,6 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
class RootContext extends CodegenContext {
|
||||
public RootContext() {
|
||||
super(new FakeDescriptor(), OwnerKind.NAMESPACE, null, null, null, null);
|
||||
@@ -57,7 +54,7 @@ class RootContext extends CodegenContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor substitute(TypeSubstitutor substitutor) {
|
||||
public DeclarationDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -23,9 +23,6 @@ import org.jetbrains.jet.codegen.binding.MutableClosure;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ScriptContext extends CodegenContext {
|
||||
@NotNull
|
||||
private final ScriptDescriptor scriptDescriptor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
* Copyright 2010-2013 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.
|
||||
@@ -30,9 +30,6 @@ import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.correctElementType;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class ArrayGet implements IntrinsicMethod {
|
||||
@Override
|
||||
public StackValue generate(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user