Compare commits

...

1379 Commits

Author SHA1 Message Date
Mikhail Glukhikh
fc89385f08 Random-order variable sets are no more in use in CFG #KT-13990 Fixed 2016-09-22 12:34:03 +03:00
Dmitry Jemerov
66095904ff reorganize changelog to put new features first; some feature descriptions rewritten 2016-09-21 17:47:27 +02:00
Nikolay Krasko
95c63f8cd8 Fix severe freezes because of long lint checks on large files (KT-13071)
- Run lint analyze under indicator with write action priority. Otherwise ProgressManager.checkCanceled() checks doesn't work
 - Move ProgressManager.checkCanceled() up or they are not called in large files without lint warnings

(cherry picked from commit d96863d)

 #KT-13071 Fixed
2016-09-19 19:16:22 +03:00
Mikhail Glukhikh
a7645ade35 Try / catch reassignment: convert error to deprecation (1.0.4 specific) 2016-09-19 17:45:49 +03:00
Alexey Sedunov
3721618718 Minor: Fix NPE in MoveKotlinTopLevelDeclarationsDialog
#KT-13856 Fixed
2016-09-15 12:58:26 +03:00
Yan Zhulanow
cc86d79c6f Use LightParameter from Kotlin light classes to add an inner class constructor parameter instead of calling addParameter(name, type). The latter tries to load an icon :( (KT-13798) 2016-09-12 18:53:56 +03:00
Yan Zhulanow
3aae9904f7 Kapt: Return substituted supertypes in directSupertypes() for immediate class types (KT-13746) 2016-09-12 18:53:54 +03:00
Yan Zhulanow
dfadd17d05 asMemberOf() should always substitute type parameters for methods using the relevant substitutor 2016-09-12 18:53:52 +03:00
Yan Zhulanow
0780de8df8 Kapt: Allow to make CompilerConfiguration mutable again 2016-09-12 18:53:51 +03:00
Yan Zhulanow
09d857b86d Kapt: allow to use Kapt from compileBunchOfSources() 2016-09-12 18:53:51 +03:00
Yan Zhulanow
f9860cb0ed Kapt: Fix erasure() for immediate class types (KT-13748) 2016-09-12 18:53:50 +03:00
Yan Zhulanow
94f899107c Kapt: calculate default values of Kotlin annotations correctly for annotations from binaries (KT-13733) 2016-09-12 18:53:49 +03:00
Mikhail Glukhikh
d8078fbdd1 Quick-fix for reassignment in try / catch (fold to assignment) #KT-13778 Fixed
(cherry picked from commit edacc7f)
2016-09-12 15:04:34 +03:00
Alexey Sedunov
900c677d19 Misc: Do not use empty scope for KtParameter/KtTypeParameter (possible fix for EA-1185336)
(cherry picked from commit 1022549)
2016-09-12 13:44:12 +03:00
Alexey Tsvetkov
e8afbf19af Avoid dexing at Kapt2IT 2016-09-12 00:56:34 +03:00
Alexey Tsvetkov
2ce3418271 Do not try to remove source annotations from not .class file 2016-09-09 18:53:48 +03:00
Alexey Tsvetkov
4dcb9c48f9 Update changelog for 1.0.4 2016-09-09 18:12:00 +03:00
Alexey Tsvetkov
fde8006ba9 Revert "KT-13583: allow local classes to capture members of outer classes"
This reverts commit 37a21f7ddd.

Not essential for 1.0.4 release
2016-09-09 17:59:38 +03:00
Alexey Tsvetkov
ce51dd54b8 Revert "KT-12868: if a property initializer is a complex expression that emits additional statements, emit these statements directly before assignment to the property, not at the beginning of constructor"
This reverts commit d5f24582e4.

Reverting because not essential to 1.0.4 release
2016-09-09 17:59:02 +03:00
Alexey Tsvetkov
37099358ac Update changelog for 1.0.4 2016-09-09 16:41:45 +03:00
Mikhail Glukhikh
faf64ee887 Change to star projection no longer applied for functional types #KT-13715 Fixed
Also EA-87648 Fixed
(cherry picked from commit 998399b)
2016-09-09 15:08:25 +03:00
Mikhail Glukhikh
1941e175e9 Convert lambda to reference intention: apply shorten references to callable reference only, not to the whole argument list
(cherry picked from commit 23132ad)
2016-09-09 15:08:11 +03:00
Mikhail Glukhikh
23b56e6736 Convert lambda to reference has now INFO severity
(cherry picked from commit 7f955fd)
2016-09-09 15:08:01 +03:00
Alexey Andreev
7e54673690 JS: fix tests that don't fail due to lack of support of strict mode (multiValInIntFor, multiValInIntRangeFor). 2016-09-09 14:34:09 +03:00
Alexey Andreev
d5f24582e4 KT-12868: if a property initializer is a complex expression that emits additional statements, emit these statements directly before assignment to the property, not at the beginning of constructor 2016-09-09 14:34:08 +03:00
Alexey Andreev
37a21f7ddd KT-13583: allow local classes to capture members of outer classes 2016-09-09 14:34:06 +03:00
Nikolay Krasko
eb61c3985f Force building with 1.0.4 compiler in 1.0.4 branch 2016-09-07 14:30:23 +03:00
Alexey Tsvetkov
ca06b5ceb3 Change directory for sync task cache #KT-13732 fixed 2016-09-06 22:32:18 +03:00
Alexey Tsvetkov
14e677ff83 Minor: fix gradle plugin order in test 2016-09-06 20:11:03 +03:00
Alexey Tsvetkov
999660d0e2 Remove source annotations when copy class with kapt2
Writing source annotations enables incremental compilation for kapt2.
However they are not needed in bytecode, so we remove them when
copying classes.
2016-09-06 20:11:00 +03:00
Yan Zhulanow
974bbe797f Minor: Fix path separators check on Windows 2016-09-06 18:27:10 +03:00
Alexey Andreev
a780a34ebd KT-13658: don't capture FakeCallableDescriptorForObject in closure 2016-09-06 11:01:52 +03:00
Alexander Udalov
a0f99a3210 Add -language-version 1.0 to compiler settings 2016-09-05 18:57:41 +03:00
Yan Zhulanow
6856a7c36b Kapt: load all annotations, even if annotation processors does not require it explicitly. Some annotation processors may want to process some more annotations (see DbFlow, Database annotation).
Blacklist some common-used Java and Kotlin annotations instead (like Deprecated, Nullable or Metadata).
2016-09-05 15:51:34 +03:00
Alexander Udalov
c8b30d3310 Fix NPE in CallableReferencesResolutionUtils.kt on incomplete code
#KT-13685 Fixed
2016-09-05 12:40:05 +03:00
Yan Zhulanow
6ef66e7736 Kapt: Provide SourceRetentionAnnotationHandler for incremental compilation.
Collect annotations with the "SOURCE" retention.
2016-09-02 21:53:10 +03:00
Yan Zhulanow
6177b2bd2d Kapt: Write annotations with the "SOURCE" retention if kapt2 is enabled 2016-09-02 21:53:10 +03:00
Yan Zhulanow
c4b772abc8 Kapt: Remove generated output directory each time before annotation processing 2016-09-02 21:53:10 +03:00
Nikolay Krasko
7e9a2090bf Drop kotlin-bare-plugin (KT-11859)
(cherry picked from commit 9a54aa9)
2016-09-02 14:02:42 +03:00
Yan Zhulanow
5f2d3c42d8 Minor: fix compilation exception (due to exception in kotlinc) 2016-09-01 18:00:32 +03:00
Yan Zhulanow
4cb2127127 Kapt: support incremental compilation in Gradle (KT-13500)
Kapt will process sources on each step of incremental compilation.
2016-09-01 16:35:52 +03:00
Yan Zhulanow
c611f9b2db Kapt: Add tests with Filer.
JavaFileObject.getName() now returns a path as required.
2016-09-01 16:35:52 +03:00
Yan Zhulanow
880e183d84 Kapt: support multiple annotation processing steps (KT-13651) 2016-09-01 16:35:52 +03:00
Yan Zhulanow
550b1c0bea Kapt: provide a default constructor if PsiClass does not have any 2016-09-01 16:35:52 +03:00
Yan Zhulanow
3954c71af2 Kapt: Do not substitute type arguments for PsiClassReferenceType 2016-09-01 16:35:52 +03:00
Yan Zhulanow
89ba634972 Kapt: Do not use PsiType comparison in equals() where possible 2016-09-01 16:35:52 +03:00
Yan Zhulanow
19ce4cb967 Kapt: Represent a single element as an array if the annotation method type is array type 2016-09-01 16:35:52 +03:00
Yan Zhulanow
461c29de50 Kapt: Fix erasure() for executable types (KT-13629) 2016-09-01 16:35:52 +03:00
Yan Zhulanow
f78b8b4272 Kapt: abort compilation on error in annotation processing stage (KT-13622) 2016-09-01 16:35:52 +03:00
Yan Zhulanow
91444c59ff Kapt: Allow passing primitive types and void to erasure() (KT-13617) 2016-09-01 16:35:52 +03:00
Stanislav Erokhin
c60c5afd95 Potential fix for some random errors about "cannot choose between equals invoke functions".
(cherry picked from commit 407fe02)
2016-09-01 15:50:42 +03:00
Mikhail Glukhikh
e2e761ed95 Convert lambda to reference: use fully qualified type names if needed #KT-13438 Fixed 2016-09-01 14:29:28 +03:00
Mikhail Glukhikh
ecad1c38e0 Convert lambda to reference: flexible receiver types are handled correctly #KT-13411 Fixed 2016-09-01 11:54:13 +03:00
Mikhail Glukhikh
84c4ff7afb Convert lambda to reference: no more allowed for extension KFunction parameters #KT-13527 Fixed 2016-09-01 11:54:05 +03:00
Mikhail Glukhikh
f7b5d34ebb Convert lambda to reference: range reduced to a call itself #KT-13661 Fixed 2016-09-01 11:53:56 +03:00
Mikhail Glukhikh
1b0757f1e2 ChangeLog corrected (leaking this) 2016-08-31 19:10:47 +03:00
Mikhail Glukhikh
b7c54e5a70 Nested classes are no more allowed inside any anonymous objects or local classes #KT-13510 Fixed
(cherry picked from commit 5c3ec6c)
2016-08-31 19:04:01 +03:00
Mikhail Glukhikh
7c188b38d6 CFA: additional jumps to catch / finally generated in the end of try / before exits from try #KT-5469 Fixed
Also #KT-13612 Fixed
2016-08-31 19:00:27 +03:00
Mikhail Glukhikh
ecae5c6b57 KT-13612 KotlinPositionManager: fixed initialization in try / catch 2016-08-31 10:29:16 +03:00
Mikhail Glukhikh
aac8e94c1f UNUSED_VALUE is now reported on expression only if this expression is unused in all (e.g. finally) branches #KT-9825 Fixed 2016-08-31 10:15:44 +03:00
Alexey Andreev
ec7a21a57d KT-12873: add temporary variables generated by delegation expression to class initializer. Fix #KT-12873 2016-08-30 12:28:43 +03:00
Alexander Udalov
3beb65d78a Support "-no-reflect" in "kotlin" command
#KT-13491 Fixed

(cherry picked from commit 3298649bd7)
2016-08-26 21:42:18 +03:00
Alexey Tsvetkov
ed77d57094 Update link to jarjar 2016-08-25 23:50:29 +03:00
Alexey Tsvetkov
b857df261f Fix compatibility with AS 2.2 gradle plugin
#KT-13594 fixed
2016-08-25 19:16:53 +03:00
Alexey Tsvetkov
bc17859654 Update changelog for 1.0.4 2016-08-25 09:31:45 +03:00
Mikhail Glukhikh
8830ff7263 Has platform type inspection: do not suggest !! for not-null types #KT-12820 Fixed 2016-08-24 19:16:11 +03:00
Mikhail Glukhikh
7ae9b6b3da KT-13536 related: correct handling of objects 2016-08-24 19:15:19 +03:00
Mikhail Glukhikh
23961eefbe No more SOE in UnusedSymbolInspection #KT-13536 Fixed 2016-08-24 18:54:07 +03:00
Mikhail Glukhikh
be2adafde4 Invert if: more correct handling of empty returns #KT-13444 Fixed 2016-08-24 18:53:29 +03:00
Mikhail Glukhikh
07643ce8c7 Pseudocode label now cannot be bound to a non-owning pseudocode #KT-13555 Fixed
Also EA-77641 Fixed
2016-08-24 18:18:20 +03:00
Mikhail Glukhikh
30dd52e2a1 PseudocodeLabel is extracted from PseudocodeImpl (now not an inner class), some its properties / functions are supported now by base Label 2016-08-24 18:18:11 +03:00
Mikhail Glukhikh
3891d76d22 Label.java converted to Kotlin 2016-08-24 18:15:28 +03:00
Mikhail Glukhikh
eec4b1b860 CFG: break and continue are now handled in the same (safe) way EA-85060 Fixed 2016-08-24 18:15:25 +03:00
Mikhail Glukhikh
22c7ee5fa7 BreakableBlockInfo : converted to Kotlin 2016-08-24 18:15:21 +03:00
Mikhail Glukhikh
d5f7c3fc0d BreakableBlockInfo.java -> BreakableBlockInfo.kt 2016-08-24 18:15:18 +03:00
Mikhail Glukhikh
f64d60e50b LoopInfo: converted to Kotlin 2016-08-24 18:15:15 +03:00
Mikhail Glukhikh
d952dbd768 LoopInfo.java --> LoopInfo.kt 2016-08-24 18:15:11 +03:00
Mikhail Glukhikh
48faf4a8e9 EA-85060: BreakableBlockInfo is split into LoopInfo & SubroutineInfo to make code more clear 2016-08-24 18:15:08 +03:00
Alexey Tsvetkov
a1f91cab83 Fix snapshot version for testModuleKind 2016-08-24 16:21:40 +03:00
Alexey Tsvetkov
a300d2c7f6 Assume cache format is always up-to-date when compiling non-incrementally 2016-08-24 16:18:04 +03:00
Yan Zhulanow
01742aacbf KT-12303 Pass only relevant annotations to annotation processors 2016-08-24 01:31:39 +03:00
Yan Zhulanow
ed34ec0a7f Kapt: Fix type arguments in JeDeclaredType. In case of type variable, JeTypeVariableType should be returned 2016-08-24 01:31:38 +03:00
Yan Zhulanow
5f50ab6a0e Kapt: JeTypeElement getInterfaces() and getSuperClass() should provide reference type mirrors 2016-08-24 01:31:37 +03:00
Yan Zhulanow
5e9eab9948 Kapt: Support String[] in annotation proxy 2016-08-24 01:31:01 +03:00
Yan Zhulanow
d8101198fd Kapt: Use also the compile classpath, not only apt classpath 2016-08-24 01:31:01 +03:00
Yan Zhulanow
f95a3d1aa3 Kapt, Gradle: The first dependency is kotlin-annotation-processing (we reuse the old configurations from kapt) 2016-08-24 01:31:01 +03:00
Alexey Tsvetkov
a0b477a552 Support multi-project IC for android projects 2016-08-23 23:40:18 +03:00
Alexey Tsvetkov
973e2a8987 Fixes after review 2016-08-23 23:40:18 +03:00
Alexey Tsvetkov
f01daf4ffa Implement multiproject IC in Gradle
#KT-13528 fixed
2016-08-23 23:40:18 +03:00
Alexey Tsvetkov
c3c4e7dc6c Join paths to string for better assertion message in idea 2016-08-23 23:40:18 +03:00
Alexey Tsvetkov
db24fe86cf Refactor version checking 2016-08-23 23:40:18 +03:00
Alexey Tsvetkov
9bfbdd9f83 Introduce KotlinGradleBuildServices that is created once per build 2016-08-23 23:40:18 +03:00
Alexey Tsvetkov
4e696c7723 Minor: remove outdated TODO 2016-08-23 23:40:18 +03:00
Alexey Tsvetkov
845d1742a3 Refactor loading kotlin version in gradle plugin 2016-08-23 23:40:18 +03:00
Alexey Andreev
28a1b44845 JS: refactor how cached access translators work. Fix cached access translator in case of arrays. Use cached access translator to translate reassignments 2016-08-23 18:21:34 +03:00
Alexey Andreev
74ef68c2d8 JS: don't translate RHS of overloaded assignment operators twice. It can break compilation in some cases, for example, when there are lambdas in RHS.
Fix #KT-12808 #KT-12807
2016-08-23 18:21:34 +03:00
Alexey Andreev
41c4957125 JS: add support of JS module kind to Gradle task. Add tests of support of module kind to Maven tests 2016-08-23 17:13:47 +03:00
Alexey Tsvetkov
2eee4b0738 Ensure java is forced to compile when kotlin is compiled incrementally
Previously java compilation was not forced when there were only
removed kotlin files.
2016-08-23 15:58:09 +03:00
Alexey Andreev
5aa114133f KT-13025: when receiver of call of 'invoke' method is a Function, check whether receiver is an extension function and generate additional '.call' invocation. Fix #KT-13025 2016-08-23 15:52:21 +03:00
Alexey Andreev
00e925549f KT-13043: fix translation of super call from secondary constructor when base constructor has default arguments 2016-08-23 15:52:20 +03:00
Alexey Tsvetkov
1daee05332 Fix incremental build with kapt and gradle 2.14
#KT-13179 fixed
2016-08-22 18:36:11 +03:00
Yan Zhulanow
76109453c0 Kapt: Support nested annotations property.
Also do not rely on Java class comparison, check against qualified names.
2016-08-22 17:27:29 +03:00
Yan Zhulanow
36b0b52632 Kapt: Fix broken assertion 2016-08-22 17:27:29 +03:00
Dmitry Jemerov
0d89dc37f6 use less brute-force method for updating converted file content in J2K (may fix KT-13493 and friends)
(cherry picked from commit ebd45a8)
2016-08-22 16:22:15 +02:00
Mikhail Glukhikh
53079c1ef8 Replace with safe calls forbidden for comparisons #KT-13432 Fixed
(cherry picked from commit c07906f)
2016-08-22 15:15:29 +03:00
Mikhail Glukhikh
f2e5d3c2c1 Added fake override search in unused symbol inspection #KT-13288 Fixed
(cherry picked from commit b3b83e3)
2016-08-22 15:15:10 +03:00
Kirill Rakhman
64a7fccc44 fix "Can be replaced with comparison" false positive if extension method called 'equals' is used
Fixes #KT-13480
(cherry picked from commit e6e4680)
2016-08-22 15:14:41 +03:00
Dmitry Jemerov
6dd7e4c221 Merge branch 'rr/yole/gradle-advertiser' into 1.0.4 2016-08-22 11:50:36 +02:00
Alexey Tsvetkov
b625d75da1 Update changelog for 1.0.4 2016-08-19 22:58:21 +03:00
Dmitry Jemerov
0a27a99680 for 1.0.4: advertise users to upgrade to a newer Kotlin plugin if they open a Gradle build script 2016-08-19 19:09:17 +02:00
Pavel V. Talanov
1b6c96cdee IntentionBasedInspection: Removing synchronizing on intention instances
Recreate intention instance in `buildVisitor`
Lock caused contention for UpSource
2016-08-19 18:31:07 +03:00
Dmitry Jemerov
b96f97831b diagnostics that helped catch KT-13381
(cherry picked from commit 742d7db)
2016-08-19 16:30:32 +02:00
Alexey Sedunov
0d63004e29 Find Usages: Do not duplicate containing declaration in super member warning dialog
#KT-10209 Fixed
(cherry picked from commit 9fd61b8)
2016-08-18 20:10:06 +03:00
Alexey Sedunov
c7ae2e91eb Create from Usage: Place extension properties after the usage and generate stub getter
#KT-11795 Fixed
(cherry picked from commit c2b38cf)
2016-08-18 20:10:02 +03:00
Alexey Sedunov
0fb8f49938 Create from Usage: Make extension functions/properties 'private' by default
#KT-11799 Fixed
(cherry picked from commit 99ba340)
2016-08-18 20:09:58 +03:00
Alexey Sedunov
cd3f6d6c63 Remove Unused Receiver: update function/property usages
#KT-8903 Fixed
(cherry picked from commit 92b0c85)
2016-08-18 20:09:54 +03:00
Alexey Sedunov
a3eebe3561 Rename: Support rename of packages with non-standard quoted names
#KT-13488 Fixed
(cherry picked from commit 0fc28fe)
2016-08-18 20:09:50 +03:00
Alexey Sedunov
ad4c7d54f5 Rename: Do not search for component convention usages
#KT-9381 Fixed
(cherry picked from commit f6de6ea)
2016-08-18 20:09:46 +03:00
Alexey Sedunov
3ee20d9a71 Rename: Fix parameter rename when new name matches call selector
#KT-13476 Fixed
(cherry picked from commit f507eed)
2016-08-18 20:09:42 +03:00
Alexey Sedunov
67543b061d Rename: Quote parameter name when necessary
#KT-13463 Fixed
(cherry picked from commit 5e577c3)
2016-08-18 20:09:38 +03:00
Alexey Sedunov
dfa4b7f1bc Override/Implement: Make return type non-nullable (platform collection case) when overriding Java method
#KT-13455 Fixed
(cherry picked from commit 238f99a)
2016-08-18 20:09:34 +03:00
Alexey Sedunov
21e24a1624 Intentions: Implement intention to replace camel-case test function name with a space-separated one
#KT-12489 Fixed
2016-08-18 20:05:08 +03:00
Dmitry Jemerov
1f34c8d649 diagnostics for EA-86187 - KNPE: KDocElementFactory.createNameFromText
(cherry picked from commit ac6f0b5)
2016-08-18 17:32:26 +02:00
Dmitry Jemerov
9c8605f59e don't try to walk over the siblings of PsiFile to check if "introduce variable" is enabled (EA-86136 - assert: SharedPsiElementImplUtil.getChildIndex)
(cherry picked from commit 8a22e1e)
2016-08-18 17:32:18 +02:00
Dmitry Jemerov
3ab6f88e1d stop at file level when going up the tree in KtPsiUtil.areParenthesesNecessary() (EA-86495 - NPE: KtPsiUtil.areParenthesesNecessary)
(cherry picked from commit 7ee72f2)
2016-08-18 17:32:11 +02:00
Dmitry Jemerov
85ce65c5d3 check for project disposed in NewKotlinActivityAction (EA-82450 - assert: ComponentManagerImpl.getPicoContainer)
(cherry picked from commit ef791fe)
2016-08-18 17:32:02 +02:00
Mikhail Glukhikh
670e651f39 More correct handling of compile time constant types #KT-13421 Fixed
(cherry picked from commit ac3dfd9)
2016-08-18 17:46:53 +03:00
Kirill Rakhman
b4cee026d5 Add Intention to replace a..b-1 with a until b and vice versa #KT-13483 Fixed
(cherry picked from commit 354d047)
2016-08-18 17:46:40 +03:00
Alexey Sedunov
2eff9cd4a7 Light Classes: Support property accessors with non-conventional names
#KT-13032 Fixed
(cherry picked from commit fbd6edc)
2016-08-18 13:21:52 +03:00
Alexey Sedunov
76a35a7e5b Pull Up: Skip super members without explicit declarations
#KT-13124 Fixed
(cherry picked from commit 94c4b42)
2016-08-18 13:21:51 +03:00
Alexey Sedunov
0617df933b Push Down: Do not specifiy visibility on generated overriding members
#KT-12971 Fixed
(cherry picked from commit 6766494)
2016-08-18 13:21:51 +03:00
Alexey Sedunov
d583809ed7 Rename: Use RenameKotlinParameterProcessor for constructor/lambda parameters
#KT-13253 Fixed
(cherry picked from commit ad3ffda)
2016-08-18 13:21:50 +03:00
Alexey Sedunov
a61bce207c Rename: Do not report shadowing conflict if redeclaration is detected
#KT-13240 Fixed
(cherry picked from commit 2e887eb)
2016-08-18 13:21:49 +03:00
Alexey Sedunov
f9a2c3a669 Move: Warn about accessibility conflicts when moving entire file
#KT-13175 Fixed
(cherry picked from commit 8232c66)
2016-08-18 13:21:48 +03:00
Alexey Sedunov
1eb279830c Move: Warn about accessibility conflicts due to moving to unrelated module
#KT-13174 Fixed
(cherry picked from commit baa549e)
2016-08-18 13:21:47 +03:00
Alexey Sedunov
ccd1c11f1f Rename: Warn about function name conflicts
#KT-13239 Fixed
(cherry picked from commit 6a42802)
2016-08-18 13:21:46 +03:00
Alexey Sedunov
43400200c0 Rename: Fix name quoting for automatic renamers
#KT-13282 Fixed
 #KT-13283 Fixed
(cherry picked from commit 385640c)
2016-08-18 13:21:45 +03:00
Alexey Sedunov
bd126420b6 Rename: Conflict detection for type parameters
#KT-13254 Fixed
(cherry picked from commit a5da9e8)
2016-08-18 13:21:44 +03:00
Alexey Sedunov
65cfb6062d Create from Usage: Disable "Create property" (non-abstract) in interfaces. Make "Create function" (non-abstract) generate function body in interfaces
#KT-13365 Fixed
(cherry picked from commit 562488b)
2016-08-18 13:21:43 +03:00
Alexey Sedunov
f21a8c1681 Change Signature: Yield to other usage processor if target element is neither KtFunction, nor PsiMethod
#KT-13277 Fixed
(cherry picked from commit f4d9f33)
2016-08-18 13:21:43 +03:00
Kirill
dd50c29cad Make folding if to return/assignment work with if-else if-else #KT-13452 Fixed
(cherry picked from commit 1926825)
2016-08-18 09:40:25 +03:00
Kirill
0c43ff0068 Minor: make var val
(cherry picked from commit 6bb4c28)
2016-08-18 09:40:12 +03:00
Zalim Bashorov
d975f21e99 Use target of current module when find libraries with incompatible binary format
#KT-12977 Fixed
2016-08-17 20:41:18 +03:00
Nikolay Krasko
d6d3846137 Reformat main function templates 2016-08-17 20:23:47 +03:00
Nikolay Krasko
cf1bdba2cf Introduce 'maino' and 'psvmo' templates for generating main in object (KT-6520)
#KT-6520 Fixed
2016-08-17 20:22:40 +03:00
Yan Zhulanow
467d0fd10f Kapt: Gradle integration tests for the new kapt 2016-08-17 16:40:07 +03:00
Yan Zhulanow
bb370f1732 Kapt: Get rid of the 'compiler-tests' dependency in 'plugins-tests' 2016-08-17 16:40:03 +03:00
Yan Zhulanow
1391e597b4 Kapt: compile annotation-processing artifact with target "1.6" 2016-08-17 16:40:01 +03:00
Yan Zhulanow
9686344ade Kapt: Make javaCompile parameter in KotlinGradleSubplugin non-null 2016-08-17 16:40:00 +03:00
Yan Zhulanow
a9c77e1d69 Kapt: Fix type arguments order for JeDeclaredType, should not use substitutor 2016-08-17 16:39:59 +03:00
Yan Zhulanow
3ced8a677f Kapt: Support default packages in Filer 2016-08-17 16:39:58 +03:00
Yan Zhulanow
02a3e6bafe Kapt: Support inherited annotations 2016-08-17 16:39:58 +03:00
Yan Zhulanow
b248b2062f Kapt: Filter out kapt2 sources in KotlinCompile task 2016-08-17 16:39:57 +03:00
Yan Zhulanow
6e72dc83bc Kapt Gradle plugin: use the old configuration names 2016-08-17 16:39:56 +03:00
Yan Zhulanow
f4fc8f13c1 Kapt: Gradle plugin for the new kapt 2016-08-17 16:39:55 +03:00
Yan Zhulanow
e6067d595d Kapt: verbose output mode 2016-08-17 16:39:55 +03:00
Yan Zhulanow
df9c825726 Kapt: Provide toString() implementations for no-types 2016-08-17 16:39:50 +03:00
Yan Zhulanow
a14d7cee28 Kapt: Fixes in KotlinElements:
1. 'overrides()' when 'type' extends containing(overrider) and implements containing(overridden). According to documentation, In this case the function should return true.
2. Handle both kotlin.Deprecated and java.lang.Deprecated for Kotlin in 'isDeprecated'.
3. Fix 'isFunctionalInterface'.
2016-08-17 16:39:48 +03:00
Yan Zhulanow
0ff95846fb Kapt: Calculate constant values in the similar way.
Always use originalElement in JeAnnotationValue factory.
2016-08-17 16:39:44 +03:00
Yan Zhulanow
ed8e2e49ac Kapt: Use the base types in KotlinProcessingEnvironment 2016-08-17 16:39:41 +03:00
Yan Zhulanow
948a4b6157 Kapt: add some JeElement tests 2016-08-17 16:39:40 +03:00
Yan Zhulanow
3eecf78307 Kapt: add JeElementRenderer 2016-08-17 16:39:40 +03:00
Yan Zhulanow
649b93833c Kapt: Minor, refactor JeAnnotationMirror:getElementValues() 2016-08-17 16:39:39 +03:00
Yan Zhulanow
4591f134d7 Kapt: annotation-processing is not dependent on 'cli' module anymore 2016-08-17 16:39:38 +03:00
Yan Zhulanow
be31262f0e Kapt: Fixes on review 2016-08-17 16:39:34 +03:00
Yan Zhulanow
7a06a91f41 Kapt: Support Java source root processing.
Support resource file writing.
2016-08-17 16:39:32 +03:00
Yan Zhulanow
27ec053f93 Kapt: Support "*" in supported annotation qualified names (all annotations) 2016-08-17 16:39:31 +03:00
Yan Zhulanow
71c8dfb57a Kapt: Check DEFAULT modifier only in Java 8 2016-08-17 16:39:27 +03:00
Yan Zhulanow
82dcbf36e5 Kapt: Drop custom annotation stub factory, implement it with AnnotationParser in sun.reflect as done in Javac 2016-08-17 16:39:19 +03:00
Yan Zhulanow
0a684aa1d1 Kapt: Refactor kapt type wrappers. Now every ordinary (not NoType) type has a backed PsiType so it's easy to call utility functions from IntelliJ. 2016-08-17 16:39:12 +03:00
Yan Zhulanow
17ad807b82 Kapt: Analyze sources again if the received analysis result is 'RetryWithAdditionalJavaRoots'. ->
Add additional Java roots to Java source roots and clear diagnostic messages before the next analysis round.
2016-08-17 16:38:55 +03:00
Yan Zhulanow
7180961212 Kapt: Add ability to get constant value from KtLightAnnotation 2016-08-17 16:38:48 +03:00
Yan Zhulanow
32c461a7a7 Kapt: Implement Annotation Processing plugin in Kotlin (KT-13499) 2016-08-17 16:38:43 +03:00
Yan Zhulanow
1214513498 Kapt: Add APT wrappers for PSI elements 2016-08-17 16:38:33 +03:00
Zalim Bashorov
5cadbb2d20 JS: fix runtime type checking for native non-fake interfaces on WebKit (JavaScriptCore); add tests for object and object expressions.
(cherry picked from commit 33e96fc)
2016-08-17 14:27:17 +03:00
Alexander Udalov
8baf9ce3a0 Rename CompanionObjectMapping.hasMappingToObject -> isMappedIntrinsicCompanionObject
(cherry picked from commit 18887f8bec)
2016-08-16 15:04:59 +03:00
Alexander Udalov
9e6812408c Make KClasses for primitives equal to KClasses for wrapper types
Both primitive int and wrapper type java.lang.Integer are represented by the
single type kotlin.Int in Kotlin, so inequality between the corresponding
KClasses was confusing here. To keep the old behavior, one may call 'k1.java ==
k2.java' instead of `k1 == k2`

 #KT-13462 Fixed

(cherry picked from commit 5b1ee13db8)
2016-08-16 15:04:59 +03:00
Alexander Udalov
bd2763a797 Fix NPE on .companionObjectInstance for built-in classes
#KT-13370 Fixed

(cherry picked from commit 3efa738bc0)
2016-08-16 15:04:59 +03:00
Alexander Udalov
8bc65875ff Minor, make CompanionObjectMapping a singleton
(cherry picked from commit 611899e9d3)
2016-08-16 15:04:59 +03:00
Denis Zharkov
16fe13fbb3 Remove JavaToKotlinClassMap dependency on built-ins instance
(cherry picked from commit 7fe5a9db8d)
2016-08-16 15:04:59 +03:00
Kirill Rakhman
41cf8680af Allow suppressing warnings for secondary constructor (KT-12627)
#KT-12627 Fixed
2016-08-16 12:56:00 +03:00
Nikolay Krasko
970ac5a508 Make quick evaluate work on receiver in qualified expressions (KT-13269)
#KT-13269 Fixed
2016-08-16 12:32:43 +03:00
Michael Bogdanov
c427f1f7ef Fix for KT-13374: CompilationException: Inline function call with anonymous object implementing an interface by delegation
#KT-13374 Fixed
(cherry picked from commit 7325baa)
2016-08-16 10:53:21 +03:00
Natalia Ukhorskaya
ade959ef0c Eval4J: loadClass should return prepared class, otherwise ClassNotPreparedException fails in invokeMethod
#KT-12641 Fixed
2016-08-16 09:35:08 +03:00
Natalia Ukhorskaya
3caea45918 Debugger: allow to evaluate 'this' and fields in java files 2016-08-16 09:34:59 +03:00
Natalia Ukhorskaya
c6ff1b2c32 Fixes after review: get last statement in codeFragmetn using psi instead of findElementAt 2016-08-16 09:34:49 +03:00
Natalia Ukhorskaya
eb0bc8cab3 Minor: extract similar parts to separate function 2016-08-16 09:34:37 +03:00
Natalia Ukhorskaya
0ca207acb8 Debugger: allow to evaluate kotlin expressions in java files
#KT-7549 Fixed

 If the context is inside PsiJavaFile, get list of all local variables available in current frame (this logic was removed in 29778311e8 01.12.2015 Drop unnecesary logic about additional context for lambda in debugger). For each variable create KtProperty inside top-level KtFunction in KtFile and set it as contextElement for KtCodeFragment. This file should have all imports from PsiJavaFile. We do not create properties on top-level because they will be highlighted as top-level vals/vars.
2016-08-16 09:34:24 +03:00
Natalia Ukhorskaya
df375f3f1b Debugger tests: mark objects using NodeDescriptorImpl.getMarkup. Primitive values cannot be marked. 2016-08-16 09:33:45 +03:00
Stanislav Erokhin
8a38ec01a5 Fixed exception AssertionError: Illegal resolved call to variable with invoke
#KT-13330 Fixed
#KT-13349 Fixed
(cherry picked from commit 85a951d)
2016-08-15 19:25:44 +03:00
Mikhail Glukhikh
17cc7be30e Do not suggest "Replace infix with safe call" inside conditions or binary / unary expressions #KT-13328 Fixed
(cherry picked from commit b53cb91)
2016-08-15 18:49:39 +03:00
shiraji
11b4c387ff Fix problem with appending literal to variable omitting braces #KT-13336 Fixed
(cherry picked from commit 4296927)
2016-08-15 18:49:28 +03:00
Kirill
290124b3fe Implement intentions to add/remove braces to/from when entries #KT-12043 Fixed
(cherry picked from commit 223fd9f)
2016-08-15 17:20:03 +03:00
Kirill Rakhman
a7a97b6aaf Highlight use of toString() inside string interpolation as redundant #KT-10731 Fixed
(cherry picked from commit d68a681)
2016-08-15 17:19:50 +03:00
Kirill Rakhman
3f472143f2 Format spaces around !is and !in (KT-13314)
#KT-13314 Fixed
2016-08-15 16:14:00 +03:00
Mikhail Glukhikh
3edb91c98d KT-13430 related: add non-null assertion works also for UNSAFE_INFIX_CALL
(cherry picked from commit 52dacd1)
2016-08-15 10:15:28 +03:00
Mikhail Glukhikh
f3d1e7c5ae Add non-null assertion: correct handling of unary expression unsafe calls #KT-13430 Fixed
(cherry picked from commit cf2d575)
2016-08-15 10:15:16 +03:00
Mikhail Glukhikh
26d3a3dd76 Minor: convert to expression body is forbidden also for nested non-exhaustive whens
(cherry picked from commit e01e084)
2016-08-15 10:15:04 +03:00
Mikhail Glukhikh
405d966ec2 Unused symbol: handling of import as alias not only for objects / enums #KT-11933 Fixed
(cherry picked from commit 1397577)
2016-08-15 10:14:48 +03:00
Mikhail Glukhikh
013d605dca Convert to expression body is forbidden for if without else #KT-12951 Fixed
(cherry picked from commit 6a6c67d)
2016-08-15 10:14:35 +03:00
Mikhail Glukhikh
3d59603fa8 Report of UNINITIALIZED_ENUM_COMPANION also for implicit receivers #KT-11769 Fixed
(cherry picked from commit 1c5c650)
2016-08-12 18:04:45 +03:00
Mikhail Glukhikh
53775140e2 KT-11769 case with companion function call: error is now detected if companion receiver is stated explicitly
(cherry picked from commit 04f71bc)
2016-08-12 18:04:34 +03:00
shiraji
ebdda7a0ad Add quickfix for adding 'inline' to a function with reified generic #KT-6975 Fixed
(cherry picked from commit 3e58283)
2016-08-12 15:14:12 +03:00
Sergey Mashkov
25f414c099 KT-13211 KotlinCompileMojoBase could provide better compilation failure info
(cherry picked from commit 3c00262)
2016-08-12 14:02:11 +03:00
Mikhail Glukhikh
b9d2d17602 Fix for SOE in VarianceChecker #KT-13401 Fixed
(cherry picked from commit 6cf90cf + modification due to refactoring in 1.1)
2016-08-11 13:23:30 +03:00
Alexey Tsvetkov
d47dbfd163 Revert replacing convention with extension
It seems that was wrong
2016-08-10 22:20:24 +03:00
Alexey Sedunov
d6fb46c969 Introduce Property: Fix duplicate count in popup window
#KT-13395 Fixed
(cherry picked from commit 3475a1f)
2016-08-10 16:03:13 +03:00
Alexey Sedunov
71720af295 Light Classes: Do not compute annotations for light elements with invalid
origin (possible fix for KT-13199)
(cherry picked from commit ab7d48a)
2016-08-10 16:03:12 +03:00
Alexey Sedunov
f918756ad8 Move: Quote package name (if necessary) when moving declarations to new file
#KT-13385 Fixed
(cherry picked from commit 4ab25bd)
2016-08-10 16:03:12 +03:00
Alexey Sedunov
8f76445ea7 Extract Function: Skip callable reference selectors
#KT-13218 Fixed
(cherry picked from commit b793252)
2016-08-10 16:03:11 +03:00
Alexey Sedunov
22f3bd994d Create from Usage: Do not suggest creating annotations/enum classes for unresolved type parameter bounds
#KT-13364 Fixed
(cherry picked from commit 6e3d1d7)
2016-08-10 16:03:10 +03:00
Alexey Sedunov
d680ebde03 Override/Implement Members: Do not make return type non-nullable if base
return type is explicitly nullable
 #KT-13383 Fixed
 #KT-13379 Fixed
(cherry picked from commit 1a4ff59)
2016-08-10 16:03:09 +03:00
Alexey Sedunov
a06e5b207e Quick Fixes: Use simple class name in "Change function return type" quickfix
#KT-12919 Fixed
(cherry picked from commit 75573bd)
2016-08-10 16:03:08 +03:00
Alexey Sedunov
ca083757aa Override/Implement Members: Support "Copy JavaDoc" options for library classes
#KT-12997 Fixed
(cherry picked from commit f57c927)
2016-08-10 16:03:07 +03:00
Alexey Sedunov
7af981c274 Introduce Variable: Skip leading/trailing comments inside selection
#KT-13054 Fixed
(cherry picked from commit 8a9a328)
2016-08-10 16:03:07 +03:00
Alexey Sedunov
074e9620a7 Introduce Variable: Retain entered name after changing "Specify type explicitly" option
#KT-13128 Fixed
(cherry picked from commit 00b6839)
2016-08-10 16:03:06 +03:00
Alexey Sedunov
2ac07f4a41 Extract Function: Extract Function: Fix generation of destructuring declarations
#KT-13010 Fixed
(cherry picked from commit 792177f)
2016-08-10 16:03:05 +03:00
Alexey Sedunov
7cab3f102b Extract Function/Parameter/Type Alias: Automatically quote declaration name when necessary
#KT-13157 Fixed
(cherry picked from commit 06e7672)
2016-08-10 16:03:04 +03:00
Alexey Sedunov
1d74fd56ab Presentation: Render function signature in RefactoringDescriptionLocation
#KT-12943 Fixed
(cherry picked from commit 59a714c)
2016-08-10 16:03:03 +03:00
Alexey Sedunov
f420c8fb9f Introduce Variable: Do not suggest expressions without type
#KT-12922 Fixed
(cherry picked from commit 892c843)
2016-08-10 16:03:02 +03:00
Alexey Sedunov
a535daba1e Rename: Fix function description in super method warning dialog
#KT-12945 Fixed
(cherry picked from commit 3cd35f8)
2016-08-10 16:03:02 +03:00
Alexey Sedunov
d639d4099d Refactoring: Allow multiple ElementKinds when choosing element to refactor
(cherry picked from commit b5828a5)
2016-08-10 16:03:01 +03:00
Alexey Sedunov
87f93fda26 Misc: Update function/type alias signature preview upon changing checkbox state
(cherry picked from commit 09d3629)
2016-08-10 16:03:00 +03:00
Alexey Sedunov
f849cf993d Change Signature: Consider super call a by-name propagation site if either its class, or its primary constructor is a propagation target.
This fixes testJavaConstructorParameterPropagation test flickering
(cherry picked from commit 57bc0d6)
2016-08-10 16:02:59 +03:00
Alexey Sedunov
a662feb39b Convert to Kotlin: AbstractParameterTablePanel.java
(cherry picked from commit ce0e5b4)
2016-08-10 16:02:58 +03:00
Alexey Sedunov
de0012086a Convert to Kotlin: AbstractParameterTablePanel.java (rename to .kt)
(cherry picked from commit 27773fb)
2016-08-10 16:02:58 +03:00
Alexey Sedunov
3a894fdb65 Convert to Kotlin: ExtractFunctionParameterTablePanel.java
(cherry picked from commit 3d49b27)
2016-08-10 16:02:57 +03:00
Alexey Sedunov
b9ff03b510 Convert to Kotlin: ExtractFunctionParameterTablePanel.java (rename to .kt)
(cherry picked from commit abe7b8c)
2016-08-10 16:02:56 +03:00
Alexey Sedunov
c592e3f90f Refactoring: Extract AbstractParameterTablePanel class
(cherry picked from commit 6b0968c)
2016-08-10 16:02:55 +03:00
Alexey Sedunov
362b393b8d Minor: Move and rename KotlinFunctionSignatureComponent
(cherry picked from commit 9e339c1)
2016-08-10 16:02:54 +03:00
Alexey Sedunov
0d9633cff8 Refactoring: Extend expression selection utilities to support KtTypeElement
(cherry picked from commit 301f86c)
2016-08-10 16:02:54 +03:00
Alexey Sedunov
9549d623d0 Inline Variable/Property: Move test data
(cherry picked from commit 7773a1c)
2016-08-10 16:02:53 +03:00
Alexey Tsvetkov
5696c3b667 Invalidate jar cache at the end of a Gradle build
#KT-12912 fixed
2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
e1316ff069 Add simple file modification util for gradle incremental tests 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
4e5092e2a6 Refactoring: cleanup gradle plugin 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
a7582f6f0b Refactoring: move util functions to gradleUtils.kt 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
af053ef160 Refactoring: remove unused ScriptHandler 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
c5243e323c Refactoring: simplify KotlinSourceSet creation 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
ce4f220bd9 Refactoring: extract constants 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
7a1d7c4af5 Refactoring: stop using internal classes to create DSL extensions 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
7b1bd21366 Refactoring: taskUtils.kt->gradleUtils.kt 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
a204c0a4c7 Refactoring: remove usages of ProjectInternal 2016-08-10 15:52:55 +03:00
Alexey Tsvetkov
9ac897f36c Refactoring: inject FileResolver
This is part of refactoring to minimize using of internal API in gradle plugin
2016-08-10 15:52:55 +03:00
Ilya Chernikov
8c40d4aadd Attempt to fix EA-82064:
"java.lang.NoClassDefFoundError: Could not initialize class kotlin.Unit"
2016-08-10 14:15:05 +02:00
Zalim Bashorov
1bcb3eda93 JS backend: fix runtime type checking for interfaces
(cherry picked from commit 9ece62f)
2016-08-10 15:13:03 +03:00
Zalim Bashorov
0cfcef2279 Fix printing file size of generated js files for TeamCity statistics
(cherry picked from commit 060255e)
2016-08-10 15:12:56 +03:00
Dmitry Jemerov
a33c4b8f03 workaround for IDEA's issue that throws an exception when using union() on a LocalSearchScope with no elements (EA-82063 - AIOOBE: GlobalSearchScope.union)
(cherry picked from commit f08a7f1)
2016-08-10 13:29:49 +02:00
Dmitry Jemerov
2d66aa54b3 don't use document for checking whether a folding region is one-line, use only PSI, as it may not correspond to the state of the document (EA-81838 - IOOBE: LineSet.findLineIndex)
(cherry picked from commit 180f70b)
2016-08-10 13:29:38 +02:00
Dmitry Jemerov
375c3b9214 don't crash if we don't have a descriptor for the declaration under caret (EA-86248 - KNPE: KDocNameCompletionSession.doComplete)
(cherry picked from commit a4aa3cd)
2016-08-10 13:29:30 +02:00
Dmitry Jemerov
3e478f096b correct fix for showing dialog from popup callback (EA-86138)
(cherry picked from commit ddb91cc)
2016-08-10 13:29:18 +02:00
Dmitry Jemerov
c354cdef5b correct fix for invoking 'safe delete' refactoring outside of write action (EA-80766 - E: BaseRefactoringProcessor.run)
(cherry picked from commit 5c113a4)
2016-08-10 13:29:11 +02:00
Dmitry Jemerov
763fa7d193 one more missing read action in Find Usages (EA-81276 - assert: SharedImplUtil.getParent)
(cherry picked from commit 5d92f65)
2016-08-10 13:29:01 +02:00
Dmitry Jemerov
ae50e1f766 check element validity in KotlinSelectInProjectViewProvider (EA-84485 - PIEAE: OwnBufferLeafPsiElement.getContainingFile)
(cherry picked from commit f9d3804)
2016-08-10 13:28:52 +02:00
Dmitry Jemerov
033ee0953e don't check intention availability on PsiFile (EA-85587 - assert: SharedPsiElementImplUtil.getChildIndex)
(cherry picked from commit 8632790)
2016-08-10 13:28:45 +02:00
Mikhail Glukhikh
56869950c8 Do not report USELESS_CAST when casting null to nullable (special case)
(cherry picked from commit 687698d)
2016-08-10 12:36:39 +03:00
Mikhail Glukhikh
fbb9b09870 Minor: imports removed, formatting
(cherry picked from commit 8d537d2)
2016-08-10 12:29:34 +03:00
Mikhail Glukhikh
5dc7975b95 CAST_NEVER_SUCCEEDS: do not report when casting nullable to nullable #KT-260 Fixed
(cherry picked from commit 098520d)
2016-08-10 12:29:18 +03:00
Ilya Gorbunov
026134e7e0 Changelog for 1.0.4: stdlib changes
(cherry picked from commit 0ce4bce)
2016-08-09 19:08:03 +03:00
Ilya Gorbunov
08201ddb9f Docs: clarify docs for 'generateSequence'.
(cherry picked from commit ae985e24ca)
2016-08-09 18:18:26 +03:00
Ilya Gorbunov
c544ed1b70 Docs: preserve empty lines in the generated documentation to separate summary and paragraphs in the body.
(cherry picked from commit fed24c2be6)
2016-08-09 18:18:25 +03:00
Ilya Gorbunov
a245ec691d Improve FileTreeWalk documentation,
#KT-13297 Fixed

(cherry picked from commit e31167e74f)
2016-08-09 18:18:24 +03:00
Ilya Gorbunov
e933f8ebcd Document that sequences could be iterated multiple times.
#KT-13115 Fixed

(cherry picked from commit e7d250b7d7)
2016-08-09 18:18:22 +03:00
Ilya Gorbunov
69309a038e Support platform null sneaking to Closeable.use.
#KT-12894
2016-08-09 18:15:23 +03:00
Alexander Udalov
51aa31c5a5 CLI, Ant: add kotlin-reflect.jar to classpath by default, support "-no-reflect"
Note that now "-no-stdlib" implies "-no-reflect".

 #KT-13237 Fixed

(cherry picked from commit 0d26087040)
2016-08-09 11:27:32 +03:00
Mikhail Glukhikh
7606b1db1f Minor: test comment, relevant to KT-13322 2016-08-08 19:24:11 +03:00
Mikhail Glukhikh
5ac31268c8 Rewrite slice error removed for LEAKING_THIS #KT-13371 Fixed
Also EA-86478 fixed
2016-08-08 19:24:01 +03:00
Mikhail Glukhikh
94d3b4c2de Correct CFA order for enums: first own members, then entries, and at last companion object members #KT-6054 Fixed 2016-08-08 19:02:36 +03:00
Mikhail Glukhikh
7b2857f261 Report UNINITIALIZED_VARIABLE also for qualified object property #KT-12809 Fixed 2016-08-08 14:36:33 +03:00
Mikhail Glukhikh
76ac6d1571 UNINITIALIZED_ENUM_ENTRY compiler warning introduced #KT-2349 Fixed 2016-08-08 14:36:28 +03:00
Mikhail Glukhikh
4b09de89a0 CFA: No more UNRESOLVED_CALL for object / enum entry qualifiers 2016-08-08 14:36:23 +03:00
Mikhail Glukhikh
a1394bc39c ControlFlowInformationProvider: convert to Kotlin 2016-08-08 14:36:18 +03:00
Mikhail Glukhikh
28bb9ea90c ControlFlowInformationProvider.java --> ControlFlowInformationProvider.kt 2016-08-08 14:36:13 +03:00
Mikhail Glukhikh
e0d7f78bd4 DataFlowValueFactory: converted to Kotlin
(cherry picked from commit 7f9b9dd)
2016-08-08 14:36:08 +03:00
Mikhail Glukhikh
f34c9ba5c6 DataFlowValueFactory.java --> DataFlowValueFactory.kt
(cherry picked from commit b1a2a07)
2016-08-08 14:36:03 +03:00
Valentin Kipyatkov
32c6eac1f6 KT-12793 Code completion doesn't suggest abstract protected extension methods
#KT-12793 Fixed
(cherry picked from commit 6ff91d1)
2016-08-05 19:38:18 +03:00
Zalim Bashorov
5ccd5246eb JS backend: add the ability to get JS constructor function by class name and from instance. Support it for reified type parameters too. Add ability to get name of class.
#KT-5987 Fixed
 #KT-4115 Fixed
(cherry picked from commit 88ad00b)
2016-08-05 18:37:46 +03:00
Zalim Bashorov
29da38a9d2 JS backend: always (explicitly) generate constructor function for classes. Use name of class as name of constructor function when it isn't special.
#KT-4115 In Progress
(cherry picked from commit e7eb35b)
2016-08-05 18:37:05 +03:00
Nikolay Krasko
8a6fe3c1b7 Minor: rename variables 2016-08-05 16:42:06 +03:00
Nikolay Krasko
886a36da8f Decrease xmx in tests 2016-08-05 16:42:05 +03:00
Nikolay Krasko
67022ab0f8 Use nullable value and destroy it in tearDown for REPL tests 2016-08-05 16:42:03 +03:00
Nikolay Krasko
78a983c952 Fix compile error 2016-08-05 16:42:02 +03:00
Alexey Andreev
96612cae72 JS: add tests to show that #KT-12865 fixed as well 2016-08-05 16:34:27 +03:00
Alexey Andreev
861a6821a6 KT-12864: add Comparable interface to Enum metadata so that RTTI should handle is Comparable case correctly 2016-08-05 16:34:26 +03:00
Nikolay Krasko
4f466b168c Report RETURN_NOT_ALLOWED and RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY only on the return with label (KT-13340)
#KT-13340 Fixed
(cherry picked from commit 300e0ac)
2016-08-05 15:03:22 +03:00
Michael Bogdanov
0db13823e1 Disable kt13133 test on android
(cherry picked from commit 67808ef)
2016-08-05 14:17:25 +03:00
Stanislav Erokhin
e2a9c956bf Add more debug info for EA-85303 and EA-79267 2016-08-04 17:59:20 +03:00
Alexey Tsvetkov
767329fcab Update changelog for 1.0.4 2016-08-04 11:26:03 +03:00
Pavel V. Talanov
74e6d59885 Add assertions to prohibit creating LazyJavaClassDescriptor by KtLightClass
Diagnosing KT-12966
2016-08-03 17:54:07 +03:00
Pavel V. Talanov
7a4c9ab1f2 KtLightClassForDecompiledDeclaration is now marked by KtLightClassMarker
Rename: KtJavaMirrorMarker -> KtLightClassMarker
Introduce code to be able to tell light classes from source and binaries apart in 'frontend.java'
2016-08-03 17:53:54 +03:00
Alexey Tsvetkov
150b1c2640 Update changelog for 1.0.4 2016-08-03 14:59:39 +03:00
Alexey Tsvetkov
ae39a58614 Configure KotlinCompile.destinationDir before evaluation
Previously it was possible to refer to destinationDir
in gradle scripts (evaluation phase), so in order to
preserve compatibility destinationDir should be configured
before evaluation.

This does not affect android plugin because in this case kotlin
tasks were created after evaluation anyway, so it
was not possible to refer to destinationDir
during evaluation anyway.
2016-08-02 20:59:03 +03:00
shiraji
45d82f1cb7 Intention / inspection for unnecessary lateinit #KT-13011 Fixed 2016-08-02 19:52:32 +03:00
Nikolay Krasko
f7830a5843 Ignore intervals that has no mapping for origin line (KT-12896)
(cherry picked from commit a9ee10a)
2016-08-02 13:29:53 +03:00
Nikolay Krasko
aa50374705 Better search for inlined strings in strata: there might me several file mappings to the same file (KT-12896)
#KT-12896 In Progress
(cherry picked from commit 2dd7470)
2016-08-02 13:29:51 +03:00
Nikolay Krasko
7fcc7795ad Refactorings: functions moves
(cherry picked from commit ace58e8)
2016-08-02 13:29:50 +03:00
Nikolay Krasko
f7d162476a Fix breakpoints in inline functions after dexing (KT-12896)
#KT-12896 In Progress
(cherry picked from commit 5df7358)
2016-08-02 13:29:48 +03:00
Nikolay Krasko
7fa096bc43 Allow to step into inline functions while debugging Android app (KT-12896)
#KT-12896 In Progress
(cherry picked from commit 64979ae)
2016-08-02 13:29:47 +03:00
Nikolay Krasko
908debe7eb Emulate debugging after dexing for stepping tests with 'dex' prefix (KT-12896)
Remove SourceDebugExtension attribute from resulting class files

 #KT-12896 In Progress
(cherry picked from commit 2a2d7cd)
2016-08-02 13:29:45 +03:00
Nikolay Krasko
134824549a Refresh output dirs to make CompilerPaths.getModuleOutputDirectory() method work
(cherry picked from commit ad1907f)
2016-08-02 13:29:44 +03:00
Nikolay Krasko
b4f3df9224 Refactoring: introduce constants with strata names and reuse them in debugger
(cherry picked from commit 64e0349)
2016-08-02 13:29:42 +03:00
Nikolay Krasko
b8e96c48e2 Refactoring: move smapUtil and DebuggerUtils to debugger package
(cherry picked from commit 66bbcf4)
2016-08-02 13:29:41 +03:00
Mikhail Glukhikh
4c7a42ad29 KT-13113 related: KtStringTemplateExpression.singleExpressionOrNull() fixed 2016-08-02 12:59:56 +03:00
Mikhail Glukhikh
266f9d0d40 Single-expression string template is inspection for strings and intention otherwise #KT-13113 Fixed 2016-08-02 12:42:22 +03:00
shiraji
49a3ef35a7 KT-13113: Add inspection to detect single-expression string template 2016-08-02 12:42:08 +03:00
Mikhail Glukhikh
7f6be5b0bd Build fix: replace call with comparison inspection test 2016-07-29 19:46:40 +03:00
Mikhail Glukhikh
8f13c84e7c KT-13262 related: surround with null check is applicable now also for qualified calls with argument type mismatch 2016-07-29 19:17:04 +03:00
Mikhail Glukhikh
7044348086 Wrap with safe let call handles qualified calls correctly #KT-13262 Fixed 2016-07-29 19:14:01 +03:00
Mikhail Glukhikh
042fc0d3b8 Replace call with comparison inspection introduced #KT-11425 Fixed 2016-07-29 19:07:04 +03:00
Mikhail Glukhikh
7219904a87 KT-11425: convert a.compareTo(b) to binary comparison if possible 2016-07-29 19:06:37 +03:00
Mikhail Glukhikh
56c7786756 KT-11425: convert !a.equals(b) to a != b 2016-07-29 18:55:58 +03:00
Mikhail Glukhikh
5d47fdf557 KT-11425: replace call with binary operator works now also with equals() and == 2016-07-29 18:32:02 +03:00
Mikhail Glukhikh
679867bff9 ReplaceInfixCallFix --> ReplaceInfixOrOperatorCallFix 2016-07-29 18:27:27 +03:00
Mikhail Glukhikh
208798d4b0 Replace with safe call works now on UNSAFE_IMPLICIT_INVOKE #KT-12628 Fixed 2016-07-29 18:27:23 +03:00
Mikhail Glukhikh
56c9d7ecac KT-12628: !! is now correctly added to array expressions 2016-07-29 18:27:19 +03:00
Mikhail Glukhikh
3d67f8432e KT-12628: replace infix call supports now array accesses too 2016-07-29 18:27:14 +03:00
Mikhail Glukhikh
a7e4e2d5b0 KT-12628: new test for arg + something with nullable arg 2016-07-29 18:27:10 +03:00
Stanislav Erokhin
24b5be3ebe KT-13264 IAE: Argument for @NotNull parameter 'errorClass' createErrorTypeConstructorWithCustomDebugName must not be null
#KT-13264 Fixed
(cherry picked from commit aa91b5a)
2016-07-29 18:12:15 +03:00
Stanislav Erokhin
f6f5af9baa Do not add receiver for function expression by expected type.
(cherry picked from commit 2c2f105)
2016-07-29 18:12:14 +03:00
Mikhail Glukhikh
dd30bd5749 Make constructor parameter a property: additional test for private property in superclass 2016-07-29 17:58:21 +03:00
Mikhail Glukhikh
dc8c19590e Make constructor parameter a property: select 'private' to be able to remove it #KT-13187 Fixed 2016-07-29 17:58:16 +03:00
Mikhail Glukhikh
19389093c2 Make constructor parameter a property: message shortened a bit 2016-07-29 17:58:12 +03:00
Alexey Tsvetkov
3af7494d94 Add additional java source dir to source set in android test 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
57f721bb6e Refactoring: extract function to map classpath 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
9795864e30 Move call to kotlinTask.source to doTargetSpecificProcessing 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
4b825509ca Refactoring: move mapKotlinTaskProperties call to createKotlinJVMTask 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
c808fc368f Refactor classpath handling in KotlinCompile
#KT-13234 fixed
2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
167a83970d Add test for code using internal compiled incrementally
The issue was fixed during refactoring

    #KT-12923 fixed
2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
7a06d4dfe2 Track changes in generated source files
#KT-12962 fixed
2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
535ca5ddd4 Refactoring: simplify source roots search 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
7397e05aa4 Refactoring: use convention mapping for configuring classpath of kotlin tasks
#KT-12658 fixed
    #KT-12750 fixed
2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
cc5a3caf55 Refactor source configuration for android 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
c51ec9a67d Minor: cleanup 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
a8a021306e Refactoring: set task properties directly 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
28eb5c8d8e Refactoring: remove extra property to pass stubs directory 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
207b609f95 Refactoring: do not use extraProperties to pass kapt options to task 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
d65a31bea1 Refactoring: remove reflection calls 2016-07-29 17:52:28 +03:00
Alexey Tsvetkov
bf1af18dd6 Refactoring: remove remainings of custom classloader in gradle plugin 2016-07-29 17:52:28 +03:00
Pavel V. Talanov
bf68d4286a Fix compilation with '1.0.x' compiler 2016-07-29 14:55:41 +03:00
Pavel V. Talanov
9a4a7cadac Sync code in 'idea-ultimate' 2016-07-29 14:55:40 +03:00
Pavel V. Talanov
d5e8b7ab18 Fix test data 2016-07-29 14:55:38 +03:00
Pavel V. Talanov
6455c838c5 KtLightClassForSourceDeclaration.create(): check for enum entry earlier 2016-07-29 14:55:36 +03:00
Pavel V. Talanov
c0ed8b0158 LightClassDataProvider: FqName calculation is redundant now 2016-07-29 14:55:35 +03:00
Pavel V. Talanov
2fefba0802 Light class test for classes with dollars in name 2016-07-29 14:55:33 +03:00
Pavel V. Talanov
57c3f90ff2 PsiChecker test for classes with dollars in name 2016-07-29 14:55:32 +03:00
Pavel V. Talanov
985c78ea56 StubClassBuilder: correctly calculate short name when building delegates for light classes 2016-07-29 14:55:30 +03:00
Pavel V. Talanov
945e7e7889 Do not build light classes for scripts
Supports old behaviour
2016-07-29 14:55:28 +03:00
Pavel V. Talanov
5baa962dde FqName is not required to create source light classes 2016-07-29 14:55:27 +03:00
Pavel V. Talanov
e8e2d89314 Drop KtLightClass#getFqName() and some usages of classFqName in KtLightClassForDecompiledDeclaration 2016-07-29 14:55:25 +03:00
Pavel V. Talanov
2cddd4220a Local classes do not have qualified names
Mirros java psi
2016-07-29 14:55:24 +03:00
Pavel V. Talanov
43d37ff0a4 Refactor: restructure light class hierarchy for sources
KtLightClassBase
	| KtLightClassForSourceDeclaration
		| KtLightClassImpl (new!) // top level or inner/nested of top level class
		| KtLightClassForInterfaceDefaultImpls
		| KtLightClassForLocalDeclaration (new!)
			| KtLightClassForAnonymousDeclaration
				| KtLightClassForEnumEntry
2016-07-29 14:55:22 +03:00
Pavel V. Talanov
62e5fdac78 Refactor: rename KtWrappingLightClass -> KtLightClassBase 2016-07-29 14:55:21 +03:00
Pavel V. Talanov
186409902f Refactor: rename KtLightClassForExplicitDeclaration -> KtLightClassForSourceDeclaration 2016-07-29 14:55:19 +03:00
Pavel V. Talanov
a7a01654d7 Refactor: move KotlinCodeBlockModificationListener to 'idea-analysis' module 2016-07-29 14:55:17 +03:00
Pavel V. Talanov
d19e81716c Refactor: move OldPackageFacadeClassUtils to 'frontend.jvm' module 2016-07-29 14:55:16 +03:00
Pavel V. Talanov
83f38a03d9 Refactor: split classes in 'asJava' package into several subpackages to reflect their structure 2016-07-29 14:55:14 +03:00
Nikolay Krasko
02c7528cb2 Refactoring: move KtLightField interface to file with light elements 2016-07-29 14:55:12 +03:00
Pavel V. Talanov
d94b98dbc0 Drop PsiCodegenPredictor 2016-07-29 14:55:10 +03:00
Nikolay Krasko
f67f051b8f Postpone counting fqName for anonymous classes (KT-12645)
#KT-12645 Fixed
2016-07-29 14:55:09 +03:00
Alexander Udalov
0c0c8364ae Fix test data after bc8953b 2016-07-29 14:43:55 +03:00
Nikolay Krasko
d9715cc286 Refactoring: extract DebuggerClassNameProvider
(cherry picked from commit 5a5cd0e)
2016-07-28 16:07:39 +03:00
Nikolay Krasko
8466158c0d Minor: invert if, clean up
(cherry picked from commit 50e196d)
2016-07-28 16:07:38 +03:00
Nikolay Krasko
95592e83b0 Refactoring: fix weak warning about unnecessary escaped dot
(cherry picked from commit 097288d)
2016-07-28 16:07:36 +03:00
Nikolay Krasko
8237c71aa4 Refactoring: extract pattern to variable and add language injection
(cherry picked from commit e7ee0d1)
2016-07-28 16:07:34 +03:00
Nikolay Krasko
8384e2fe76 Refactoring: additional changes in smap functions and KotlinExceptionFilter
(cherry picked from commit 071285f)
2016-07-28 16:07:33 +03:00
Nikolay Krasko
27b44e7383 Refactoring: working with smap methods
(cherry picked from commit f71e244)
2016-07-28 16:07:32 +03:00
Nikolay Krasko
24d3bc60ec Refactoring: extract functions working with smap to separate file
(cherry picked from commit fcf0b7a)
2016-07-28 16:07:30 +03:00
Stanislav Erokhin
8903350918 Add assertion for variable as function call with explicit type parameters.
(cherry picked from commit f3be1b8)
2016-07-27 18:49:57 +03:00
Alexey Andreev
8e3d8169b7 KT-13160: when decomposing assignment with lhs like array[index], extract array instead of supporting only qualifier.name` 2016-07-27 18:38:03 +03:00
Dmitry Petrov
515570c935 KT-13241 Indices optimization leads to VerifyError with smart cast receiver
Use expected receiver type from the corresponding extension function.
2016-07-27 12:55:00 +03:00
Alexander Udalov
8bdca3b31e Never resolve modality of members to SEALED
(cherry picked from commit 0380b6cd88)
2016-07-26 22:19:05 +03:00
Alexander Udalov
7d2fbd683d Fix algorithm of determining modality for fake overrides
Previously we inferred "open" if there was at least one open member in the
hierarchy. However, that's not correct when that member is overridden by
another member in the hierarchy which is abstract. This led to incorrect code
being accepted by the front-end, and an exception during the bridge generation

 #KT-12467 Fixed

(cherry picked from commit b72293883d)
2016-07-26 22:16:57 +03:00
Mikhail Glukhikh
63435b4d77 Cast never succeeds: special 'Nothing' / 'Nothing?' case 2016-07-26 19:43:35 +03:00
Mikhail Glukhikh
68af26c994 Standard library regenerated 2016-07-26 19:43:29 +03:00
Mikhail Glukhikh
feab6f3262 kotlin-stdlib-gen: UNCHECKED_CAST instead of CAST_NEVER_SUCCEEDS 2016-07-26 19:43:23 +03:00
Mikhail Glukhikh
7d9aa0449f Suppress CAST_NEVER_SUCCEEDS removed from standard library code 2016-07-26 19:43:18 +03:00
Mikhail Glukhikh
d448a920ec Suppress CAST_NEVER_SUCCEEDS removed from source code 2016-07-26 19:43:12 +03:00
Mikhail Glukhikh
5fc797a3ef CAST_NEVER_SUCCEED: replace subtyping check with subclassing check #KT-13206 Fixed 2016-07-26 19:43:06 +03:00
Mikhail Glukhikh
47fd9906d5 KT-13170 related: correct handling of inspection parameters in additional checker 2016-07-26 19:17:21 +03:00
Mikhail Glukhikh
0589b4829a Has platform type inspection: do not report by default on Kotlin types with platform arguments #KT-13170 Fixed
Also #KT-12820 Obsolete
2016-07-26 19:17:16 +03:00
Mikhail Glukhikh
57eb4c1fcb Can be val inspection: local functions are taken into account #KT-13151 Fixed 2016-07-26 19:16:27 +03:00
Nikolay Krasko
501f2d199b Don't store analyze result longer than ModuleResolverProvider valid time
For synthetic files there might be file modifications without PsiModificationTracker.MODIFICATION_COUNT increment.
2016-07-26 17:45:00 +03:00
Nikolay Krasko
5c3e65da8c Remove psi modification tracker from pooled threads (EA-86038, KT-13163)
IDEA 163 explicitly forbids such tricks with exceptions.
(cherry picked from commit 3c8e35f)

 #KT-13163 Fixed
2016-07-26 17:24:55 +03:00
Michael Bogdanov
c1c53b42d6 Test for KT-13182: Regression: compiler internal error at inline
(cherry picked from commit 9b9abb2)
2016-07-26 16:18:54 +03:00
Michael Bogdanov
3e807149d9 Fix for KT-13133: Incorrect InnerClasses attribute value for anonymous object copied from an inline function
#KT-13133 Fixed
(cherry picked from commit 99cdc41)
2016-07-26 16:18:07 +03:00
Nikolay Krasko
f05364c8f9 Run SafeDeleteFix without run action to avoid "Refactorings should not be started inside write action" (KT-13207)
(cherry picked from commit a0226f3)
 #KT-13207 Fixed
2016-07-26 13:57:41 +03:00
Nikolay Krasko
919ef3c8ad Add "Studio" as version separator (KT-13184)
#KT-13184 Fixed
2016-07-26 13:57:41 +03:00
Alexander Udalov
54e81bc6b9 Move tests on KClass.java* to box/classLiteral/java
Also replace WITH_REFLECT to WITH_RUNTIME to test that these cases correctly
work without reflection in the classpath

(cherry picked from commit 0ea885ce58)
2016-07-26 13:53:56 +03:00
Alexander Udalov
ed8601797d Minor, make JavaClassProperty intrinsic a singleton
(cherry picked from commit 28dc5d788c)
2016-07-26 13:52:38 +03:00
Pavel V. Talanov
f326b95703 Show all Kotlin annotations when browsing hierarchy of "java.lang.Annotation" 2016-07-26 11:43:48 +03:00
Pavel V. Talanov
2c7d02fb7d Index enum classes as if they have "Enum" in supertypes
#KT-13057 Fixed
2016-07-26 11:43:36 +03:00
Pavel V. Talanov
9cc7591f90 Add test for KT-13057 with infrastructure 2016-07-26 11:43:25 +03:00
Alexey Andreev
491210db1e KT-12275 Add JS optimization that transforms the following code
```
do {
    X
    if (B) break;
} while (A)
```

to

```
do {
    X
} while (!B && A)
```

Add inversion that takes boolean expression and applies negation to it, simplifying if possible (like !!a => a).
2016-07-25 18:49:09 +03:00
Alexey Andreev
ce9fc1030a KT-12275 Add JS optimization that transforms the following code
```
do {
    guard: {
        // do something
        break guard;
        // do something
    }
} while (condition)
```

to

```
do {
    // do something
    continue;
    // do something
} while (condition)
```
2016-07-25 18:49:09 +03:00
Alexey Andreev
62f21eef3a KT-12275 Preserve evaluation order when do..while loop with extractable condition contains continue statement 2016-07-25 18:49:08 +03:00
Alexander Udalov
0e0d818006 Fix compilation 2016-07-25 16:42:23 +03:00
Alexander Udalov
c930b4f7c1 Minor, add comment, remove warning suppression
(cherry picked from commit 3ef3bb8251)
2016-07-25 15:58:04 +03:00
Alexander Udalov
cd37eded97 Move some members from OverrideResolver to OverridingUtil
(cherry picked from commit d945c33d5e)
2016-07-25 15:57:55 +03:00
Alexander Udalov
88ce657e1b Minor, inline HashSetUtil#symmetricDifference
(cherry picked from commit aaf618e035)
2016-07-25 15:57:13 +03:00
Alexander Udalov
03b32e74fa Simplify OverrideResolver#filterOverrides
- move source vs binary equivalent call filtering hack to
  ResolutionResultsHandler (see c4778bfe5a for
  the original commit introducing this behavior)
- rewrite the algorithm so that it doesn't need noDuplicates in the beginning:
  modulo the hack above whish is only needed in ResolutionResultsHandler,
  descriptor equivalence is checked anyway in OverrideResolver#overrides

(cherry picked from commit 475fb6e8a7)
2016-07-25 15:57:09 +03:00
Alexander Udalov
4c015924c5 Move OverrideResolver#generateOverridesInAClass to CollectionStubMethodGenerator
Also simplify substantially

(cherry picked from commit a6faab834d)
2016-07-25 15:57:05 +03:00
Alexander Udalov
33a787f4ae Use kotlin.Function1 instead of intellij Function in OverrideResolver
(cherry picked from commit bbd1e889a6)
2016-07-25 15:57:00 +03:00
Alexander Udalov
a50ad588ad Remove OverrideResolver#filterOutOverriding, simplify the only usage
(cherry picked from commit 191f532675)
2016-07-25 15:56:56 +03:00
Alexander Udalov
2c4128b50c Remove unreachable code in ResolutionResultsHandler
(cherry picked from commit 5d04fa3c2f)
2016-07-25 15:56:52 +03:00
Alexander Udalov
bb6414a217 Move utilities used in IDE from OverrideResolver to descriptorUtils.kt
(cherry picked from commit 89c5799155)
2016-07-25 15:56:40 +03:00
Alexander Udalov
cb510a993e Remove unnecessary loop from OverrideResolver#filterOverrides
It was not needed because overridability in both ways is already checked in
DescriptorEquivalenceForOverrides, which is called in
OverrideResolver#overrides

(cherry picked from commit 24c383a009)
2016-07-25 15:56:11 +03:00
Alexey Tsvetkov
bcf3db7979 Update changelog 2016-07-25 15:53:46 +03:00
Kirill Rakhman
39e0cb9cd4 Quickfix "Make primary constructor parameter a val" makes the val private now
Fixes #KT-13187
(cherry picked from commit ce80f94)
2016-07-25 12:29:02 +03:00
Yoshinori Isogai
90180172bc KT-12887 Extend selection should select call's invoked expression (#904)
#KT-12887 fixed
(cherry picked from commit 8aaf28e)
2016-07-22 20:28:59 +02:00
Alexander Udalov
bc8953b957 Remove quotes around visibility in invisible member diagnostic
(cherry picked from commit 83000c50ff)
2016-07-22 18:15:52 +03:00
Alexander Udalov
81c5211007 Improve error message for inaccessible invisible_fake members
#KT-8989 Fixed

(cherry picked from commit b6b2303aa7)
2016-07-22 18:15:50 +03:00
Alexander Udalov
67465fda94 Do not report "reflection is not available" on built-in sources
(cherry picked from commit a92f0a0446)
2016-07-22 18:15:47 +03:00
Alexander Udalov
289b8682a9 Check presence of dispatch receiver parameter in modifier checks
Also fix typo in "inapplicable infix" diagnostic message

(cherry picked from commit 9be219b69c)
2016-07-22 18:15:38 +03:00
Alexander Udalov
e4c7395950 Fix quotes in diagnostic messages
See 8316953259

(cherry picked from commit 2a390155a9)
2016-07-22 18:15:32 +03:00
Mikhail Glukhikh
5232af595c KT-10903 Lambda to callable reference: use named arguments if needed, lift restriction about parameter default values 2016-07-22 17:24:08 +03:00
Kirill Rakhman
4755596301 AddConstModifierIntention: handle more edge cases #KT-13173 Fixed 2016-07-22 16:13:54 +03:00
Nikolay Krasko
f1d463fd80 Do not fail on adding sources to libraries that can't be recognized (EA-73238)
It's valid situation when user in Gradle project had created ordinal Java module and wants to configure
it with Kotlin. We should add Gradle library to dependency but there's no need to configure sources for it.

(cherry picked from commit adbb07f)
2016-07-22 15:30:34 +03:00
Nikolay Krasko
af53d56d47 Minor: fix warning
(cherry picked from commit 0f4319d)
2016-07-22 15:30:33 +03:00
Nikolay Krasko
2f93710e92 Evaluate getting text under read action (EA-82155, EA-82587)
(cherry picked from commit 95d0604)
2016-07-22 15:30:31 +03:00
Nikolay Krasko
8824c1fa0d Don't fail if there's no modules in combobox with unconfigured modules (EA-76203)
Confirmed reproduction steps:
1. Open Kotlin gradle project (or do the sync) - it will be considered unconfigured until synchronisation is finished
2. Click configure and see Choose Configuration popup
3. Wait sync is finished
4. Click proposed configurator in popup

As all projects are considered configured now, single module selection will be empty
(cherry picked from commit 3d0cfdf)
2016-07-22 15:30:30 +03:00
Alexander Udalov
d581e4a08c Fix type of reference to protected var
#KT-12982 Fixed

(cherry picked from commit 9ab8da2ef9)
2016-07-22 12:07:54 +03:00
Alexander Udalov
52979fd215 Minor, inline LexicalScope.Companion.empty
(cherry picked from commit 6baf3ae737)
2016-07-22 12:07:54 +03:00
Alexander Udalov
a29ef253bf Simplify code in callable reference resolution
(cherry picked from commit 2fcd4e955a)
2016-07-22 12:07:54 +03:00
Alexander Udalov
50f9dc364b Fix "rewrite at slice LEXICAL_SCOPE" during callable reference resolution
Following the TODO in CallableReferencesResolutionUtils.kt, delete the
suspicious scope and use the new resolution process with the qualifier which
was obtained after the resolution of LHS. However, by default the tower
resolution algorithm also considers each qualifier as a class value as well,
which would be wrong here because resolution of LHS as a "value" happens
earlier in DoubleColonExpressionResolver and with slightly different rules. To
avoid that, do not mix in the "explicit receiver" scope tower processor when
creating processors for callable reference resolution.

Also delete unused functions and classes related to deleted scope, refactor
Scopes.kt

 #KT-8596 Fixed

(cherry picked from commit 00f1415ed7)
2016-07-22 12:07:54 +03:00
Mikhail Glukhikh
e5ecad7379 Build fix: inconsistency with master in *.txt rendering in tests 2016-07-22 11:56:39 +03:00
Mikhail Glukhikh
f47cd6e9d5 Source code cleanup: leaking this quick fixes applied
(cherry picked from commit 31cdc91)
2016-07-22 10:17:36 +03:00
Mikhail Glukhikh
28261f651b KT-12152: quick fix "make final" for member / containing class
(cherry picked from commit de3fbe3)
2016-07-22 10:16:13 +03:00
Mikhail Glukhikh
4c7d96160d KT-12152 : leaking this inspection: accessing non-final member / this in non-final class
(cherry picked from commit a22e7d3)
2016-07-22 10:16:02 +03:00
Mikhail Glukhikh
f8b0dafb04 KT-12152 : constructor consistency: non-final function calls
(cherry picked from commit 3d6bd81)
2016-07-22 10:15:30 +03:00
Mikhail Glukhikh
d940b1138b KT-12152 : constructor consistency: distinguish properties with and w/o backing fields, with default / custom accessors
(cherry picked from commit be40cf8)
2016-07-22 10:15:18 +03:00
Mikhail Glukhikh
e0dbef4dd5 KT-12152 : constructor consistency: handle open property accessing
(cherry picked from commit 422ea4c)
2016-07-22 10:15:08 +03:00
Mikhail Glukhikh
314615c8fa KT-12152 : constructor consistency: handle non-final classes
(cherry picked from commit f7b5d67)
2016-07-22 10:14:53 +03:00
Mikhail Glukhikh
0ceabd434f KT-12152 : constructor consistency analysis, base cases
(cherry picked from commit 8e18165)
2016-07-22 10:14:42 +03:00
Michael Bogdanov
6392b1cb8d 'superConstructorCall' test folder moved under 'innerNested'
(cherry picked from commit 1d5924d)
2016-07-21 19:12:21 +03:00
Michael Bogdanov
7f1e28ad94 Removed obsolete code in 'lookupConstructorExpressionsInClosureIfPresent' method
(cherry picked from commit 55382ba)
2016-07-21 19:12:18 +03:00
Michael Bogdanov
be56010608 Fix for KT-11833: Error generating constructors of class null with kind IMPLEMENTATION on anonymous object inheriting from nested class of super class
#KT-11833 Fixed
(cherry picked from commit 5dca4db)
2016-07-21 19:12:15 +03:00
Mikhail Glukhikh
2ac8a66ad9 A pair of "Suppress" changed from CAST_NEVER_SUCCEEDS to UNCHECKED_CAST 2016-07-21 15:35:19 +03:00
Mikhail Glukhikh
2629d5502b Array<Subtype> can be now cast to Array<Supertype(?)> without CAST_NEVER_SUCCEEDS #KT-6391 Fixed 2016-07-21 15:35:16 +03:00
Mikhail Glukhikh
9e6f4bf5d7 KT-6391: Arrays with same erased types counted as cast-compatible now 2016-07-21 15:35:13 +03:00
Mikhail Glukhikh
731a6704ab Remove setter parameter type inspection #KT-5771 Fixed 2016-07-21 15:22:28 +03:00
Alexey Tsvetkov
4df0432d83 Update changelog for 1.0.4 2016-07-21 14:59:03 +03:00
Alexey Tsvetkov
bf00a7c0e3 Update changelog for 1.0.4 2016-07-20 22:31:55 +03:00
Michael Bogdanov
f1ee066bd5 'getSuperCallLabelTarget' refactoring
(cherry picked from commit 6da9702)
2016-07-20 16:59:34 +03:00
Michael Bogdanov
bc70b0d822 Fix for KT-11634: UOE in ConstructorContext.getOuterExpression for super call in delegation
#KT-11634 Fixed
(cherry picked from commit 6f41e3b)
2016-07-20 16:59:32 +03:00
Natalia Ukhorskaya
0de42d9660 Debugger: check that label for marked object is a valid java identifier (KT-12651)
#KT-12651 Fixed
2016-07-19 17:56:15 +03:00
Nikolay Krasko
216c7c04b1 Remove call invokeAndWait() under read lock in debugger (KT-13037)
Call to invokeAndWait() in dispatch thread or in situation when read lock isn't held left untouched. Can't remove invokeAndWait() completely because without the
progress bar idea looks to be stacked on debugger start because of long search for inline functions usages (searching for breakpoints places).

 #KT-13037 Fixed
2016-07-19 16:22:47 +03:00
Mikhail Glukhikh
d9818bd3a5 Grammar: obsolete 'annotationEntry' changed to 'unescapedAnnotation' in a few places 2016-07-19 15:02:55 +03:00
Mikhail Glukhikh
7bdf55646e Grammar: obsolete 'package' element removed #KT-8429 Fixed 2016-07-19 15:02:52 +03:00
Mikhail Glukhikh
904a18cf08 A set of soft modifiers added to grammar #KT-13143 Fixed 2016-07-19 15:02:48 +03:00
Dmitry Jemerov
ba5760c913 fix muted test KotlinFindUsagesWithLibraryTestGenerated$KotlinLibrary.testLibraryCompanionObjectUsages
(cherry picked from commit 3ad6dae)
2016-07-19 13:28:22 +02:00
Dmitry Jemerov
59fcab987c in REPL tests, wait for process destroyed handler to fire after destroying process and before performing the rest of dispose
(cherry picked from commit dc0020b)
2016-07-19 13:28:16 +02:00
Dmitry Jemerov
b5a0cef907 fix muted test MultiFileIntentionTestGenerated.testImplementAbstractMember_implementVarInJava_ImplementAllInJava: apply intention in deterministic order, remove trailing space in expected output file
(cherry picked from commit 30f00bb)
2016-07-19 11:29:53 +02:00
Dmitry Jemerov
fa8d62c834 fix testdata for muted test IntentionTestGenerated$ReplaceItWithExplicitFunctionLiteralParam.testApplicable_nestedFunctionWithIt
(cherry picked from commit 9100ca8)
2016-07-19 11:29:53 +02:00
Kirill
a9bfb336f9 Implement quickfix for wrong long suffix
Fixes: KT-13134
(cherry picked from commit b9d235d)
2016-07-19 09:52:17 +03:00
Alexey Andreev
536f5f04d1 JS: in tests add verifier that checks whether no expression statements with only null expression exist 2016-07-18 19:31:40 +03:00
Alexey Andreev
4722752fd0 JS: add TranslationContext.cacheExpressionIfNeeded and use it where possible 2016-07-18 19:31:40 +03:00
Alexey Andreev
03d3035efe JS: add tests for support of 'for' statement in TemporaryAssignmentElimination 2016-07-18 19:31:40 +03:00
Alexey Andreev
d0d66f7719 JS: add tests to prove that KT-8003, KT-8318 and KT-12157 are no longer reproducible 2016-07-18 19:31:39 +03:00
Alexey Andreev
06bab7aa15 JS: minor code style and formatting fixes 2016-07-18 19:31:39 +03:00
Alexey Andreev
1e018388b6 JS: refactor generation of temporary variables 2016-07-18 19:31:39 +03:00
Alexey Andreev
fffec436a5 JS: get rid of JsEmptyExpression, use JsLiteral.NULL instead, rely on optimizer to remove redundant code 2016-07-18 19:31:38 +03:00
Alexey Andreev
f389c17c30 JS: during translation of expression mark assignment to temporary variables as synthetic statement.
This helps optimizer to find and eliminate temporary variables.
2016-07-18 19:31:38 +03:00
Dmitry Jemerov
73ec2163b6 to reduce VM contention between JVM with tests and JVM with Ant, run Ant with -Xmx128m
(cherry picked from commit 82babaf)
2016-07-18 17:01:34 +02:00
Dmitry Jemerov
54d61dc86b to ensure that JNA uses the DLL version from the jar and not an incompatible version that happens to be available on the machine running the tests, run tests with -Djna.nosys option
(cherry picked from commit 5224ad7)
2016-07-18 17:01:27 +02:00
Dmitry Jemerov
38341e0acd delete work dir after each JPS test
(cherry picked from commit b315a07)
2016-07-18 17:01:19 +02:00
Mikhail Glukhikh
5cafae59e1 KotlinJUnitStaticEntryPoint.wasSelected made public field #KT-13114 Fixed 2016-07-18 14:19:36 +03:00
Mikhail Glukhikh
ce0c43c59a Lambda to callable reference: inspection is optional depending on text length 2016-07-18 12:20:04 +03:00
Mikhail Glukhikh
b620099f32 Convert lambda to callable reference intention / inspection #KT-10903 Fixed 2016-07-18 12:19:47 +03:00
Denis Zharkov
f316973e12 Fix test data after 4725dd3 2016-07-16 09:12:57 +03:00
Denis Zharkov
df64f5ff19 Fix ConvertTextJavaCopyPasteProcessor after 4725dd3
In cases like 'fun foo() = \n fun dummy(){}'
declaration on the next line is parsed as top-level declaration.

But ConvertTextJavaCopyPasteProcessor expects that 'fun dummy(){}'
would be a part of an expression body, so we replace "\n" with " "
to turn off recovery in the case

See TextJavaToKotlinCopyPasteConversionTestGenerated.testAsExpressionBody
2016-07-16 09:12:57 +03:00
Denis Zharkov
8c22e8588a Minor. Drop unused method 2016-07-15 19:08:43 +03:00
Denis Zharkov
3ddd48472a Implement recovery for incomplete expression before declaration
It's needed when declarations are parsed as a part of previous expression
(see tests)

Currently we apply this kind of recovery in a conservative way,
only when declaration starts at the next line, and while
the condition could be relaxed, there's no need to do this

 #KT-4948 Fixed
 #KT-7118 Fixed
2016-07-15 19:08:43 +03:00
Denis Zharkov
00ccd3eccb Minor. Invert boolean parameter meaning
It looks much more sensible to me
2016-07-15 19:08:43 +03:00
Denis Zharkov
c2ac753758 Add EOL to EXPRESSION_FOLLOW recovery set
This change is used in further commits, but it's extracted
to emphasize that testData modifications are caused by this.
2016-07-15 19:08:42 +03:00
Alexey Sedunov
a51d3fc12a Create from Usage: Show target class name in the text of "Create member" quick fix 2016-07-15 02:20:22 +03:00
Alexey Sedunov
47073b5381 Minor: Convert CallablePlacement to sealed class 2016-07-15 02:20:20 +03:00
Alexey Sedunov
7b54ad0ec9 Rename: Fix exception on property rename preview 2016-07-15 02:20:19 +03:00
Alexey Sedunov
c0d5df15f7 Create from Usage: Show receiver type in the text of "Create extension" quick fix 2016-07-15 02:20:18 +03:00
Alexey Sedunov
917cd22327 Create from Usage: Approximate unresolvable types
#KT-7722 Fixed
2016-07-15 02:20:17 +03:00
Dmitry Jemerov
2cbabcc50f show line markers for properties defined in the primary constructor (KT-12626)
(cherry picked from commit e224041)
2016-07-14 23:37:34 +02:00
Dmitry Jemerov
313aab24d6 do not reenter indices to avoid deadlock
#KT-12718 Fixed
(cherry picked from commit 4391d83)
2016-07-14 23:36:24 +02:00
Dmitry Jemerov
34f8371613 don't consider calls to methods with the same name as a property to be calls to accessors of that property
#KT-12813 Fixed
(cherry picked from commit 5380b63)
2016-07-14 23:36:07 +02:00
Dmitry Jemerov
51d30a036a correctly find usages of overridden Java method through synthetic accessors
#KT-12869 Fixed
(cherry picked from commit 14037f0)
2016-07-14 23:35:48 +02:00
Alexey Andreev
dda9ae3d41 JS: refactor TemporaryVariableElimination 2016-07-14 18:02:16 +03:00
Alexey Tsvetkov
792d33f1f6 Correct test case for KT-12776
After minifying test, it stopped failing without fix
2016-07-14 16:43:32 +03:00
Alexey Tsvetkov
3ec6e94955 Do not force dependency resolution when configuring kapt with stabs
#KT-12776 fixed
2016-07-14 16:00:03 +03:00
Dmitry Jemerov
1f3b0ee950 Kotlin JUnit run configuration producer needs to take precedence over IDEA's PatternConfigurationProducer
#KT-13084 Fixed
(cherry picked from commit b09fc7c)
2016-07-13 16:08:52 +02:00
Dmitry Jemerov
af6c73156e add alternate path to common.jar dependency to work around the fact that it's no longer shipped in plugins/android/lib since AS 2.2 preview
(cherry picked from commit e66e292)
2016-07-13 13:43:34 +02:00
Dmitry Jemerov
25e8fea4fd ClsWrapperStubPsiFactory can be a singleton
(cherry picked from commit 5201fc1)
2016-07-13 13:17:12 +02:00
Alexander Udalov
2ede98f430 Minor, fix yellow code in OverrideResolver and OverridingUtil
(cherry picked from commit 87387d030f)
2016-07-13 13:44:36 +03:00
Alexander Udalov
d7158cab88 Suppress UNCHECKED_CAST instead of CAST_NEVER_SUCCEEDS in several places
This is related to KT-6611 being fixed recently. Note that not all cases of
incorrect "cast never succeeds" were fixed

(cherry picked from commit 8f33830f29)
2016-07-13 13:44:12 +03:00
Alexander Udalov
f143c8a40a Fix AssertionError in DescriptorResolver#checkBounds
#KT-9620 Fixed

(cherry picked from commit 13b0fda3c2)
2016-07-13 13:44:05 +03:00
Denis Zharkov
d0b4c29c9e Increase SOURCE_STUB_VERSION
It's necessary because of changes in parser
(mostly recovery f1026935a0)
2016-07-13 13:22:58 +03:00
shiraji
543c6bc6a1 Implement inspection to remove @ from annotation argument #KT-9228 Fixed 2016-07-13 12:57:29 +03:00
Dmitry Jemerov
0ad8c53706 specify FQ names for collection types as well
(cherry picked from commit c80e094)
2016-07-12 17:35:18 +02:00
Dmitry Jemerov
7b761dcf55 more sensible docs for @MustBeDocumented
(cherry picked from commit e492d23)
2016-07-12 16:26:58 +02:00
Dmitry Jemerov
4983b787d8 fix qualified links in Module.md
#KT-11373 Fixed
(cherry picked from commit ccbc19f)
2016-07-12 16:26:51 +02:00
Mikhail Glukhikh
c1faed5ab9 KT-12942 related: remove braces now does not work for if inside if 2016-07-12 17:20:34 +03:00
Mikhail Glukhikh
29a7bfed09 When to if now add braces for if branches inside #KT-12942 Fixed 2016-07-12 17:20:29 +03:00
Mikhail Glukhikh
828f4bfada Specify type explicitly: do not consider star projection arguments in KotlinType.isFlexibleRecursive() #KT-13055 Fixed 2016-07-12 17:19:32 +03:00
Mikhail Glukhikh
eb05a7a493 Can be primary constructor property: check whether property belongs to the same class #KT-12876 Fixed 2016-07-12 17:18:56 +03:00
Nikolay Krasko
b6a9e2da16 Generate linenumber for goto instruction in while (KT-13059)
Otherwise linenumber for previous instruction will be used in debugger. That can lead to error stepping
because it might be line that isn't reachable on current iteration.

 #KT-13059 Fixed
2016-07-12 14:37:02 +03:00
Nikolay Krasko
db2de7f55f Refactoring: invert if 2016-07-11 20:21:23 +03:00
Nikolay Krasko
d518fe67a6 Disable local mirrors for public teamcity 2016-07-11 20:21:23 +03:00
Nikolay Krasko
887e334517 Tests for Gradle inspections with configured Gradle project 2016-07-11 20:21:23 +03:00
Nikolay Krasko
0a9e48dd6a Warn about using different versions of Kotlin plugin and standard library in Gradle (KT-12730)
#KT-12730 Fixed
2016-07-11 20:21:23 +03:00
Nikolay Krasko
87f7a1b784 Fix getting external path for retrieving gradle model 2016-07-11 20:21:23 +03:00
Nikolay Krasko
f2eb7a5c59 Refactoring: extract method for getting Kotlin plugin version and remove findAllRecursively usage 2016-07-11 20:21:23 +03:00
Nikolay Krasko
607020e781 Use internalName for compare with module name 2016-07-11 20:21:23 +03:00
Pavel V. Talanov
60a3f2b268 Increase BINARY_STUB_VERSION
Should have been done after earlier changes: 022ef6410d
2016-07-11 19:05:29 +03:00
Pavel V. Talanov
0780c5d9b8 Put all stub versions into one place, explain their meaning 2016-07-11 19:05:27 +03:00
Pavel V. Talanov
fe8d0a8578 update ChangeLog for 1.0.3 2016-07-11 19:05:25 +03:00
Nikolay Krasko
1a6c7a6bf8 Fix LocalVarShadowingMemberProperty test by renaming test files 2016-07-11 13:06:05 +03:00
Denis Zharkov
3a1db42b6a Fix ClassCastException when data object is being analyzed
#KT-12687 Fixed
2016-07-10 15:05:10 +03:00
Michael Bogdanov
6af3635ba8 Print bytecode on linenumber test fail
(cherry picked from commit 93f6761)
2016-07-09 15:24:31 +03:00
Michael Bogdanov
e0b551443a Fix for KT-13040: Invalid bytecode generated for extension lambda invocation with safe call
#KT-13040 Fixed
(cherry picked from commit 23a0e19)
2016-07-09 15:10:33 +03:00
Michael Bogdanov
3ae5d3ad08 Fix for KT-12908: Variable initialization in loop causes VerifyError bad local variable type
#KT-12908 Fixed
(cherry picked from commit 486aa56)
2016-07-09 15:08:51 +03:00
Nikolay Krasko
be1241bf6d Fix bad refactoring 2016-07-08 21:37:49 +03:00
Nikolay Krasko
eeada69515 Minor: add some comments after review 2016-07-08 21:20:20 +03:00
Nikolay Krasko
0ddc79dc0f Support multi-module environment in DifferentKotlinGradleVersionInspection 2016-07-08 21:20:18 +03:00
Nikolay Krasko
38adac8612 Make DifferentKotlinGradleVersionInspection inpection work for classpath call with braces 2016-07-08 21:20:11 +03:00
Nikolay Krasko
737a1d0dbf Update description in DifferentKotlinMavenVersionInspection 2016-07-08 21:20:09 +03:00
Nikolay Krasko
2b697a69e2 Refactoring: extract strings 2016-07-08 21:20:08 +03:00
Nikolay Krasko
a27c3f506b Fallback to properly resolved version if heuristic doesn't work in DifferentKotlinGradleVersionInspection 2016-07-08 21:20:06 +03:00
Nikolay Krasko
59da76d7d1 Add inspection that warns if Gradle plugin version differs from the one in IDE (KT-12730)
#KT-12730 Fixed
2016-07-08 21:20:05 +03:00
Dmitry Jemerov
121b3db2e9 fix incompatibility with ASM 6: don't call getReturnType() on a type which is not a method type (IDEA-158090) 2016-07-08 17:20:31 +02:00
Denis Zharkov
0d5090c41d Extend recovery set when expecting property accessor
#KT-12987 Fixed
2016-07-08 16:12:34 +03:00
Denis Zharkov
3cd8a15477 Add recovery for properties without name
If property name is parsed on the next line and declaration is invalid
(no receiver/type/initializer), treat that name as it does not belong to property

 #KT-12987 In Progress
2016-07-08 16:12:34 +03:00
Denis Zharkov
3798f3932e Minor. Drop redundant AnnotationParsingMode 2016-07-08 16:07:59 +03:00
Denis Zharkov
162f7a4e40 Minor. Extract parsePropertyDelegateOrAssignment 2016-07-08 16:07:59 +03:00
Denis Zharkov
4d651fd54a Minor. Cleanup KotlinParsing
- Remove unused field and commented code
- Add some comments
- jet -> kotlin
2016-07-08 16:07:59 +03:00
Denis Zharkov
63cdf5955a Minor. Drop unreachable conditional branch
- allowShortAnnotations is true only for IN_ANNOTATION_LIST
- when starting parsing of annotation list we can't come to modifier list
(see the only usage of IN_ANNOTATION_LIST)
2016-07-08 16:07:59 +03:00
Denis Zharkov
127fbcd85e Add val/var tokens in parameter name recovery set
Recovery after val/var everywhere beside value parameters works
properly without this change

 #KT-7915 Fixed
2016-07-08 16:07:59 +03:00
Dmitry Petrov
8f130495e3 KT-13023 Char operations throw ClassCastException for boxed Chars
Char is not a Number, so we can't use the same coercion strategy for Char members,
since it doesn't work for boxed Chars.
(cherry picked from commit b0edec8)
2016-07-08 13:28:41 +03:00
Dmitry Petrov
f792b19cae Minor: fix NPE in CallableMethod.toString for methods of primitive types
(cherry picked from commit 2ccb0ca)
2016-07-08 13:28:10 +03:00
Dmitry Petrov
d2b22c37a2 KT-6916: do not create Progression instances in for-in-downTo loops
(cherry picked from commit bf4f263)
2016-07-08 09:53:35 +03:00
Dmitry Jemerov
1c11f8a75e add test for resolving links to library classes from KDoc comments
(cherry picked from commit dec2f98)
2016-07-07 19:32:18 +02:00
Dmitry Jemerov
945938ef8b use navigation element to resolve KDoc links, so that we have correct context when resolving links in the documentation of library elements
#KT-10654 Fixed
(cherry picked from commit 80e10c6)
2016-07-07 19:31:42 +02:00
Dmitry Jemerov
790330f804 use a better API for locating target element when navigating by documentation link, to ensure we find the source for descriptors belonging to library classes
#KT-12932 Fixed
(cherry picked from commit fac1b85)
2016-07-07 19:31:32 +02:00
Dmitry Jemerov
9ac01d633a use QualifiedNameResolver for resolving links in KDoc
#KT-10398 Fixed
(cherry picked from commit 88fe668)
2016-07-07 19:31:23 +02:00
Valentin Kipyatkov
f4e7c7b940 KT-12803 Unused import when class is used in method reference
#KT-12803 Fixed
(cherry picked from commit 5e48b73)
2016-07-07 20:15:18 +03:00
Valentin Kipyatkov
11b62d0cad KT-10433 Copy-pasting reference to companion object member causes import dialog in specific case
#KT-10433 Fixed
(cherry picked from commit 1941572)
2016-07-07 20:15:18 +03:00
Valentin Kipyatkov
659f916086 KT-12646 ConvertToBlockBody intention should use BodyResolveMode.PARTIAL
#KT-12646 Fixed
(cherry picked from commit 9463880)
2016-07-07 20:15:18 +03:00
Dmitry Jemerov
7ca54b9011 avoid NPE when trying to create a file that already exists
#KT-12655 FIxed
(cherry picked from commit 60523fb)
2016-07-07 18:04:16 +02:00
Dmitry Jemerov
9199bafe10 check that main() returns Unit
#KT-12760 Fixed
(cherry picked from commit 972ebd5)
2016-07-07 18:04:11 +02:00
Dmitry Jemerov
6b68377954 MainFunctionDetector: cleanup after J2K
(cherry picked from commit 30d721c)
2016-07-07 18:04:05 +02:00
Dmitry Jemerov
b8ac43c9d9 MainFunctionDetector: J2K
(cherry picked from commit b58c659)
2016-07-07 18:03:59 +02:00
Dmitry Jemerov
8a6e761bdb MainFunctionDetector: rename to .kt
(cherry picked from commit b9a9f25)
2016-07-07 18:03:54 +02:00
Dmitry Jemerov
5a1860833b to restore pre-1.0.3 highlighting behavior, inherit "extension function" and "extension property" colors from "static method" and "static field"
#KT-12937 Fixed
(cherry picked from commit 193a404)
2016-07-07 18:03:49 +02:00
Dmitry Jemerov
c352822539 fix rendering of code blocks escaped with multiple backticks or containing backslashes
#KT-12998 Fixed
 #KT-12999 Fixed
(cherry picked from commit 216d548)
2016-07-07 18:03:42 +02:00
Dmitry Jemerov
4423daa9e1 don't lose ! when rendering markdown
#KT-13000 Fixed
(cherry picked from commit 801a128)
2016-07-07 18:03:36 +02:00
Alexey Tsvetkov
14a74446f3 Fix kapt stubs generation 2016-07-07 17:23:56 +03:00
Alexey Tsvetkov
3495c0fe86 Do not run integration tests with old gradle versions
Reason finalizedBy is not supported with gradle < 2.0
2016-07-07 15:40:39 +03:00
Alexander Udalov
5f3ef4f6cf Minor, fix NonExistentClass name and format
(cherry picked from commit 720c29e8f4)
2016-07-07 14:57:57 +03:00
Alexander Udalov
e544013a4c Get rid of CallChecker#checkPropertyCall, create fake ResolvedCall
(cherry picked from commit ceb54492e6)
2016-07-07 14:55:00 +03:00
Dmitry Jemerov
a63d5956f6 fix ASM 5 src download URL (file was removed in IDEA commit ed9c9fc)
(cherry picked from commit 623673c)
2016-07-07 12:50:16 +02:00
Nikolay Krasko
6dc1c67900 Add description for Kotlin gradle plugin 2016-07-06 20:13:23 +03:00
Nikolay Krasko
6c6c7b246b Refactoring: better name for SameVersionInspection
It now has better suppression string
2016-07-06 20:13:23 +03:00
Nikolay Krasko
b9e3b9ef46 Refactoring: rename SameVersionIDEPluginInspection
It now has better suppression string
2016-07-06 20:13:23 +03:00
Nikolay Krasko
205a95a03d Show versions that are reported different in SameVersionIDEPluginInspection 2016-07-06 20:13:23 +03:00
Nikolay Krasko
6b79c09ad2 Avoid "loader constraint violation: when resolving method "ActionsKt.runReadAction()" 2016-07-06 20:13:23 +03:00
Nikolay Krasko
60ae115f33 Read test files with \r removed on Windows 2016-07-06 20:13:23 +03:00
Nikolay Krasko
62c6a599c1 Fix AbstractAnnotationProcessorBoxTest on Windows: load text without \r 2016-07-06 20:13:23 +03:00
Nikolay Krasko
d4e2da0b3c Minor: mark folder as resources not a source root 2016-07-06 20:13:23 +03:00
Alexey Tsvetkov
f418af9c74 Remove dependency on Files from guava 2016-07-06 16:29:57 +03:00
Alexey Tsvetkov
4d108f4aec Gradle: copy kotlin classes after java compilation
#KT-9392 fixed
    #KT-12295 fixed
    #KT-12736 fixed
2016-07-06 16:29:57 +03:00
Alexander Udalov
08827a5177 Minor, move isInfixCall implementation out of InfixCallChecker
(cherry picked from commit d331b6ae8e)
2016-07-05 19:33:40 +03:00
Alexander Udalov
6045b9d934 Minor, fix typo in KParameter#isOptional kdoc
(cherry picked from commit a48e1680e9)
2016-07-05 19:33:09 +03:00
Alexander Udalov
f29dc71a32 Fix reflection on reference to generic property
See a93484b457 for the similar fix to function
references

 #KT-12967 Fixed

(cherry picked from commit 3b349e9be0)
2016-07-05 19:32:54 +03:00
Alexander Udalov
a88e2e1db7 Fix AssertionError in OverrideResolver on bad hierarchy
Previously the code was operating under the assumption that if the
implementation of some function (both the implementation and the function come
from supertypes) does not have a proper return type (the one which is a subtype
of return type of all declarations of this function in the supertypes), then
there's necessarily at least one abstract declaration of the function, such
that the implementation's return type is not a subtype of the return type of
that declaration. The assertion makes sense when the hierarchy above the
current class does not have any errors: we should report at least one function
as being "not implemented" in the current class.

However, as demonstrated by the test case, if there's an error already in the
supertypes with regard to overridability of members, this assertion may be
wrong. Reporting the "not implemented" error in such case is in fact not
necessary because of the already existing error ("return type mismatch" in the
test) in the supertypes

 #KT-12482 Fixed

(cherry picked from commit 48fe9fb2c0)
2016-07-05 19:32:47 +03:00
Alexander Udalov
3c711dddee Fix debug names for some slices
Also move RUNTIME_ASSERTION_INFO and LOAD_FROM_JAVA_SIGNATURE_ERRORS to a
single class for simplicity

(cherry picked from commit a533f8597d)
2016-07-05 19:32:02 +03:00
Alexander Udalov
8df12e5933 Fix test data for KT-11075
References to object members are not supported in 1.0.x branch

 #KT-11075 Fixed
2016-07-05 18:06:10 +03:00
Dmitry Petrov
35591839e5 KT-12983 java.lang.VerifyError: Bad type on operand stack in arraylength
Use proper receiver value type.
2016-07-05 17:52:58 +03:00
Dmitry Petrov
41118ceb13 Minor: extract optimized loop codegen creation logic for optimized 'for' cases.
There will be some more of those, and they all require some ad hock processing.
(cherry picked from commit e187f79)
2016-07-05 17:52:57 +03:00
Dmitry Petrov
8e10b99037 KT-12733 'rangeTo' as a non-qualified call is not optimized in 'for'
Use ResolvedCall corresponding to 'for' loop range expression
for optimized "for-in-range-literal".
Cleanup.
2016-07-05 17:52:57 +03:00
Kirill Rakhman
6fd9b29157 Show quick doc for implicit lambda parameter 'it' (#889)
* Show quick doc for implicit lambda parameter 'it'
Fixes #KT-9271

* Remove useless code
(cherry picked from commit 79fff4a)
2016-07-05 14:01:45 +02:00
Dmitry Jemerov
3bdb4fd376 fix test
(cherry picked from commit a770fe2)
2016-07-05 13:44:08 +02:00
Kirill Rakhman
9fe233b312 Implement quickfix for wrong primitive literal (#885)
* Implement quickfix for wrong primitive literal
Fixes: KT-12251

* fix style issue
(cherry picked from commit b50176f)
2016-07-05 13:44:01 +02:00
Kirill Rakhman
54a039de77 Add quickfix for "Illegal usage of inline parameter" that adds noinline (#888)
Fixes #KT-12838
(cherry picked from commit 3b290ce)
2016-07-05 12:15:22 +02:00
Dmitry Petrov
aa5401ceed KT-11892: explicitly qualified 'super' with a supertype that is overridden
by a different explicitly declared supertype is an error (as in Java)
(see http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.3)
2016-07-05 11:01:42 +03:00
Dmitry Petrov
de73cdd117 Minor: use NoLookupLocation.WHEN_GET_SUPER_MEMBERS
for unqualified 'super' resolution
2016-07-05 11:01:42 +03:00
Denis Zharkov
06018b9ca8 Report declaration that was being analyzed when internal error happened
#KT-12188 Fixed
2016-07-04 18:23:58 +03:00
Denis Zharkov
a1fa8ebe81 Minor. Move KotlinFrontEndException to frontend module 2016-07-04 18:23:58 +03:00
Denis Zharkov
cf43eba70c Do not add error types as upper bounds in type parameter
#KT-10237 Fixed
 #KT-11821 Fixed
 #KT-8200 Fixed
2016-07-04 18:23:58 +03:00
Denis Zharkov
febe3d4380 Minor. Change CompilationException parameter to @Nullable
A lot of call sites actally pass null as an element,
so it's better to fail with original stack-trace instead of NPE
caused by nullability check
2016-07-04 18:23:18 +03:00
Alexander Udalov
3042f31cd0 Do not consider fake variables for objects in :: resolution
The main change is in
NewResolutionOldInference.ResolutionKind.CallableReference, where
createVariableProcessor creates a processor which no longer lists objects

 #KT-12322 Fixed

(cherry picked from commit b44f060ffa)
2016-07-04 15:52:17 +03:00
Alexander Udalov
a5d1b7f503 Initial support of type inference for callable references
There are two main changes here:

- In CallCompleter, there was a bug: we assumed that the return type of a
  candidate must be a subtype of the expected type and were adding a
  corresponding constraint to the system. However, this is not true for
  callable references where the type of the expression is KFunctionN<...> and
  the return type of the candidate must be a subtype of the _last generic
  argument_ of the functional type.
- In CandidateResolver, we use a more correct (although still not precise)
  heuristic to determine if a candidate fits based on the non-substituted type
  of the callable reference expression which it would produce.

This can be further improved, see TODOs in CallCompleter. Also this does not
influence resolution of callable references being passed as arguments to
generic calls (that happens in GenericCandidateResolver)

 #KT-10968 Fixed
 #KT-11075 Fixed
 #KT-12286 Fixed
 #KT-12963 Open
 #KT-12964 Open

(cherry picked from commit f290f1be68)
2016-07-04 15:52:03 +03:00
Alexander Udalov
c7ec2e7eb6 Fix AssertionError on property generation in multi-file classes
See 4a533168d9 for the original change which
introduced the problem

Note that the added test case _was not failing_ before the change. It's added
because there were no tests on multi-file class behavior in light classes mode
at all. The actual repro for the problem is difficult to make a test from

 #KT-12755 Fixed

(cherry picked from commit 24682bf1ec)
2016-07-04 15:51:52 +03:00
Denis Zharkov
648cc1cf9e Refine definition of whether single parameter the method should be boxed
Only 'Collection<Int>.remove(E): Boolean' should match
2016-07-04 15:48:22 +03:00
Denis Zharkov
8c7319aaea Introduce additional overridability rule
It works only for Java methods and it's purpose is Java overridability rules emulation,
namely distinction of primitive types and their wrappers.

For example `void foo(Integer x)` should not be an override for `void foo(int x)`

 #KT-11440 Fixed
 #KT-11389 Fixed
2016-07-04 15:48:22 +03:00
Denis Zharkov
b78a16d9e9 Minor. Extract overridability rule into separate method 2016-07-04 15:48:22 +03:00
Denis Zharkov
5660709c2d Temporary return BuiltinOverridabilityCondition class
Otherwise bootstrap problems appear
2016-07-04 15:48:22 +03:00
Denis Zharkov
c2ad32135e Rename: BuiltinOverridabilityCondition -> JavaIncompatibilityRulesOverridabilityConditionBuiltinOverridabilityCondition 2016-07-04 15:48:22 +03:00
Denis Zharkov
d4d97eb950 Use signatures instead of fq-names in special built-ins
Partially apply 55c4f875c8 in 1.0.x
2016-07-04 15:48:22 +03:00
Denis Zharkov
84596d92e4 Partially apply 1efed64014
JvmTypeFactory implementation will be used further in 1.0.x version
2016-07-04 15:48:22 +03:00
Denis Zharkov
a460c3b107 Extract JVM descriptors type mapping from backend to core
Also unbind it from ASM types
2016-07-04 15:48:22 +03:00
Alexey Andreev
310e17f938 Fix configuration of maven test of moduleKind configuration property 2016-07-04 15:02:17 +03:00
Alexey Andreev
df38d90d65 KT-12928: decompose invocation like "a.foo(b)" to "$t = a; $s = $t.foo.bind($t); $s(b)" instead of "$t = a.foo; $t(b)", since in the latter case foo won't receive proper this. Add optimization that replaces "foo.bar.bind(baz)(args)" with "baz.bar(args)" 2016-07-04 14:53:11 +03:00
Zalim Bashorov
43c476f26f JS: generate a function with the required name for callable references instead try to change the name later. The previous solution doesn't work properly on some JS VMs (e.g. in FireFox)
#KT-12929 Fixed
(cherry picked from commit 48617ca)
2016-07-01 21:16:43 +03:00
Nikolay Krasko
ea01e3c142 Build against 1.0.4 in branch 1.0.4 2016-07-01 18:31:10 +03:00
Ilya Gorbunov
8b0350a021 Minor: make tryInlined test not depend on 'Closeable.use' implementation.
(cherry picked from commit 17e7c269ad)
2016-07-01 04:52:00 +03:00
Alexander Udalov
216ac9cbc4 Minor, remove unused components in ForLoopConventionsChecker
This is an addition to 8357f30

(cherry picked from commit 95ed3ed78b)
2016-06-30 21:29:57 +03:00
Alexey Sedunov
5397e11940 Minor: Fix compilation 2016-06-30 20:37:32 +03:00
Alexey Sedunov
bc4c013e03 Create from Usage: Support "Create member/extension" corresponding to the extension receiver of enclosing function
#KT-10668 Fixed
2016-06-30 20:37:31 +03:00
Alexey Sedunov
75f6b7fcd8 Create from Usage: Support "Create abstract function/property" inside an abstract class
#KT-7492 Fixed
2016-06-30 20:37:30 +03:00
Alexey Sedunov
3641ad6cf7 Code Insight: Format generated declarations
#KT-11176 Fixed
2016-06-30 20:37:28 +03:00
Alexey Sedunov
a3a2e573de Override/Implement Members: Implement Members: Fix base member detection when abstract and non-abstract members with matching signatures are inherited from an interface
#KT-11115 Fixed
2016-06-30 20:37:27 +03:00
Alexey Sedunov
b53d8da648 Inline Property: Support "Do not show this dialog" and "Inline this occurrence" options
#KT-12017 Fixed
2016-06-30 20:37:26 +03:00
Alexey Sedunov
2852f44951 Introduce Property: Do not skip outer classes if extractable expression is contained in object literal. Skip outer classes of non-inner class
#KT-12084 Fixed
2016-06-30 20:37:25 +03:00
Alexey Sedunov
78212a4ade Introduce Property: Fix extraction of expressions referring to primary constructor parameters
#KT-12294 Fixed
2016-06-30 20:37:24 +03:00
Alexey Sedunov
f417b05769 Change Signature: Consider default value context an initial type context. Use parameter list as a type context for bodyless function
#KT-12413 Fixed
2016-06-30 20:37:23 +03:00
Denis Zharkov
1266950809 Minor. Cleanup getSpecialBridgeSignatureIfExists 2016-06-30 20:21:22 +03:00
Denis Zharkov
3529499282 Simplify method contract and add assertion
We don't generate stubs for final built-ins anyway
(as well as special bridges)
2016-06-30 20:21:22 +03:00
Denis Zharkov
64114b0762 Refine stubs generation for special built-ins
Do not generate stub if declaration has the same signature

 #KT-12909 Fixed
2016-06-30 20:21:22 +03:00
Denis Zharkov
80e923fe46 Fix stub generation for special built-ins
Do not generate stubs if there is no special bridge in the current class
- there are already Kotlin super class in hierarchy
- special bridge has the same signature as method itself

 #KT-11915 Fixed
2016-06-30 20:21:22 +03:00
Alexey Tsvetkov
7e4b93f06e Fix shading of META-INF/services in kotlin-compiler-embaddable 2016-06-30 20:17:13 +03:00
Alexander Udalov
3999709bda Fix KCallable#callBy to JvmStatic companion object members
#KT-12915 Fixed

(cherry picked from commit c07d0d48d3)
2016-06-30 20:08:31 +03:00
Michael Bogdanov
37acb3cd30 Compile android tests against jdk 6
(cherry picked from commit 476c1ec)
2016-06-30 09:33:23 +03:00
Alexander Udalov
1b6a6c510a Do not report errors on fake elements in call checkers
#KT-12875 Fixed

(cherry picked from commit 8357f3021e)
2016-06-30 02:19:09 +03:00
Alexander Udalov
181ac887e3 Minor, move some checkers to more appropriate places
(cherry picked from commit 95291cdc18)
2016-06-30 02:18:27 +03:00
Alexander Udalov
c2e7847134 Report error on protected setter call from super's companion
#KT-12847 Fixed

(cherry picked from commit ff72348105)
2016-06-30 02:17:01 +03:00
Alexander Udalov
133fa036c6 Rename SymbolUsageValidator -> ClassifierUsageChecker
Also validateTypeUsage -> check

(cherry picked from commit 77bb691d4e)
2016-06-30 02:16:01 +03:00
Alexander Udalov
04301828c8 Move SymbolUsageValidator#validatePropertyCall to CallChecker
(cherry picked from commit 89730dfbc3)
2016-06-30 02:15:47 +03:00
Alexander Udalov
dfca1c2b61 Drop SymbolUsageValidator#validateCall in favor of CallChecker#check
(cherry picked from commit d599d87978)
2016-06-30 02:14:20 +03:00
Alexander Udalov
b62aaebe5c Invoke call checkers where symbol usage validators are called
The change in componentAccess.kt is a minor regression that should be addressed
later

(cherry picked from commit 260689eb8c)
2016-06-30 02:13:13 +03:00
Alexander Udalov
d0a389997f Support smart casts for functions of property delegates
(cherry picked from commit 4a05c749b5)
2016-06-30 02:12:03 +03:00
Alexander Udalov
6c685ec295 Drop resolution of deprecated plus/minus/get/set conventions
Also remove the corresponding quick fix

(cherry picked from commit 70a994b135)
2016-06-30 02:08:37 +03:00
Alexander Udalov
60f348824d Remove obsolete errors related to 'invoke' called on extension
(cherry picked from commit 291f1f6c3a)
2016-06-30 02:05:07 +03:00
Alexander Udalov
f0bc904526 Refactor CallChecker and subclasses
Encapsulate everything that is needed in checkers into CallCheckerContext. Pass
an instance of this context instead of BasicCallResolutionContext to checkers.

Also pass an instance of the element to report errors on: this is useful
because before this, every checker had its own way of determining where should
the error be reported on. Some of them, for example, were not doing anything if
Call#calleeExpression returned null, which is wrong, see operatorCall.kt

 #KT-12875 Open

(cherry picked from commit 6ba32ed624)
2016-06-30 02:02:36 +03:00
Alexander Udalov
a8666865cb Minor, extract validatePropertyCall out of SymbolUsageValidator#validateCall
BasicExpressionTypingVisitor#checkLValue is the only place where it's used.
There's no ResolvedCall instance for the setter call (only for the property
itself), that's why this special method is needed

(cherry picked from commit f6f825e0dc)
2016-06-30 01:49:40 +03:00
Alexander Udalov
2aa68a0f3f Drop SymbolUsageValidator.Composite, use validators similarly to call checkers
Also fix warnings in DeprecatedSymbolValidator, DelegatedPropertyResolver and
elsewhere

(cherry picked from commit d7d2780666)
2016-06-30 01:49:31 +03:00
Alexander Udalov
5725c196ff Make infix & operator checkers implement CallChecker
Instead of SymbolUsageValidator

(cherry picked from commit e94fd8f777)
2016-06-30 01:47:37 +03:00
Nikolay Krasko
8834f0ad44 Don't fail in setup because of access restricted exception 2016-06-29 18:30:32 +03:00
Kirill Rakhman
639d6a71b1 Formatter: Remove spaces before question mark in nullable types (KT-12830)
#KT-12830 Fixed
2016-06-29 18:30:11 +03:00
Yan Zhulanow
33af8ba5a5 KT-12895, EA-84877: Fix NoSuchMethodError thrown when saving a Kotlin file.
newOutputStreamSupplier() is deprecated and was deleted in Guava 18.
(cherry picked from commit bb083a5)
2016-06-29 17:53:31 +03:00
Alexey Tsvetkov
9de22c3549 Prevent usage of deprecated constructor
This removes warning with gradle 2.14.
Before 2.14 constructor was removed, then it was returned and deprecated.

    #KT-12786 fixed
2016-06-29 15:17:19 +03:00
Alexey Tsvetkov
c03e50c5a1 Fix CCE when creating kotlin-js task in gradle plugin 2016-06-29 15:17:15 +03:00
Alexey Andreev
44cabf8376 KT-12893: fix another potential issue (could not reproduce) 2016-06-29 14:28:08 +03:00
Alexey Andreev
d101281b36 KT-12893: when opening Kotlin compiler settings while kotlinc.xml does not specify which module kind to use, fallback to default value ("plain").
Fix #KT-12893
2016-06-29 12:03:42 +03:00
Michael Bogdanov
fd96c02be0 Fix for KT-11964: No TABLESWITCH in when on enum bytecode if enum constant is imported
#KT-11964 Fixed
(cherry picked from commit 3b419e8)
2016-06-29 09:35:11 +03:00
Alexander Udalov
e93c85aa54 Simplify ImplementationBodyCodegen#generateToArray
- don't do anything for interfaces because there's no point in generating
  abstract methods which are already abstract in supertypes
- don't use getDeclaredFunctionByRawSignature, check function signature
  manually instead
- don't use isOrOverridesSynthesized because 'toArray' is never synthesized
2016-06-28 16:40:58 +03:00
Pavel V. Talanov
c2129365cb ChangeLog, minor: make usages of quotes and backticks more consistent 2016-06-28 16:05:59 +03:00
Pavel V. Talanov
729690e055 Minor: fix typos in ChangeLog 2016-06-28 16:05:57 +03:00
Pavel V. Talanov
6beb99db9e Update Changelog for 1.0.3 2016-06-28 16:05:55 +03:00
Alexey Sedunov
8e631b6810 Rename: Update references to facade class when renaming file via matching top-level class
#KT-11903 Fixed
(cherry picked from commit a1d9a25)
2016-06-28 15:28:49 +03:00
Alexey Sedunov
4475fc022a Line Markers: Filter out irrelevant declarations before resolving in KotlinTestRunLineMarkerContributor
#KT-12647 Fixed
(cherry picked from commit cceeaeb)
2016-06-28 15:28:34 +03:00
Alexey Sedunov
af63b58b6f Rename: Constraint search scope of parameter declared in a private member
#KT-9649 Fixed
(cherry picked from commit fa144b0)
2016-06-28 15:28:10 +03:00
Alexey Sedunov
d763308431 Rename: Disable JavaMemberByKotlinReferenceInplaceRenameHandler for synthetic properties referenced from Kotlin code
#KT-9168 Fixed
(cherry picked from commit dfebdaf)
2016-06-28 15:27:55 +03:00
Alexey Sedunov
73fbc093b7 Rename: Support automatic test renaming for facade files
#KT-10578 Fixed
(cherry picked from commit 35050f4)
2016-06-28 15:27:39 +03:00
Alexey Sedunov
8628f9ee37 Override/Implement: Prefer not-nullable return type when overriding Java method without nullability annotation
#KT-12381 Fixed
(cherry picked from commit 2b87f8e)
2016-06-28 15:27:26 +03:00
Alexey Sedunov
bda39e3f77 Move: Support quoted package names
#KT-12411 Fixed
(cherry picked from commit 95239e5)
2016-06-28 15:27:16 +03:00
Alexey Sedunov
c0959496dd References: Support implicit references to annotation method 'value'. Support Find Usages/Rename on these references
#KT-12657 Fixed
(cherry picked from commit 68d0d84)
2016-06-28 15:27:02 +03:00
Alexey Sedunov
0133aef038 Rename: Suggest renaming both property accessors with matching @JvmName when renaming one of them from Java
#KT-12759 Fixed
(cherry picked from commit 81a8e6a)
2016-06-28 15:26:47 +03:00
Alexey Sedunov
dd476563a3 Light Classes: Implement light elements for 'extends'/'implements' reference lists. Support adding/removing of super type list entries via light elements.
Fix exception on applying "Convert to class" intention to Java interface with Kotlin inheritor(s)
 #KT-11281 Fixed
(cherry picked from commit 4ec4914)
2016-06-28 15:26:35 +03:00
Alexey Sedunov
cad99e5ba0 Implement Abstract Member: Navigate to the generated declaration
#KT-12290 Fixed
(cherry picked from commit 6274c6b)
2016-06-28 15:26:20 +03:00
Alexey Sedunov
a44d149b4f Create from Usage: Fix exception in "Create class" quickfix applied to unresolved references in type arguments. Create class body when necessary
#KT-12777 Fixed
(cherry picked from commit dc90ec9)
2016-06-28 15:26:08 +03:00
Alexey Sedunov
ebb1c758d9 Override/Implement: Implement JavaDoc/KDoc copying
#KT-8682 Fixed
 #KT-12735 Fixed
(cherry picked from commit f4486be)
2016-06-28 15:25:55 +03:00
Alexey Sedunov
3256366ffe Minor: Rename jetRefactoringUtil.kt -> kotlinRefactoringUtil.kt
(cherry picked from commit a841f87)
2016-06-28 15:25:38 +03:00
Alexey Sedunov
0a98a2a9cb Minor: Drop unused variable
(cherry picked from commit 4441323)
2016-06-28 15:25:21 +03:00
Alexey Sedunov
ca14643834 Copy: Filter out invalid elements to prevent PsiInvalidElementAccessException
#KT-12747 Fixed
(cherry picked from commit 4a0a440)
2016-06-28 15:25:11 +03:00
Alexey Sedunov
feb84aa443 Create from Usage: Suggest "Create function/secondary constructor" quick fix on argument type mismatch
#KT-11864 Fixed
(cherry picked from commit 1912783)
2016-06-28 15:24:52 +03:00
Alexey Sedunov
19edf0f939 Rename: Qualify references to members of enum companions in case of conflict with enum entries
#KT-10033 Fixed
(cherry picked from commit 3373d54)
2016-06-28 15:24:39 +03:00
Alexey Sedunov
bff7c57c2b Inspections: Don't show "Package directive doesn't match file location" in injected code
#KT-12376 Fixed
(cherry picked from commit a5a5fe5)
2016-06-28 15:24:25 +03:00
Alexey Sedunov
264dacb5ba Rename: Preserve "Search in comments and strings" and "Search for text occurrences" settings in Rename dialog
#KT-8510 Fixed
(cherry picked from commit d9584d2)
2016-06-28 15:24:00 +03:00
Alexey Sedunov
8372b76d4e Minor: Fix changelog
(cherry picked from commit 2ea3980)
2016-06-28 15:23:28 +03:00
Alexey Sedunov
bdc299cc8a Rename: Record new name for Kotlin function which is being renamed via light method
#KT-12732 Fixed
(cherry picked from commit 28b9d3e)
2016-06-28 15:23:00 +03:00
Alexey Sedunov
60c3abcc3e Rename: Process property accesor usages (Java) in comments and string literals
#KT-9435 Fixed
(cherry picked from commit 911afee)
2016-06-28 15:22:28 +03:00
Alexey Sedunov
709082f0af Rename: Add name suggestions to Rename dialog
#KT-6372 Fixed
(cherry picked from commit 84ca283)
2016-06-28 15:21:52 +03:00
Alexey Sedunov
07af0b1c8b Rename: Rename overridden property and all its accessors on attempt to rename overriding accessor in Java code
#KT-4791 Fixed
(cherry picked from commit 29e450e)
2016-06-28 15:21:38 +03:00
Alexey Sedunov
ccb096ed99 Rename: Fix rename of ambiguous import reference to class/function when some referenced declarations are not changed
#KT-6663 Fixed
(cherry picked from commit 9ba8ecd)
2016-06-28 15:21:01 +03:00
Alexey Sedunov
528f144858 Rename: Implement conflict analysis for parameters. Qualify property references to avoid shadowing by parameters
#KT-10687 Fixed
(cherry picked from commit 7d6466d)
2016-06-28 15:20:46 +03:00
Alexey Sedunov
d38a0b6e43 Rename: Implement Rename conflict analysis for classes. Qualify class references to resove rename conflicts when possible
#KT-8611 Fixed
 #KT-8562 Fixed
(cherry picked from commit 8989ccc)
2016-06-28 15:20:33 +03:00
Alexey Sedunov
6da82ee964 Rename: Implement Rename conflict analysis for properties. Qualify property references to resove rename conflicts when possible
#KT-8732 Fixed
 #KT-12543 Fixed
(cherry picked from commit e23029d)
2016-06-28 15:20:23 +03:00
Stanislav Erokhin
a8fd840fa3 Add eap channel for 1.1 into plugin updater.
(cherry picked from commit 43f5da0)
2016-06-28 14:48:52 +03:00
Denis Zharkov
6db295524a Use modality and visibility from mutable class declaration
Otherwise open may be used instead of abstract (in most cases)
2016-06-28 14:22:59 +03:00
Denis Zharkov
c36b63dea9 Do not generate mutable collection stub methods in interfaces
#KT-12359 Fixed
2016-06-28 14:22:59 +03:00
Denis Zharkov
3807c507b7 Fix mutable collection stub methods generation for corner case
The problem is that
`override fun remove(element: E): CollectionWithRemove<E>`
seems to be illegal from Java's point of view, while it's OK for JVM

These declarations have the same signature (return type is isgnored)
- override fun remove(element: E): CollectionWithRemove<E>
- override fun remove(element: E): Boolean

When we meet such declaration we choose random declaration for fake override in synthetic class
that may lead to signature clash
2016-06-28 14:22:59 +03:00
Nikolay Krasko
4d12a242ab Use file.modificationStamp to invalidate caches for synthetic files
It previously worked because of updating all counters. That behaviour was removed in
3b860d69ee.

getUserData(FILE_OUT_OF_BLOCK_MODIFICATION_COUNT) is probably useless because copied file has
isEventSystemEnabled() == false that prevents sending notifications about PSI changes. This need additional checks.
2016-06-28 14:12:10 +03:00
Nikolay Krasko
53c2dfa49b Remove old hack: Idea doesn't expect increasing modification count during highlighting (KT-12526)
addImport() is called from ImportAllMembersIntention.isApplicableTo() and increasing modification count during highlighting ruins Idea expectations.

 #KT-12526 Fixed
2016-06-27 21:18:31 +03:00
Alexander Udalov
d8209d796d Minor, rename protobuf field according to style guide
(cherry picked from commit 601dc96a34)
2016-06-27 20:26:37 +03:00
Alexander Udalov
fa66bce9a5 Update protobuf from 2.5.0 to 2.6.1
(cherry picked from commit 4c8e8b099a)
2016-06-27 20:26:29 +03:00
Ilya Gorbunov
7f8938e074 Change snapshot versions of dependencies in gradle tests for 1.0.x branch 2016-06-27 17:35:22 +03:00
Ilya Gorbunov
93b2e1ed8b Update changelog for 1.0.3: section about new compiler options
(cherry picked from commit 1e66147e91)
2016-06-27 17:35:22 +03:00
Ilya Gorbunov
7514bbb3c9 Minor: remove unused commonArgs
(cherry picked from commit 71476d5d43)
2016-06-27 17:35:22 +03:00
Ilya Gorbunov
3fa335d6d0 Rename -jdk compiler option to -jdk-home (jdkHome), add jdk path validation.
(cherry picked from commit 7c5c4610e8)

# Conflicts:
#	compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt
2016-06-27 17:35:22 +03:00
Ilya Gorbunov
ad540b6f90 Add tests for 'jdk' compiler option for CLI, maven and gradle.
(cherry picked from commit 13016cae93)
2016-06-27 17:35:22 +03:00
Ilya Gorbunov
9197aec478 CLI: Allow to specify JDK for classpath building with '-jdk' compiler argument.
Maven: support jdk parameter linked to kotlin.compiler.jdk property.
Gradle: support jdk compiler option.

(cherry picked from commit 644df89dc9)
2016-06-27 17:35:22 +03:00
Ilya Gorbunov
c2704bdba7 Maven: support languageVersion parameter, linked to property kotlin.compiler.languageVersion.
(cherry picked from commit 1157e052ee)
2016-06-27 17:35:22 +03:00
Ilya Gorbunov
9fd23fa175 Maven and Gradle tests for jvmTarget parameter.
(cherry picked from commit 848599e940)
2016-06-27 17:35:22 +03:00
Ilya Gorbunov
4771a6cdec Maven: support jvmTarget parameter in Maven, linked to property kotlin.compiler.jvmTarget.
Gradle: support jvmTarget compiler option.

(cherry picked from commit 3f3a3820b8)
2016-06-27 17:35:22 +03:00
Alexey Andreev
b9328df0d5 KT-3008: fix ABI compatibility test 2016-06-27 16:04:26 +03:00
Alexey Andreev
c137cf681a KT-3008: minor code style fixes 2016-06-27 16:04:24 +03:00
Alexey Andreev
d48d1afd5e KT-3008: fix support of KProperty/KMutableProperty 2016-06-27 15:57:13 +03:00
Alexey Andreev
ff89622e61 KT-3008: remove unused code that handles anonymous modules, since there's no way to declare them via configuration 2016-06-27 15:57:13 +03:00
Alexey Andreev
b1198265d7 KT-3008: when inlining functions from external modules, replace calls to functions in the external module via new mechanism instead of Kotlin.modules 2016-06-27 15:57:12 +03:00
Alexey Andreev
ff44894d61 KT-3008: change the way how descriptions of module kind are rendered in IDEA configuration tab 2016-06-27 15:57:12 +03:00
Alexey Andreev
46efbac984 KT-3008: multiple minor fixes after code review 2016-06-27 15:57:11 +03:00
Alexey Andreev
6f172094ac KT-3008 Add support of module kind to Ant task. Repair Ant JS tests 2016-06-27 15:57:11 +03:00
Alexey Andreev
9ea0abc121 KT-3008 Fix CLI and JPS tests related to JS translator 2016-06-27 15:57:10 +03:00
Alexey Andreev
4671252943 KT-3008 Run Google closure compiler in a separate JVM 2016-06-27 15:57:10 +03:00
Alexey Andreev
d107ccaa97 KT-3008 Minor refactoring and clean up 2016-06-27 15:57:07 +03:00
Alexey Andreev
c5bab0d8c4 KT-3008 Add UI that allows to change module kind in IDEA Kotlin configurator 2016-06-27 15:55:53 +03:00
Alexey Andreev
2dadf0b1a4 KT-3008 Add module kind attribute to Maven plugin. Fix tests from libraries subproject 2016-06-27 15:54:15 +03:00
Alexey Andreev
176768dd3a KT-3008 Fix UMD and plain module wrappers when module id is not a valid JS identifier 2016-06-27 15:54:14 +03:00
Alexey Andreev
3cc15546f9 KT-3008 Add tests for module wrappers 2016-06-27 15:54:12 +03:00
Alexey Andreev
4fa27a7262 KT-3008 Merge JS runtime modules in one kotlin.js 2016-06-27 15:52:09 +03:00
Alexey Andreev
4bb21c71ed KT-3008 Fix JS backend tests 2016-06-27 15:52:04 +03:00
Alexey Andreev
cbd9165008 KT-3008 Implement AMD, CommonJS and UMD wrappers. Compile stdlib and builtins modules into separate JS files and wrap them in UMD. 2016-06-27 15:51:21 +03:00
Alexey Andreev
734552ad91 KT-3008 Change the way how modules are referenced in JS 2016-06-27 15:51:19 +03:00
Alexey Andreev
ed848e74f2 KT-3008 Add module kind. Include module kind and module dependencies in metadata 2016-06-27 15:38:24 +03:00
Michael Bogdanov
d8fd2c3cd1 Fix for KT-12106: import static of reified companion object method throws IllegalAccessError 2016-06-27 12:15:37 +03:00
Zalim Bashorov
608acdb373 JS: fix that kotlin's breakpoints don't work with JavaScript debugger
#KT-12773 Fixed
(cherry picked from commit 47e1ff3)
2016-06-24 16:26:58 +03:00
Denis Zharkov
3184238b9f Use 'Any?' instead of throwing NPE when calculating star projection type
It's a quite hacky solution, but the choice seems to be conservative, so these types can be refined later

 #KT-9597 Fixed
2016-06-24 10:24:46 +03:00
Yan Zhulanow
e73789dc3e Fix KT-12173 (Kotlin Lint False Positive for "Toast created but not shown" inside SAM adapter).
(cherry picked from commit 4940d3b)
2016-06-23 20:27:46 +03:00
Yan Zhulanow
48bb3ad965 KT-12681 (Lint: run from main menu / Analyze: Kotlin inspections reports only java source)
Cause we've copied Lint diagnostics to the Kotlin project, there's no harm in making them Kotlin-only.
(cherry picked from commit 7105648)
2016-06-23 20:27:43 +03:00
Yan Zhulanow
0255b2d9da KT-12674 "Calling new methods on older versions" errors for inlined constants
Inlined constants from Java should not be detected.
(cherry picked from commit b34ee4e)
2016-06-23 20:27:40 +03:00
Yan Zhulanow
868b04f36b KT-12023 Kotlin Lint: Cast doesn't trigger minSdk error
Check Kotlin as/is types.
(cherry picked from commit c0db8e0)
2016-06-23 20:27:37 +03:00
Yan Zhulanow
1142d2888f Make infix modifier diagnostic message more informative (KT-12589)
(cherry picked from commit 2744309)
2016-06-23 20:27:34 +03:00
Yan Zhulanow
a39ef7f6ca Load Gradle subplugin artifacts from the root project buildscript classpath as well (KT-11885)
(cherry picked from commit b54b0da)
2016-06-23 20:27:31 +03:00
Yan Zhulanow
5322539179 KT-12015 (Kotlin Lint False Positive for Bundle.getInt())
Java approach is not sufficient here, in Kotlin receivers can be implicit.
Use Kotlin extension/dispatch receivers to figure out the receiver type for our method call.
(cherry picked from commit cdedf1d)
2016-06-23 20:27:28 +03:00
Yan Zhulanow
9f2d789c36 Android Extensions: Fix KT-10969 (NullPointerException when finding view in Fragment if getView() is null)
(cherry picked from commit 80f5852)
2016-06-23 20:27:25 +03:00
Alexander Udalov
cfa0a79405 Add release notes for 1.0.2-1
(cherry picked from commit 1ebcd193a2)
2016-06-23 17:39:56 +03:00
Pavel V. Talanov
16558a4d32 REPL: call 'toString()' for returned values explicitly and correctly report exceptions
#KT-12389 Fixed
2016-06-23 15:55:12 +03:00
Pavel V. Talanov
c0bb933988 Refactor Repl: use sealed class to represent line result 2016-06-23 15:55:10 +03:00
Pavel V. Talanov
893fe7af11 Refactor ReplInterpreter and ReplFromTerminal classes
Drop some of the exception reporting code
2016-06-23 15:55:08 +03:00
Pavel V. Talanov
ae8d9612ae J2K ReplFromTerminal: rename file 2016-06-23 15:55:07 +03:00
Pavel V. Talanov
d8f092b06f J2K ReplFromTerminal, convert code 2016-06-23 15:55:05 +03:00
Stanislav Erokhin
24237097e2 KT-12623 Fixed ISE: Type parameter ... not found for public fun ...
#KT-12623 Fixed
Also EA-72653 fixed.
(cherry picked from commit 7c2825b)
2016-06-23 02:08:20 +03:00
Alexander Udalov
7c3a69f8e0 Minor, move utilities form CallableReferencesResolutionUtils.kt closer to usages
(cherry picked from commit 6cc10aa226)
2016-06-22 22:09:10 +03:00
Alexander Udalov
230b46cbcd Refactor CallableReferencesResolutionUtils.kt
Get rid of trace & reportOn parameters of
createReflectionTypeForCallableDescriptor: move the two checks that required
them to DoubleColonExpressionResolver and combine with other checks into a
single function that checks the validity of the referenced symbol. This also
makes these checks reported only once when invalid expressions are passed as
function arguments (previously they were also reported from
getResolvedCallableReferenceShapeType).

Also inline getReflectionTypeForCandidateDescriptor after this, and refactor
its usages

(cherry picked from commit 80bf6e1bee)
2016-06-22 21:58:03 +03:00
Alexander Udalov
d8b3c359bf Minor, refactor "is KProperty" checks in ReflectionTypes
(cherry picked from commit cf630e01db)
2016-06-22 21:42:32 +03:00
Stanislav Erokhin
d4132e767f Add debug info for EA-79267 - (T is not T) assert: TypeCheckingProcedure.checkSubtypeForTheSameConstructor
(cherry picked from commit 065c4e1)
2016-06-22 19:45:32 +03:00
Stanislav Erokhin
d4fa597245 KT-11679 Fixed exception at ResolvedCallImpl.getArgumentMapping()
#KT-11679 Fixed
Also fixed EA-75913 EA-78908
(cherry picked from commit ad285d5)
2016-06-22 19:45:29 +03:00
Stanislav Erokhin
d3a44cd4d1 Fixed visibility check on a property with private setter of the subclass
#KT-3689 Fixed
(cherry picked from commit 7389d41)
2016-06-22 19:45:25 +03:00
Pavel V. Talanov
4819247450 Update Changelog for 1.0.3-eap-58 2016-06-22 14:14:44 +03:00
Pavel V. Talanov
f18b0aab93 Add Kotlin "Tips of the day"
Content from https://youtrack.jetbrains.com/issue/DOC-4026
2016-06-22 14:13:35 +03:00
Pavel V. Talanov
9589e2c491 Update changelog for 1.0.3 2016-06-22 14:13:17 +03:00
Nikolay Krasko
e79cfa6f08 Add notes about fixes in formatter 2016-06-21 23:34:03 +03:00
Nikolay Krasko
b860846c0c Add space after a semicolon only if there's another child at the same line 2016-06-21 23:23:59 +03:00
Kirill Rakhman
2c2c9bdefc Format spaces before enum arguments
Fixes #KT-12714
2016-06-21 23:23:58 +03:00
Kirill Rakhman
ea0313106a Format spaces around semicolon
Fixes #KT-12689
2016-06-21 23:23:58 +03:00
Kirill Rakhman
0c0c113460 Format spaces after annotation in annotated expression
Fixes #KT-12781
2016-06-21 23:23:57 +03:00
Kirill Rakhman
28a414514c Format spaces inside curly braces in string template
Fixes #KT-12791
2016-06-21 23:23:56 +03:00
Kirill Rakhman
a02699f2b9 Format spaces around in keyword
Fixes: KT-10680
2016-06-21 23:23:56 +03:00
Mikhail Glukhikh
2f42f12197 Replace explicit parameter with it : correct handling of it from outer lambda #KT-12437 Fixed
(cherry picked from commit cb8fe96)
2016-06-21 22:29:50 +03:00
Mikhail Glukhikh
422795694e Fix for EA-81477 : correct handling of a property without initializer (but with e.g. getter)
(cherry picked from commit 4e2d35a)
2016-06-21 22:29:41 +03:00
Mikhail Glukhikh
d109c728a2 Can be parameter inspection: delete only particular modifiers (e.g. no vararg) #KT-12768 Fixed
(cherry picked from commit d4116b5)
2016-06-21 22:29:26 +03:00
Mikhail Glukhikh
a9d95014ae Can be constructor property: comment saver introduced to retain comments; unbound comments now added before, not after
(cherry picked from commit 886cf21)
2016-06-21 22:29:15 +03:00
Mikhail Glukhikh
57dcb8e1de Minor fixes: can be constructor property
(cherry picked from commit 4d44e15)
2016-06-21 22:29:05 +03:00
Mikhail Glukhikh
ff63ddeffd Code cleanup: "can be constructor property" applied
(cherry picked from commit 6967711)
2016-06-21 22:28:56 +03:00
Valentin Kipyatkov
af9f195af0 KT-12369 Completion: pressing dot after class name should not cause insertion of constructor call
#KT-12369 Fixed
(cherry picked from commit 0bc5007)
2016-06-21 17:14:51 +03:00
Valentin Kipyatkov
a3a36085b4 Fixed test so that it really tests what's intended
(cherry picked from commit b9719bf)
2016-06-21 17:14:43 +03:00
Valentin Kipyatkov
2a5e79117c KT-12669 Completion should show variant with () when there is default lambda
#KT-12669
(cherry picked from commit eb1dbfc)
2016-06-21 17:14:38 +03:00
Valentin Kipyatkov
0a09e49b84 KT-12447 Don't use CompletionProgressIndicator in Kotlin plugin
#KT-12447 Fixed
(cherry picked from commit 962a8f9)
2016-06-21 17:14:31 +03:00
Valentin Kipyatkov
4fba98b9a6 KT-12427 Completion doesn't work for "@receiver:" annotation target
#KT-12427 Fixed
(cherry picked from commit 4e16d67)
2016-06-21 17:14:25 +03:00
Valentin Kipyatkov
4bf5b65350 KT-12328 Qualified function name inserted when typing before "if"
#KT-12328 Fixed
(cherry picked from commit 1413a3f)
2016-06-21 17:14:20 +03:00
Valentin Kipyatkov
ab8ed97571 Fixed extension properties not completed after "get"
(cherry picked from commit 2ec81f4)
2016-06-21 17:14:14 +03:00
Valentin Kipyatkov
9b265625b5 No need to specially handle extensions from current file anymore (since searchScope for KotlinIndicesHelper includes current file)
(cherry picked from commit 88bf7f8)
2016-06-21 17:14:07 +03:00
Valentin Kipyatkov
0ddfd34c06 KT-11975 Invert if-condition intention does not simplify "is" expresssion
#KT-11975 Fixed
(cherry picked from commit 1b16ff6)
2016-06-21 17:14:01 +03:00
Valentin Kipyatkov
8303e4e852 KT-9166 Code completion does not work for synthetic extensions on typing "g"
#KT-9166 Fixed
(cherry picked from commit e8d518a)
2016-06-21 17:13:55 +03:00
Valentin Kipyatkov
612fc08825 KT-12299 Completion: incorrect priority of property foo over method getFoo in Kotlin-only code
#KT-12299 Fixed
(cherry picked from commit e04c6d1)
2016-06-21 17:13:49 +03:00
Valentin Kipyatkov
630a635beb KT-12124 No code completion for a java property in a specific position
#KT-12124 Fixed
(cherry picked from commit 97ad0d5)
2016-06-21 17:13:42 +03:00
Valentin Kipyatkov
c3b4a73afd Moved method getSmartCastVariantsWithLessSpecificExcluded() into IDE
(cherry picked from commit f6c8ac7)
2016-06-21 17:13:36 +03:00
Valentin Kipyatkov
b6c8f47e67 Minor code improvements after conversion
(cherry picked from commit b6c54ac)
2016-06-21 17:13:30 +03:00
Valentin Kipyatkov
5beb05a805 Conversion to Kotlin (step 2)
(cherry picked from commit 83714ae)
2016-06-21 17:13:23 +03:00
Valentin Kipyatkov
530dde8f8f Conversion to Kotlin (step 1)
(cherry picked from commit ccd7ae9)
2016-06-21 17:13:17 +03:00
Valentin Kipyatkov
9a6916931d Added test for KT-12124
(cherry picked from commit fe29530)
2016-06-21 17:13:11 +03:00
Valentin Kipyatkov
30c1b1307f KT-12284 "Add braces to else" has too wide range
#KT-12284 Fixed
(cherry picked from commit 9afb0d5)
2016-06-21 17:13:05 +03:00
Valentin Kipyatkov
8efe1689f9 Refactored replace with safe/dot call fixes
(cherry picked from commit 618b1b9)
2016-06-21 17:12:59 +03:00
Alexey Andreev
ee0f264f21 KT-12417: add support of RTTI against K(Mutable)Property* types 2016-06-21 16:02:31 +03:00
Pavel V. Talanov
fdbca65489 Minor, changelog: add 1.0.4 section 2016-06-21 14:01:33 +03:00
Sergey Mashkov
df32ad8f28 KT-12512 "Different IDE and Maven plugin version" inspection is being invoked for non-tracked pom.xml files 2016-06-21 13:57:15 +03:00
Sergey Mashkov
73b3869756 Fix EA-83601 - ISE: PomFile.<init> 2016-06-21 13:57:10 +03:00
Sergey Mashkov
1f3a7a0c39 KT-12558 Configure Kotlin in Project: Maven: Undo could revert changes in all poms 2016-06-21 13:57:06 +03:00
Sergey Mashkov
7d17bd8d43 Maven: script tag injects kotlin 2016-06-21 13:57:01 +03:00
Sergey Mashkov
ba563ec448 KT-12568 Maven pom.xml: execution configuration: file path completion works only in some sub-elements 2016-06-21 13:56:57 +03:00
Dmitry Jemerov
99b24227ce Merge branch 'rr/yole/ea' into 1.0.3 2016-06-21 12:03:31 +02:00
Denis Zharkov
ffa04e11a8 Fix visibility check for dynamic members within protected method
#KT-11857 Fixed
2016-06-21 11:04:23 +03:00
Mikhail Glukhikh
31e8fe51a6 dangerousFlexibleTypeOrNull : minor refactoring 2016-06-20 21:44:16 +03:00
Mikhail Glukhikh
7cc6b9b910 Has platform type inspection is now intention-based 2016-06-20 21:44:12 +03:00
Mikhail Glukhikh
ed23aa9bc0 Introduce additional fixes & configurable problem range for intention-based inspection 2016-06-20 21:44:07 +03:00
Mikhail Glukhikh
b09b5a9a28 Specify type explicitly intention: now derived from self targeting range intention 2016-06-20 21:44:02 +03:00
Mikhail Glukhikh
a084c1d395 Has platform type : public API only option 2016-06-20 21:43:57 +03:00
Kirill
af1b26b993 Add quickfix tests for HasPlatformTypeInspection 2016-06-20 21:43:51 +03:00
Kirill Rakhman
00d8c26160 Implement inspection for declarations with implicit platform types #KT-12310 Fixed 2016-06-20 21:43:46 +03:00
Nikolay Krasko
21a32408cf Wrong delegation to delegation property in debugger when property defined in another module (KT-12678)
Different bytecode can be generated for delegated property and for non-delegated one. Backend inspects DELEGATED_PROPERTY_CALL to understand the property type, and expects that
this information had been already recorded into context. Frontend writes DELEGATED_PROPERTY_CALL into context during body resolve or type inference if type is not present.

Either way in debugger context it may happen that the DELEGATED_PROPERTY_CALL won't be written into context.

 #KT-12678
2016-06-20 21:14:52 +03:00
Alexander Udalov
3321e904b3 Check return type when locating method in reflection
#KT-11824 Fixed

(cherry picked from commit 311301f430)
2016-06-20 21:05:14 +03:00
Pavel V. Talanov
5e85e85a29 Create SyntheticMemberDescriptor interface
Implement this interface by sam adapters/constructors and use it in navigation

 #KT-11708 Fixed
2016-06-20 20:23:09 +03:00
Dmitry Jemerov
765bd44207 handle IOException from File.getCanonicalFile() (EA-83981 - NA: KotlinToJVMBytecodeCompiler.reportRuntimeConflicts) 2016-06-20 18:20:21 +02:00
Dmitry Jemerov
a77f4dfb8e VirtualFile.getParent() is nullable (EA-84222 - NPE: DecompiledFileWritingAccessProvider.isPotentiallyWritable) 2016-06-20 18:17:03 +02:00
Dmitry Jemerov
c3e38dd594 PsiElement.getNode() is nullable (EA-84534 - NPE: DocCommentConverterKt.content) 2016-06-20 18:15:23 +02:00
Alexander Udalov
21952a64d3 Update diagnostic tests ReadMe, explain tests with diagnostic arguments
(cherry picked from commit 0e881daba3)
2016-06-19 13:53:22 +03:00
Alexander Udalov
602b19bf90 Type-check reference to property with invisible setter to KProperty
#KT-12337 Fixed

(cherry picked from commit 6562a2db19)
2016-06-19 13:53:22 +03:00
Ilya Gorbunov
6804bd6985 Rearrange stdlib unit tests across packages.
Rearrange JS stdlib unit tests.

(cherry picked from commit c5a208f3eb)
2016-06-18 16:53:06 +03:00
Ilya Gorbunov
2044bc9f94 Remove obsolete and not relevant to stdlib tests
(cherry picked from commit d266f546f4)
2016-06-18 16:53:04 +03:00
Alexey Tsvetkov
0aa70fc3b5 Exclude resources dir from surefire test search 2016-06-17 20:14:33 +03:00
Alexander Udalov
6356957bfb Move get-protobuf later in update_dependencies
It invokes kotlinc, so should happen after the bootstrap compiler is downloaded

(cherry picked from commit 3fa87fe4de)
2016-06-17 17:24:59 +03:00
Mikhail Glukhikh
9a50a0b4b9 Elvis / if / when are now infer error type if it exists in one of their branches #KT-6665 Fixed 2016-06-17 16:03:58 +03:00
Mikhail Glukhikh
2eaaf9c14a Sealed class hierarchies are now correctly processed in when (by checking possible smart casts to nested sealed classes) #KT-10648 Fixed 2016-06-17 14:07:42 +03:00
Stanislav Erokhin
9a17999750 Create hack for exception about "Empty intersection for types".
Hackaround for KT-11266, EA-79963, EA-72093,  EA-79976.
2016-06-17 12:14:02 +03:00
Alexander Udalov
7d501714a3 Fix compilation 2016-06-16 18:02:17 +03:00
Alexander Udalov
761116563d Do not skip synthesized members when generating bridges
The condition here is obsolete since SAM adapters can no longer be overridden:
they are now extensions in another scope

 #KT-12708 Fixed

(cherry picked from commit de986ed051)
2016-06-16 17:02:25 +03:00
Alexander Udalov
f2e5d4b699 Report error on accidentally "overriding" wait/notify
#KT-7174 Fixed

(cherry picked from commit 79ecc9751b)
2016-06-16 17:01:45 +03:00
Mikhail Glukhikh
2db7562920 Inspection "can be primary constructor property" with relevant quick-fix #KT-8477 Fixed 2016-06-16 16:20:03 +03:00
Nikolay Krasko
7e2865f500 Implement isInheritor method with utility method that has special behaviour for anonymous classes 2016-06-16 14:18:16 +03:00
Nikolay Krasko
8069aca614 Implement copy methods for anonymous and enum entry light classes 2016-06-16 14:17:40 +03:00
Nikolay Krasko
4dbac59c6e Make Kotlin light class more like PsiAnonymousClassImpl
Avoid delegating to cls delegate in more places
2016-06-16 14:17:38 +03:00
Nikolay Krasko
32ee3f2934 Compare anonymous classes with psi only to avoid counting qualified name 2016-06-16 14:17:37 +03:00
Alexey Tsvetkov
b2851cdba8 Minor test fix 2016-06-15 20:30:16 +03:00
Alexey Tsvetkov
7c9a94d674 Ensure direcory for class file stubs always exists
This fixes the warning "classpath entry does not exist"

    #KT-12352 fixed
2016-06-15 20:06:18 +03:00
Alexey Tsvetkov
cc90e80794 Set friend modules for android gradle test tasks
This fixes the following issues:
1. When product flavors were used, android unit tests could not refer
to internal symbols from main source set.
2. Android instrumentation tests could not refer
to internal symbols from main source set

    #KT-11166 fixed
2016-06-15 20:06:18 +03:00
Zalim Bashorov
fad9a9decb JPS: don't consider that production target of module "B" is depends on test target of module "A" when "B" depends on "A"
#KT-12595 Fixed
2016-06-15 14:43:32 +03:00
Alexander Udalov
3c88ac45f6 Validate "-jvm-target" value in CLI, improve message
(cherry picked from commit 9548ab97251e79cebd1d580466678d52f0080454)
2016-06-15 14:24:02 +03:00
Mikhael Bogdanov
cd460987dc Support 'jvm-target' in CLI
(cherry picked from commit 3a8591a)
2016-06-15 14:15:13 +03:00
Dmitry Petrov
9c80f87794 KT-5075 Optimize array/collection indices usage in 'for' loop
Use specialized 'for' loop code generation strategy for loops over array indices and collection indices.
(cherry picked from commit a17b0dd)
2016-06-15 14:03:42 +03:00
Alexander Udalov
477b1cf151 Fix error in kapt on enum constructors with parameters
Do not skip writing the fictitious 'java/lang/Synthetic' annotation in KAPT
mode, because its absence makes ASM confuse indices of enum constructor
parameters (it cannot figure out that there are two additional parameters, name
and ordinal)

 #KT-12694 Fixed

(cherry picked from commit 99f4c7b6e7)
2016-06-14 22:08:25 +03:00
Nikolay Krasko
53e6139def Build output parser in separate module under 1.6 (KT-12159)
KotlinOutputParser accessed from gradle execution environment that can be started under Java 1.6.

 #KT-12159 Fixed
2016-06-14 19:41:14 +03:00
Nikolay Krasko
0c6602ab84 Add dependency to tests-common in j2k module 2016-06-14 16:43:17 +03:00
Alexander Udalov
ca66f1f29b Use protobuf with renamed packages, pack to IDEA plugin
Update GenerateProtoBuf.kt to also regexp-replace com.google.protobuf with
org.jetbrains.kotlin.protobuf in generated Java sources

 #KT-12581 Fixed

(cherry picked from commit 7e38b93d80)
2016-06-14 14:59:21 +03:00
Alexander Udalov
e195ae2516 Rename packages in protobuf-java binaries and sources
#KT-12581 In Progress

(cherry picked from commit 952a85414b)
2016-06-14 14:37:17 +03:00
Mikhail Glukhikh
ac8c749af8 Surround with null check : applicable also for TYPE_MISMATCH
(cherry picked from commit b173492)
2016-06-13 20:52:48 +03:00
Mikhail Glukhikh
15b39f7427 Wrap with safe let call : minor refactoring
(cherry picked from commit 10935ba)
2016-06-13 20:52:32 +03:00
Mikhail Glukhikh
2e38fbd274 Surround with null check : apply for ITERATOR_ON_NULLABLE
(cherry picked from commit 954952a)
2016-06-13 20:52:12 +03:00
Mikhail Glukhikh
e923f2ed42 Surround with null check : minor refactoring
(cherry picked from commit 7f77107)
2016-06-13 20:51:55 +03:00
Mikhail Glukhikh
2ffad4b5fa KT-11104 extra : name validator introduced for wrap with safe let call
(cherry picked from commit 230f73a)
2016-06-13 20:51:39 +03:00
Mikhail Glukhikh
18d6427ff2 KT-11104 extra : "wrap with safe let call" is now applicable for argument type mismatches
(cherry picked from commit 3c49b5f)
2016-06-13 20:51:17 +03:00
Mikhail Glukhikh
9fa7e0bc96 Quick-fix "wrap with safe let call" introduced #KT-11104 Fixed
(cherry picked from commit 47c1106)
2016-06-13 20:51:00 +03:00
Mikhail Glukhikh
d4f28855d5 Correct "Show type" on an invoked expression #KT-12671 Fixed
(cherry picked from commit f8b6ed2)
2016-06-13 20:50:42 +03:00
Mikhail Glukhikh
c0f6cee914 KT-11104 : quick fix "surround with null check"
(cherry picked from commit 90342ea)
2016-06-13 20:50:19 +03:00
Mikhail Glukhikh
e2c2f8e684 If to when: more accurate comment handling #KT-12649 Fixed
(cherry picked from commit 9470308)
2016-06-13 13:44:39 +03:00
Stanislav Erokhin
6003dda5e5 KT-10717 Type inference for lambda with local return
#KT-10717 Fixed
(cherry picked from commit 585dcbf)
2016-06-10 21:38:18 +03:00
Stanislav Erokhin
d6894e07b1 Add assertion for variable as operator call.
(cherry picked from commit da01e4a)
2016-06-10 21:29:21 +03:00
Stanislav Erokhin
873795ff54 Minor. removed several tests with error calls.
(cherry picked from commit 0324141)
2016-06-10 21:29:15 +03:00
Nikolay Krasko
d035645a8c j2k: minor fixes in KtLightClassForAnonymousDeclaration 2016-06-10 14:07:37 +03:00
Nikolay Krasko
dfa286394b j2k: actual convert KtLightClassForAnonymousDeclaration 2016-06-10 14:07:36 +03:00
Nikolay Krasko
3c963b040e j2k: rename KtLightClassForAnonymousDeclaration 2016-06-10 14:07:34 +03:00
Nikolay Krasko
f36180c33d Minor: clean up and reformat 2016-06-10 14:07:33 +03:00
Alexander Udalov
1b226d1d7a Fix toString() and reflectLambda() for lambdas with generic types in signatures
#KT-10771 Fixed

(cherry picked from commit 59342000ae)
2016-06-10 12:39:41 +03:00
Denis Zharkov
66530e5e7a Refactor function descriptors copy mechanism
Pull up CopyBuilder to interface and inline some custom usages

(cherry picked from commit e316ab2ee6)
2016-06-10 12:37:47 +03:00
Alexander Udalov
96f704c348 Implement copy in FunctionDescriptorImpl, call doSubstitute only in CopyConfiguration#build
(cherry picked from commit dc2972d99e)
2016-06-09 17:32:56 +03:00
Alexander Udalov
06032d33d4 J2K JavaElementCollectionFromPsiArrayUtil
(cherry picked from commit ee8ca0b850)
2016-06-09 17:29:44 +03:00
Alexander Udalov
4eeea9b960 Minor, move the Lombok hack a bit higher
(cherry picked from commit db3e0798c8)
2016-06-09 16:40:05 +03:00
Alexander Udalov
dcf42e2e4a Minor, drop java_generic_services option from .proto files
There are no service definitions in our .proto files, so this option had no
effect

(cherry picked from commit 3477f6ee85)
2016-06-09 16:23:52 +03:00
Alexander Udalov
ce3e98c8bf Minor, cleanup GenerateProtoBuf.kt
(cherry picked from commit aba1cc3d83)
2016-06-09 16:17:57 +03:00
Alexander Udalov
17b8bac308 J2K serialization: fix compilation and prettify
(cherry picked from commit 0c0a451d20)
2016-06-09 16:17:50 +03:00
Alexander Udalov
86a836432a J2K serialization: invoke automatic J2K conversion 2016-06-09 16:13:56 +03:00
Alexander Udalov
bea86db6b5 J2K serialization: move .java -> .kt 2016-06-09 16:12:08 +03:00
Alexander Udalov
9eff617bea Minor, remove 'depends' from kotlin-build-common-test Ant task
Similarly to other targets in build.xml, this simplifies manual partial
compilation of artifacts

(cherry picked from commit 3469e980cb)
2016-06-09 16:10:58 +03:00
Stanislav Erokhin
822071aecf KT-11778 Exception in Lombok plugin: Rewrite at slice FUNCTION
#KT-11778 Fixed.
EA-64051 Fixed.
(cherry picked from commit 4f943dc)
2016-06-09 14:23:32 +03:00
Pavel V. Talanov
3731e170e4 Update changelog for 1.0.3 2016-06-08 19:26:23 +03:00
Mikhail Glukhikh
aab4d9e8e2 Type parameter is considered capable of taking any value for the purpose of cast possibility check #KT-6611 Fixed
(cherry picked from commit 4b6b35d)
2016-06-08 17:48:00 +03:00
Mikhail Glukhikh
85a89cb80b CastDiagnosticsUtil.kt: converted to Kotlin
(cherry picked from commit 99acbf1)
2016-06-08 17:47:55 +03:00
Mikhail Glukhikh
1164dec297 CastDiagnosticsUtil.java --> CastDiagnosticsUtil.kt
(cherry picked from commit f3f7bff)
2016-06-08 17:47:51 +03:00
Pavel V. Talanov
ff82155f93 plugin.xml: Add dependency on java module
This restricts usage of plugin to IDEA and Android Studio
2016-06-08 17:43:15 +03:00
Alexander Udalov
35bc25577a Use empty list instead of ThrowingList in callable reference resolution
Clients of the call resolution do not expect to see a throwing list in call's
arguments, and it's wrong to make each of them check against the special case
that is the resolution of callable references.

Fixes EA-69901

(cherry picked from commit d8db769823)

Note that the test was NOT cherry picked from master because it depends on the
new language feature which is absent in 1.0.3
2016-06-08 15:05:03 +03:00
Alexey Sedunov
30ba7689db Minor: Fix compilation 2016-06-08 14:21:36 +03:00
Alexey Sedunov
2319ef2d8d Rename: Do not rename ambiguous references in import directives
#KT-6363 Fixed
(cherry picked from commit fe01035)
2016-06-08 12:11:00 +03:00
Alexey Sedunov
4526678cb4 Rename: Show more detailed element descriptions in Rename dialog
#KT-8544 Fixed
(cherry picked from commit 8ba1aff)
2016-06-08 12:10:45 +03:00
Alexey Sedunov
f4538bc3a6 Rename: Copy default values if function to be renamed inherits default values from some base function which is excluded from rename
#KT-9446 Fixed
(cherry picked from commit 9692c21)
2016-06-08 12:10:29 +03:00
Alexey Sedunov
2475dc5151 Rename: Implement automatic renamer for test classes
#KT-8512 Fixed
(cherry picked from commit 1885310)
2016-06-08 12:10:17 +03:00
Alexey Sedunov
388dadcf6d Rename: Do not show 'Rename overloads' options if target function has no
overloads. Consider extensions and members overloads if they have the same
recever class
 #KT-8541 Fixed
 #KT-8786 Fixed
(cherry picked from commit 42b71ae)
2016-06-08 12:10:08 +03:00
Alexey Sedunov
33a1efc624 Minor: Drop obsolete code
(cherry picked from commit 9b3f40e)
2016-06-08 12:09:59 +03:00
Alexey Sedunov
28ada3bf30 Light Classes: Drop obsolete constraint which prevents generation of light methods for local class members
#KT-8892 Fixed
(cherry picked from commit cf8cf37)
2016-06-08 12:09:48 +03:00
Alexey Sedunov
0b1a2194cb Rename: Do not replace Java references to synthetic component functions when renaming constructor parameter
#KT-9241 Fixed
(cherry picked from commit d27f3c0)
2016-06-08 12:09:39 +03:00
Alexey Sedunov
b35dd6b026 Rename: Allow typing any identifier without backquotes in Rename dialog
#KT-9444 Fixed
(cherry picked from commit 958b402)
2016-06-08 12:09:31 +03:00
Alexey Sedunov
a9830b2d28 Rename: @JvmName support
#KT-8044 Fixed
 #KT-9432 Fixed
(cherry picked from commit 96132fa)
2016-06-08 12:09:18 +03:00
Alexey Sedunov
18913925d9 Rename: Allow renaming class by constructor delegation call referencing primary constructor
#KT-8860 Fixed
(cherry picked from commit ff4c16d)
2016-06-08 12:08:50 +03:00
Alexey Sedunov
dcdf0cc33e Rename: Respect naming conventions in automatic variable rename
#KT-7851 Fixed
(cherry picked from commit e89e809)
2016-06-08 12:08:36 +03:00
Alexey Sedunov
3af211275b Rename: Skip read-only declarations when renaming parameters
#KT-10713 Fixed
(cherry picked from commit 400d6b5)
2016-06-08 12:08:28 +03:00
Alexey Sedunov
de1ff80486 Rename: Fixed in-place rename of Kotlin expression referring Java declaration
#KT-9157 Fixed
(cherry picked from commit 566ed01)
2016-06-08 12:08:20 +03:00
Alexey Sedunov
3eb80015c7 Rename: Quote non-identifier names in Kotlin references
#KT-9156 Fixed
(cherry picked from commit 691de67)
2016-06-08 12:08:09 +03:00
Alexey Sedunov
2205227f47 Refactoring: Move quoteIfNeeded function to idea-core
(cherry picked from commit a743098)
2016-06-08 12:08:00 +03:00
Alexey Sedunov
4b77ee5feb Create Test Intention: Fix RuntimeException on attempt to convert generated test class to Kotlin
#KT-12285 Fixed
 #EA-82281 Fixed
(cherry picked from commit 79f31cd)
2016-06-08 12:07:14 +03:00
Yan Zhulanow
6d21c3d145 Fix EA-81689
(cherry picked from commit 99b6194)
2016-06-07 21:17:34 +03:00
Alexander Udalov
23b7bb8fba Inline PrintingMessageCollector#PLAIN_TEXT_TO_SYSTEM_ERR
Otherwise 'hasErrors' flags was not cleared between subsequent runs of tests
which were using this message collector

(cherry picked from commit e3164119c1)
2016-06-07 21:12:39 +03:00
Nikolay Krasko
f03816ef1b Support Idea 163 branch 2016-06-07 19:29:44 +03:00
Kirill Rakhman
cb696b31ce Formatter: handle spaces before value arguments list (KT-12634)
#KT-12634 Fixed
2016-06-07 19:29:44 +03:00
Alexey Tsvetkov
2ae4d2a2fb Minor fixes of android test project 2016-06-07 19:21:55 +03:00
Jake Wharton
470600c2ef Add support for the Android test plugin.
#KT-11767 fixed
2016-06-07 19:21:55 +03:00
Yan Zhulanow
cddcf025b5 Fix EA-80764. Do not try to get the resource manager for the disposed module
(cherry picked from commit c3bd243)
2016-06-07 18:38:59 +03:00
Yan Zhulanow
51015965f2 Fix EA-82394. PsiType.getClassName() can return null. Return "<anonymous type>" in that case.
(cherry picked from commit 8be1335)
2016-06-07 18:38:56 +03:00
Yan Zhulanow
37dc0aeeac Fix EA-82166. NPE. loadModel() can return null, and it's a bad idea to call methods on a null pointer.
(cherry picked from commit cf033d0)
2016-06-07 18:38:53 +03:00
Yan Zhulanow
2179ee82a9 Fix EA-82449. Do not run Lint diagnostics if the project is already disposed
(cherry picked from commit 98b2899)
2016-06-07 18:38:50 +03:00
Yan Zhulanow
696475e6bf KT-12387 Fix Performance problem with Lint in IDE
Call checkCanceled() before running Lint diagnostics (UastScanner)
(cherry picked from commit c6e328a)
2016-06-07 18:38:47 +03:00
Yan Zhulanow
dbc54e2c52 Fix #KT-12047 (Kotlin Lint: "Missing @JavascriptInterface on methods" does not report anything)
(cherry picked from commit 61e8e01)
2016-06-07 18:38:44 +03:00
Yan Zhulanow
5c78acc38c Fix #KT-12015 (Kotlin Lint False Positive for Bundle.getInt()).
Android firstly checks API version against the function call receiver type, so we should do the same to be consistent.
(cherry picked from commit c3d01ec)
2016-06-07 18:38:40 +03:00
Pavel V. Talanov
dd4c370c57 Changelog for 1.0.3: delete empty 1.1 section 2016-06-07 17:16:40 +03:00
Pavel V. Talanov
421ea3b0c5 Changelog, minor: merge duplicating JS sections 2016-06-07 17:15:23 +03:00
Pavel V. Talanov
f6ad3d92f5 Update changelog for 1.0.3 2016-06-07 17:06:11 +03:00
Dmitry Jemerov
5675b8b4f6 search for Kotlin convention usages of Java methods
#KT-5960 Fixed
(cherry picked from commit 060c285)
2016-06-07 14:54:35 +02:00
Dmitry Jemerov
87d07924da when finding usages of parameter of annotation class primary constructor, search also for light method generated from that parameter
#KT-9399 Fixed
(cherry picked from commit 7e2ce2d)
2016-06-07 14:54:28 +02:00
Alexey Andreev
e45e3dd652 JS/Inliner: fix build 2016-06-07 12:24:55 +03:00
Alexey Andreev
0f1e21cdf8 JS/Inlining: in RedundantStatementElimination remove unnecessary side effect check for binary expressions 2016-06-07 12:24:54 +03:00
Alexey Andreev
5ad50f837a JS/Inlining: rename IneffectiveStatementElimination to RedundantStatementElimination 2016-06-07 12:24:54 +03:00
Alexey Andreev
3cb1a71b75 JS/Inlining: minor improvements and clarifications after code review. Test whether expression without side effect does not prevent to relocate another expressions 2016-06-07 12:24:54 +03:00
Alexey Andreev
2166547123 JS/Inlining: change sideEffects metadata to take three values: producing side effect, dependding on side effect and purity 2016-06-07 12:24:53 +03:00
Alexey Andreev
0936839410 JS/Inlining: improve test for removal of binary expresions without side effect, add tests for removal of a reference to a function parameter 2016-06-07 12:24:53 +03:00
Alexey Andreev
c0d094b1e3 JS/Inlining: refactor TemporaryVariableElimination 2016-06-07 12:24:52 +03:00
Alexey Andreev
654700694a JS/Inlining: refactor IneffectiveStatementElimination 2016-06-07 12:24:52 +03:00
Alexey Andreev
e7b7628f6c JS/Inlining: clarify why it's necessary to remove expression statements like a[b] 2016-06-07 12:24:51 +03:00
Alexey Andreev
a304ffd0c9 JS/Inlining: in temporary variable elimination don't treat FQN without side effects as trivial, i.e. disable moving these vars freely across function body 2016-06-07 12:24:51 +03:00
Alexey Andreev
b983312d0a JS/Inlining: minor simplifications after code review 2016-06-07 12:24:51 +03:00
Alexey Andreev
53ce2d0446 JS/Inlining: refactor TemporaryAssignmentElimination, add more tests 2016-06-07 12:24:50 +03:00
Alexey Andreev
3e19c09d57 JS/Inlining: add test case for KT-10931 2016-06-07 12:24:50 +03:00
Alexey Andreev
2b6ddb1608 JS/Inlining: minor code style fixes 2016-06-07 12:24:49 +03:00
Alexey Andreev
54f59fdc3d JS/Inlining: in function call like fn() extract fn to a local variable, since fn can be access to property with side effects. Add tests to prove that evaluation order became proper in certain cases. Fix KT-11711, KT-7674, KT-7043 2016-06-07 12:24:49 +03:00
Alexey Andreev
2486da41d8 JS/Inlining: mark closure constructors as free from side effects 2016-06-07 12:24:48 +03:00
Alexey Andreev
2ab89ea65c JS/Inlining: in temporary variable elimination improve moving of some expressions which are provably pure 2016-06-07 12:24:48 +03:00
Alexey Andreev
dda6330be8 JS/Inlining: when generating expression for default property accessor, mark this expression as side effect free, so optimizer has opportunity to move it 2016-06-07 12:24:45 +03:00
Alexey Andreev
78f4f20080 JS/Inlining: fix broken evaluation order after applying temporary variable elimination 2016-06-07 12:24:09 +03:00
Alexey Andreev
00ce8b3fc1 JS/Inlining: in expression like f(g()), where *f* is inline, don't treat g() as a lambda constructor 2016-06-07 12:24:09 +03:00
Alexey Andreev
78d62b2985 JS/Inlining: introduce removal of expression statements without side effects 2016-06-07 12:24:08 +03:00
Alexey Andreev
909bc0161c JS/Inlining: introduce removal of unused variables 2016-06-07 12:24:08 +03:00
Alexey Andreev
34dfadd278 JS/Inlining: in temporary variable elimination introduce better recognition of FQNs without side effects 2016-06-07 12:24:08 +03:00
Alexey Andreev
e8a92150b4 JS/Inlining: always create temporary variables to alias expressions in following cases:
* when decomposing expression that contains inline calls, alias all subexpressions
* when substituting arguments to inline call
* for value returned from inline function.

Instead, rely on dedicated optimization pass. Improve lookup of function to inline, since the old one relied on immediate optimizations. Give more hints to optimizer.

This should make inlining more stable in different hard-to-reproduce corner cases with evaluation order.
2016-06-07 12:24:07 +03:00
Alexey Andreev
a72d63a8c9 JS/Inlining: fix bug in temporary assignment elimination which causes excess removal of assignment statement. When there is a set of temporary variables that receive same value in different execution branches, remove them carefully so that at least one (and, preferably, at most) remains in each branch. 2016-06-07 12:24:02 +03:00
Valentin Kipyatkov
72f6f9b5d7 KT-12260 ISE while replacing an operator with safe call
#KT-12260 Fixed
(cherry picked from commit 3f82cc9)
2016-06-06 15:11:27 +03:00
Alexander Udalov
2224702216 Minor, make CapturedParamInfo#skipInConstructor immutable
(cherry picked from commit 390b78b7f7)
2016-06-06 13:32:36 +03:00
Alexander Udalov
ac32cd83c1 Minor, delete CapturedParamOwner
(cherry picked from commit b370ac0b37)
2016-06-06 13:32:34 +03:00
Alexander Udalov
07ea37022a Cleanup inline codegen classes
Fix warnings, typos, formatting, break long lines, remove unused, add
nullability annotations, inline small methods used only once

(cherry picked from commit e148dcdee7)
2016-06-06 13:32:26 +03:00
Dmitry Jemerov
f74bd75dfa don't quote empty package name
(cherry picked from commit 6a1ffc8)
2016-06-03 16:28:48 +02:00
Dmitry Jemerov
a7074fe7a8 fix compilation 2016-06-03 15:11:25 +02:00
Dmitry Jemerov
cacbd4c553 change implementation of 'new file' action to support escaping the package name and creating directory/package hierarchy
#KT-8362 Fixed
 #KT-11328 Fixed
(cherry picked from commit 8b30e7e)
2016-06-03 14:19:54 +02:00
Dmitry Jemerov
a475da5256 de-i18n
(cherry picked from commit 5f89274)
2016-06-03 14:19:47 +02:00
Dmitry Jemerov
5d63e2346f NewKotlinFileAction: J2K
(cherry picked from commit 28100be)
2016-06-03 14:19:37 +02:00
Dmitry Jemerov
713fdcd409 NewKotlinFileAction: rename to .kt
(cherry picked from commit 2ee03a7)
2016-06-03 14:19:31 +02:00
Dmitry Jemerov
82a7fc6c29 show new icon for Kotlin annotations in structure view (KT-12516)
(cherry picked from commit 349376c)
2016-06-03 14:19:19 +02:00
Dmitry Jemerov
52a97a0b19 can't close contents in Kotlin Bytecode toolwindow (KT-9797)
(cherry picked from commit 987b48d)
2016-06-03 14:19:04 +02:00
Pavel V. Talanov
1938b436a1 Update changelog for 1.0.3 2016-06-02 19:19:41 +03:00
Mikhael Bogdanov
c70cfd28ca Don't generate unnecessary checkcast to java.lang.Number
(cherry picked from commit 092be8c)
2016-06-02 16:24:44 +03:00
Mikhael Bogdanov
67db7ab151 Fix for KT-12582: "VerifyError: Bad local variable type" caused by explicit loop variable type
#KT-12582 Fixed
(cherry picked from commit a6cf169)
2016-06-02 16:24:41 +03:00
Mikhael Bogdanov
7a76e4e38b Disabled several tests on android
(cherry picked from commit e7f9d34)
2016-06-02 16:24:38 +03:00
Mikhael Bogdanov
03040a71f3 Small refactoring in constant processing
(cherry picked from commit c7d97c6)
2016-06-02 16:24:36 +03:00
Mikhail Glukhikh
4c7e596897 Quick fix "add !!" for SMARTCAST_IMPOSSIBLE in certain situations
(cherry picked from commit 33b6780)
2016-06-02 16:13:17 +03:00
Mikhail Glukhikh
60fb5c7f29 Convert to expression body: take nested whens into account
(cherry picked from commit 9f819b1)
2016-06-02 16:12:57 +03:00
Mikhail Glukhikh
b9d630c7ac Convert to expression body is forbidden on single non-exhaustive when statement with Unit result #KT-12502 Fixed
(cherry picked from commit 2350caf)
2016-06-02 16:12:45 +03:00
Mikhail Glukhikh
0b6adb5c1e "Make abstract" is no longer applicable to object / enum entry members #KT-3797 Fixed
(cherry picked from commit 91ce8cc)
2016-06-02 16:12:32 +03:00
Nikolay Krasko
e57427a246 Remove forgotten import 2016-06-02 15:07:52 +03:00
Nikolay Krasko
d48294e8c7 NoSuchFieldError in Evaluate Expression on a property of a derived class (KT-12206)
#KT-12206 Fixed

Conflicts:
	compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java
2016-06-02 14:50:23 +03:00
Kirill Rakhman
944a4446ff Formatter: handle spaces between class name and type parameters (#875)
Fixes #KT-12446
(cherry picked from commit c24960f)
2016-06-01 20:23:11 +02:00
Alexander Udalov
022ef6410d Drop isAbsoluteInRootPackage from stubs
(cherry picked from commit 7eafae1936)
2016-06-01 19:33:45 +03:00
Alexander Udalov
3951b6f719 Drop undocumented absolute name specification feature with 'package.'
(cherry picked from commit 1339286261)
2016-06-01 19:32:21 +03:00
Alexey Tsvetkov
96e2deab25 Minor: fix snapshot version in gradle test 2016-06-01 16:45:21 +03:00
Alexey Tsvetkov
5872aeb375 Shade in kotlin-build-common-test 2016-05-31 22:20:16 +03:00
Alexey Tsvetkov
74f7e9f955 Shade in kotlin-android-extensions 2016-05-31 22:20:16 +03:00
Alexey Tsvetkov
caf87fbab2 Shade in kotlin-compiler-embeddable
Now kotlin gradle plugin is compatible with android gradle plugin 2.2

     #KT-12478 fixed
     #KT-12431 fixed
     #KT-12406 fixed
2016-05-31 22:20:16 +03:00
Alexey Tsvetkov
782f4bffbf Set idea.io.use.nio2=true every build on windows
Otherwise (setting property once in static block) gradle daemon might clear system properties

     #KT-11770 fixed
2016-05-31 22:20:16 +03:00
Mikhael Bogdanov
a020870de3 Fix for KT-12200: initial property assignment ignored
#KT-12200 Fixed
(cherry picked from commit 0f1589f)
2016-05-31 15:29:03 +03:00
Alexey Andreev
bff1963f9e KT-11960: add test for case of instantiating inner class of a local class 2016-05-31 15:25:40 +03:00
Alexey Andreev
1bcc173e36 KT-11960 Fix case of instantiation of local class via its inner class or via nested lambda. Move tests to more appropriate location. Fix bug in blackbox codegen generator for JVM, which does not allow to suppress tests. 2016-05-31 15:25:40 +03:00
Alexey Andreev
9b59d0de7a KT-11960 Minor code style fixes 2016-05-31 15:25:40 +03:00
Alexey Andreev
1124fddb9e KT-11960 Fix for data classes 2016-05-31 15:25:39 +03:00
Alexey Andreev
55b158f7d5 KT-11960 Fix for case when class instantiates itself 2016-05-31 15:25:39 +03:00
Alexander Udalov
d6addc4ea5 Keep Native2AsciiCharsetProvider from being stripped by proguard
#KT-12549 Fixed

(cherry picked from commit a300dee61f)
2016-05-31 14:28:44 +03:00
Kirill Rakhman
743ee4f278 Formatter: handle spaces around 'is' keyword (#874)
Fixes #KT-12548
(cherry picked from commit 93ebb3d)
2016-05-30 19:36:53 +02:00
Alexander Udalov
e14efcebc0 Fix compilation of kotlin-maven-plugin
(cherry picked from commit ec8c8da142c4325100dba64da5aaf04a9f405177)
2016-05-30 15:46:04 +03:00
Alexey Sedunov
886de1d9bf Spring Support: Fixed rename of custom-named beans specified with Kotlin annotation
#KT-12096 Fixed
(cherry picked from commit ec0f21c)
2016-05-30 15:38:32 +03:00
Alexey Sedunov
cee494eaf9 Spring Support: Automatic configuration by @Import and @ComponentScan ("basePackages"/"basePackageClasses")
#KT-12135 Fixed
 #KT-12139 Fixed
(cherry picked from commit 076e31c)
2016-05-30 15:38:16 +03:00
Alexey Sedunov
560b7c5be3 Spring Support: Implement @ComponentScan inspection
#KT-12465 Fixed
(cherry picked from commit 781a1e0)
2016-05-30 15:37:58 +03:00
Alexey Sedunov
9717eb5172 Code Insight: Implement package references inside of string literals
#KT-12136 In Progress
(cherry picked from commit d69140b)
2016-05-30 15:37:17 +03:00
Alexey Sedunov
0d97f96b0e Light Classes: Consider FakeFileForLightClass instances equivalent if they correspond to the light classes with common KtFile
#KT-12117 Fixed
(cherry picked from commit d52e62b)
2016-05-30 15:37:06 +03:00
Mikhail Glukhikh
bfbde9042d Simplify for intention: apply name validator to prevent conflicts
(cherry picked from commit 7a24429)
2016-05-30 14:44:21 +03:00
Mikhail Glukhikh
d07b0fcb8d Simplify for intention: applicable of any numbers of properties used #KT-10779 Fixed
(cherry picked from commit 792b37b)
2016-05-30 14:43:49 +03:00
Alexander Udalov
452932b55c Minor, update ChangeLog with '-language-version'
(cherry picked from commit fbd671c158)
2016-05-30 13:52:27 +03:00
Mikhail Glukhikh
dd6da009d9 Attach "add remaining branches" and "add else branch" fixes to NON_EXHAUSTIVE_WHEN warning #KT-12503 Fixed
(cherry picked from commit c26d7e0)
2016-05-30 12:34:38 +03:00
Alexander Udalov
461fdad5df Minor, add comments on declarations used in Eclipse plugin
(cherry picked from commit 68c5e8e190)
2016-05-27 19:41:42 +03:00
Alexander Udalov
b2f428d5b6 Minor, make Services#get return type nullable
(cherry picked from commit a95568eedf)
2016-05-27 19:41:39 +03:00
Alexander Udalov
6c9cdd82d3 Fix project compilation after introduction of bound references
`java` in the package name inside an extension to KClass is now resolved to the
extension property `KClass#java`. So `java.X::class` is now equivalent to
`this.java.X::class`

(cherry picked from commit 57849c9dfd)
2016-05-27 19:40:05 +03:00
Alexander Udalov
37d76c4866 Minor, capitalize language feature names in tests
To simplify textual search across the codebase

(cherry picked from commit 7cb61b81ab)
2016-05-27 19:39:57 +03:00
Mikhail Glukhikh
6806b0813a Back-end JVM: more accurate handling of when expressions with Unit result #KT-12192 Fixed
(cherry picked from commit 8713190)
2016-05-27 18:12:33 +03:00
Pavel V. Talanov
56a8ea3492 Refactor LanguageFeatureSettings: Add LanguageVersion and LanguageFeature entities
(cherry picked from commit 76971eca70)
2016-05-27 14:32:41 +03:00
Alexander Udalov
195acce366 Minor, update javac2 annotation filter for kotlin-build-common-test
(cherry picked from commit 9bdf8f1082)
2016-05-27 14:28:13 +03:00
Alexander Udalov
b5ee06be1f Add tests on "-language-version" usage from Ant, Maven, Gradle
(cherry picked from commit 2c516f18a0)
2016-05-27 14:27:58 +03:00
Alexander Udalov
efbecc9fb2 Validate "-language-version" argument value, add tests
(cherry picked from commit bc5202a4d7)
2016-05-27 14:25:44 +03:00
Alexander Udalov
fa3a7f056a Support enabling/disabling language features in diagnostic tests (unsupported in 1.0.3)
(cherry picked from commit 98c3e030a1)
2016-05-27 14:21:30 +03:00
Alexander Udalov
833cf8267f Support "-language-version" CLI option for compatibility with older releases
Introduce LanguageFeatureSettings, instance of which should be injected by the
container and be accessible everywhere during the compilation (front-end and
back-end).

Parameters of LanguageFeatureSettings are unused in this commit, will be used
later

(cherry picked from commit e1ba4480d7)
2016-05-27 14:16:13 +03:00
Pavel V. Talanov
ad6f2de8a1 KtLightMethod: Wrap return type so it resolves to light method's type parameter as opposed to delegate's
Affects java type inference in IDEA

  #KT-12090 Fixed
  #KT-11095 Fixed
2016-05-27 13:15:42 +03:00
Alexey Andreev
97228e5ac4 KT-6942: in JS backed for value equalitity patterns in when generate structural equality check (i.e. Any.equals) instead of referential check (===). 2016-05-26 14:31:50 +03:00
Alexander Udalov
bf3ada0592 Prevent META-INF/INDEX.LIST from jsr166e.jar to be packed into compiler
INDEX.LIST contains a list of jars with the information about what packages
does each of those jars have (this feature is called JarIndex, see
http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html). In case of
ideaSDK/core/jsr166e.jar, it only has one entry -- jsr166e.jar itself. When the
compiler is started, the class loading mechanism reads this file and assumes
that there are no other jars nearby. But the compiler depends on other jars,
namely kotlin-runtime.jar and kotlin-reflect.jar, thus we get
ClassNotFoundException when trying to load almost any Kotlin bytecode from
kotlin-compiler.jar.

Note that, fortunately, release builds are not affected because:
1) proguard helpfully strips this file from the final kotlin-compiler.jar;
2) we use a custom class loader (Preloader) which ignores JarIndex.
This only affects local setup with proguard disabled, where one test
(CompilerDaemonTest) was failing because it was trying to invoke the compiler
directly via "java -jar ..."

To implement this, it was necessary to exclude this one file from the compiler
jar, however the "zipgroupfileset" Ant task does not support exclusion of one
file from a particular archive, so we pack all idea core libraries into one jar
beforehand and use "zipfileset" which supports exclusion of one file
(http://stackoverflow.com/a/2426245/288456).

(cherry picked from commit c3f1afee626502470dbe27a1343c777e5cade789)
(cherry picked from commit 9a762e0fa2)
2016-05-26 14:18:33 +03:00
Alexander Udalov
db2fa0fbdf Fix kotlin-maven-plugin compilation
(cherry picked from commit e5d64d316d)
2016-05-26 14:18:31 +03:00
Alexander Udalov
3db9871a13 Render different class kinds differently in bytecode listing test
(cherry picked from commit b208995d73)
2016-05-26 13:27:05 +03:00
Alexander Udalov
84b573d1ea J2K backend-common classes: convert
Also merge CodegenUtilKt into CodegenUtil

(cherry picked from commit c1c2651988)
2016-05-26 13:26:54 +03:00
Alexander Udalov
b043906395 J2K backend-common classes: rename .java -> .kt
(cherry picked from commit 27ed0dd25f)
2016-05-26 13:25:33 +03:00
Alexander Udalov
f59bf2d8ef Minor, comment out ignored test
(cherry picked from commit d89e907f00)
2016-05-26 13:24:48 +03:00
Alexander Udalov
0b44a90823 Move some configuration keys to JVM or to CommonConfigurationKeys
Move CONTENT_ROOTS and SCRIPT_DEFINITIONS_KEY to JVMConfigurationKeys because
they are only used on JVM, rename the latter to SCRIPT_DEFINITIONS.

Move MODULE_NAME to CommonConfigurationKeys to be combined with MODULE_ID in
JSConfigurationKeys in the future

(cherry picked from commit 05f8836f46)
2016-05-26 13:24:38 +03:00
Alexander Udalov
8233c5d458 Delete unused ParentLastURLClassLoader
(cherry picked from commit 5bf14c106a)
2016-05-26 13:20:50 +03:00
Alexander Udalov
89059bda04 Remove dangerous readKotlinHeader() in inlineUtil.kt
It was creating a phantom FileBasedKotlinClass which was not based on any file

(cherry picked from commit b9fb6c0d84)
2016-05-26 13:20:44 +03:00
Alexander Udalov
c19dbefe1b Move JVMConfigurationKeys to frontend.java
Similarly to K2JVMCompilerArguments, they will soon be needed in the IDE code.
Move COMPILER_JAR_LOCATOR to CLIConfigurationKeys because it's used both in JVM
and JS, and only in CLI. Other keys, non-relevant in the IDE, may be moved out
soon as well, such as incremental compilation components

(cherry picked from commit 6c0ff40197)
2016-05-26 13:19:45 +03:00
Alexander Udalov
c07350227e Minor, break the line in "kotlinc -help" if it's too long
To improve description of the "pluginOptions" flag

(cherry picked from commit dcb2d7b4f6)
2016-05-26 13:19:39 +03:00
Alexander Udalov
c2cf56b137 Rename compilerConfigurationForTests -> newConfiguration
(cherry picked from commit 6674412079)
2016-05-26 13:15:45 +03:00
Alexander Udalov
6e967b1e0b Rename Config -> JsConfig
(cherry picked from commit 116e4a5ced)
2016-05-26 13:11:11 +03:00
Alexander Udalov
e9fe329415 Get rid of unnecessary exceptions in JS translator
Before this commit, an internal error during JS translation resulted in the
actual exception wrapped in TranslationRuntimeException wrapped in
TranslationInternalException wrapped in RuntimeException being thrown. This
change gets rid of the two latter wrappings.

Also delete unthrown MainFunctionNotFoundException and related unused
constructors in TranslationException

(cherry picked from commit 2bd3211ba8)
2016-05-26 13:11:05 +03:00
Alexander Udalov
7131238c86 Add MessageCollector#hasErrors, get rid of MessageSeverityCollector
Also fix duplicated wrapping of a message collector into a message severity
collector (in CLICompiler and in the beginning of doExecute in
K2JVMCompiler/K2JSCompiler)

(cherry picked from commit 3c81bb4bfc)
2016-05-26 13:10:20 +03:00
Alexander Udalov
7ae2ab8437 Move TEST_MODULE_NAME to KotlinTestUtils and change value to "test-module"
This name is more generic and thus can be used everywhere, not only in Java
integration tests

(cherry picked from commit 69343549b7)
2016-05-26 13:06:21 +03:00
Alexander Udalov
4be84d8d4c Remove traces of old compiler plugin architecture
It was retired with the deprecation and subsequent removal of the old KDoc, and
is now unused

(cherry picked from commit 3ca77de924)
2016-05-26 13:03:51 +03:00
Alexander Udalov
caf0184e2f Introduce CompilerConfiguration#getNotNull and getBoolean
To reduce boilerplate at call sites

(cherry picked from commit 8c0f78db50)
2016-05-26 13:03:38 +03:00
Alexander Udalov
6e5dd83b67 Minor, fix warnings and improve style in KotlinToJVMBytecodeCompiler
(cherry picked from commit 81a0fa5f47)
2016-05-26 13:00:35 +03:00
Dmitry Jemerov
90be470172 cleanup after code review
(cherry picked from commit 495a3e9)
2016-05-25 21:09:43 +02:00
Dmitry Jemerov
6c5a3b7734 fix PsiCheckerTestGenerated according to removed "property with backing field" highlighting
(cherry picked from commit b37ac4f)
2016-05-25 21:09:32 +02:00
Dmitry Jemerov
f493a42d27 inherit Kotlin TYPE_PARAMETER from Java TYPE_PARAMETER
#KT-11465 Fixed
(cherry picked from commit 14559bf)
2016-05-25 21:09:26 +02:00
Dmitry Jemerov
95d022c38d specify base color for ANNOTATION and LABEL
#KT-9410 Fixed
(cherry picked from commit 76178c5)
2016-05-25 21:09:21 +02:00
Dmitry Jemerov
4ef75eb110 highlight infix function calls
#KT-6540 Fixed
(cherry picked from commit 49335fa)
2016-05-25 21:09:15 +02:00
Dmitry Jemerov
7f1674ee50 remove CLASS highlight on top of CONSTRUCTOR_CALL for constructor calls
#KT-2919 Fixed
(cherry picked from commit a448af5)
2016-05-25 21:09:10 +02:00
Dmitry Jemerov
a48d4dc9be TypeKindHighlightingVisitor: J2K
(cherry picked from commit e7cb256)
2016-05-25 21:09:04 +02:00
Dmitry Jemerov
ab23195d54 TypeKindHighlightingVisitor: rename to .kt
(cherry picked from commit e07e16a)
2016-05-25 21:08:58 +02:00
Dmitry Jemerov
407405f305 remove PARAMETER highlight on top of INSTANCE_PROPERTY for primary constructor parameters
(cherry picked from commit e9cefd9)
2016-05-25 21:08:52 +02:00
Dmitry Jemerov
abb7c4a13a remove LOCAL_VARIABLE highlight on top of BACKING_FIELD_VARIABLE
(cherry picked from commit b51637d)
2016-05-25 21:08:46 +02:00
Dmitry Jemerov
890ef8c952 VariablesHighlightingVisitor: cleanup after J2K
(cherry picked from commit 4261e4a)
2016-05-25 21:08:41 +02:00
Dmitry Jemerov
6dcdd7f8a3 VariablesHighlightingVisitor: J2K
(cherry picked from commit 77a48c1)
2016-05-25 21:08:34 +02:00
Dmitry Jemerov
6e19b7dc30 VariablesHighlightingVisitor: rename to .kt
(cherry picked from commit 4ddbe98)
2016-05-25 21:08:29 +02:00
Dmitry Jemerov
93b7e84ee8 PropertiesHighlightingVisitor: cleanup after J2K, remove "property has backing field" highlighting, don't layer other highlights
(cherry picked from commit c7cd86f)
2016-05-25 21:08:22 +02:00
Dmitry Jemerov
9542fd3e7c PropertiesHighlightingVisitor: j2K
(cherry picked from commit b76585e)
2016-05-25 21:08:14 +02:00
Dmitry Jemerov
44fbae0530 PropertiesHighlightingVisitor: rename to .kt
(cherry picked from commit 41cd55b)
2016-05-25 21:08:08 +02:00
Dmitry Jemerov
bc0d7cf64e FunctionsHighlightingVisitor: cleanup after J2K, remove overlaid highlighting of function calls
(cherry picked from commit 5512043)
2016-05-25 21:08:03 +02:00
Dmitry Jemerov
e26410a307 FunctionsHighlightingVisitor: J2K
(cherry picked from commit c515740)
2016-05-25 21:07:57 +02:00
Dmitry Jemerov
9da5de9271 FunctionsHighlightingVisitor: rename to .kt
(cherry picked from commit 83b5028)
2016-05-25 21:07:51 +02:00
Dmitry Jemerov
f3fad4ad07 Kotlin with Gradle: generate 'repositories' call, use kotlin_version property
#KT-11841 Fixed
(cherry picked from commit 855ddf9)
2016-05-25 15:44:25 +02:00
Dmitry Jemerov
2898fce39d call BuildManager.clearState(project) in apply() method of Kotlin Compiler Settings configurable
#KT-10255 Fixed
(cherry picked from commit ccbb3d0)
2016-05-25 15:44:03 +02:00
Dmitry Jemerov
522df6f1f8 add icon for Kotlin annotation classes
#KT-11814 Fixed
(cherry picked from commit 1865750)
2016-05-25 15:43:46 +02:00
Dmitry Jemerov
2aae0a1a7d always show current plugin version in update check dialog
#KT-12076 Fixed
(cherry picked from commit 22d3789)
2016-05-25 15:43:27 +02:00
Dmitry Jemerov
4e5e2ae08e "Configure Kotlin plugin updates" is a dumb-aware action
#KT-12075 Fixed
(cherry picked from commit b8eb1da)
2016-05-25 15:43:04 +02:00
Dmitry Jemerov
f86e01fca8 help ID for compiler configuration page
#KT-12110 Fixed
(cherry picked from commit 83798f5)
2016-05-25 15:42:57 +02:00
Dmitry Jemerov
709aa92bd8 remove unnecessary ? from 'serr' live template
#KT-12289 Fixed
(cherry picked from commit e920c35)
2016-05-25 15:42:33 +02:00
Pavel V. Talanov
76bf4a71e7 lightClassUtils: Fix CCE when trying to obtain KtLightTypeParameter
#KT-12259 Fixed
2016-05-25 15:56:53 +03:00
Pavel V. Talanov
4f771fdb55 'const val' are now considered constants by Java in IDEA
#KT-12026 Fixed
2016-05-25 15:56:51 +03:00
Pavel V. Talanov
3b4069c996 Implement getLanguageLevel for FakeFileForLightClass
#KT-12006 Fixed
2016-05-25 15:56:49 +03:00
Pavel V. Talanov
bd1d4034fd Replace usages of blocking lazy to LazyThreadSafetyMode.PUBLICATION in light classes to prevent potential deadlocks 2016-05-25 15:41:51 +03:00
Pavel V. Talanov
18636e6ae7 Fix deadlock: synchronized lazy in KtLightModifierListWithExplicitModifiers 2016-05-25 15:41:50 +03:00
Nikolay Krasko
4d6a69011e Update to idea 2016.1.2 2016-05-24 17:46:20 +03:00
Nikolay Krasko
b1d84bc89b More write action requirement remove
Workaround for exception: Refactorings should not be started inside write action because they start progress inside and any read action from the progress task would cause the deadlock
2016-05-24 17:45:25 +03:00
Nikolay Krasko
40509366b8 Don't request write action for ChangeParameterTypeFix because it's based on refactoring
Workaround for exception: Refactorings should not be started inside write action because they start progress inside and any read action from the progress task would cause the deadlock
2016-05-24 17:45:25 +03:00
Nikolay Krasko
4de95d5abf Don't request write action for RemoveUnusedFunctionParameterFix because it's based on refactoring (KT-12440)
Workaround for exception: Refactorings should not be started inside write action because they start progress inside and any read action from the progress task would cause the deadlock

 #KT-12440 Fixed
2016-05-24 17:45:25 +03:00
Nikolay Krasko
e6fd73c500 Don't request write action for ReplaceExplicitFunctionLiteralParamWithItIntention because it's based on refactoring (KT-12436)
Workaround for exception: Refactorings should not be started inside write action because they start progress inside and any read action from the progress task would cause the deadlock

 #KT-12436 Fixed
2016-05-24 17:45:25 +03:00
Mikhail Glukhikh
eccbb499fe Minor refactoring: convert to block body
(cherry picked from commit 9e487a6)
2016-05-24 17:41:45 +03:00
Mikhail Glukhikh
613e5b1968 Convert to block body: when expression with Unit result is now handled as "return needed" #KT-12193 Fixed
(cherry picked from commit fa5e284)
2016-05-24 17:41:42 +03:00
Mikhail Glukhikh
9e10893462 REDUNDANT_OPEN_FOR_INTERFACE warning: reported for open members without implementation #KT-12452 Fixed
(cherry picked from commit 9a69b8b)
2016-05-24 17:41:38 +03:00
Mikhail Glukhikh
dbe179ebde Default modality is abstract for interface. REDUNDANT_MODIFIER_FOR_TARGET applicability reduced #KT-12302 Fixed
(cherry picked from commit e66acd8)
2016-05-24 17:41:34 +03:00
Mikhail Glukhikh
0d129f9d10 KT-12302: ABSTRACT_MODIFIER_IN_INTERFACE warning is removed as obsolete
(cherry picked from commit 93defed)
2016-05-24 17:41:31 +03:00
Pavel V. Talanov
0745f2e4bf REPL UI: fix history pane not showing latest command after command execution 2016-05-24 17:34:34 +03:00
Pavel V. Talanov
81ef3c5684 ProjectRootsUtil: accept directories and jar roots if "includeClassFiles == true" 2016-05-24 15:32:42 +03:00
Pavel V. Talanov
daad2a529c Implement IdeReplCompletionTest to test completion of entities declared in already evaluated lines 2016-05-24 15:32:41 +03:00
Pavel V. Talanov
01717e8f8c Minor: prettify ReplState 2016-05-24 15:32:40 +03:00
Pavel V. Talanov
ff389f99a3 Use ReplState to implement completion in IDE REPL
Consider sucessfully evaluated lines as previous lines when analyzing console file
2016-05-24 15:32:40 +03:00
Pavel V. Talanov
89910692d0 Limit resolve scope when completing in module sources 2016-05-24 15:32:39 +03:00
Pavel V. Talanov
1bd0c54bd6 implicitReceiversUtils: Script descriptors are implicit receivers
This fixes completion in repl
2016-05-24 15:32:38 +03:00
Pavel V. Talanov
2a7c0db825 Move ReplState to frontend 2016-05-24 15:32:37 +03:00
Pavel V. Talanov
c0ca947cbb Minor: Rename KotlinReplTest 2016-05-24 15:32:37 +03:00
Pavel V. Talanov
ac8afae2e0 Fix import resolution in Repl
#KT-11428 Fixed

 Refactor ReplState to be a component
2016-05-24 15:32:36 +03:00
Pavel V. Talanov
e3aa5d183f Minor: ScopeUtils: avoid wrapping lexical scopes several times 2016-05-24 15:32:35 +03:00
Pavel V. Talanov
cc9adf15e1 Refactor: replace LastLineScopeProvider with ReplState, extract FileScopeFactory from FileScopeProviderImpl 2016-05-24 15:32:34 +03:00
Pavel V. Talanov
192a8edbee Refactor: extract resolve related code from ReplInterpreter to CliReplAnalyzerEngine 2016-05-24 15:32:33 +03:00
Mikhail Glukhikh
d40f851e52 Build fix (1.0.3 vs 1.1 difference) 2016-05-24 10:13:15 +03:00
Mikhail Glukhikh
2a9805f77c Only private constructors for sealed / enum classes #KT-12377 Fixed
Also #KT-8497 Fixed
(cherry picked from commit 1a8181b)
2016-05-23 17:50:35 +03:00
Mikhail Glukhikh
eaef198878 Annotation parameters now cannot be mutable #KT-12367 Fixed
(cherry picked from commit cffdce9)
2016-05-23 17:49:29 +03:00
Mikhail Glukhikh
d553327c7e Cleanup: simplify for
(cherry picked from commit ceb4aa7)
2016-05-23 12:27:19 +03:00
Mikhail Glukhikh
366be38453 Cleanup: val can be parameter
(cherry picked from commit ebd57fa)
2016-05-23 12:27:11 +03:00
Alexey Andreev
88cb987558 JS: improve performance of Hashtable-based collections 2016-05-23 12:24:29 +03:00
Alexey Andreev
1dad7f1625 KT-11086 Treat initializer of a companion object as a class initializer 2016-05-23 12:24:29 +03:00
Alexey Andreev
ffbd6b41a7 KT-7424: add test to show that inlining works for anonymous functions 2016-05-23 12:24:29 +03:00
Alexey Andreev
cf01144fa9 KT-8386: pass mutable list to JsInvocation from intrinsic generator, so that inliner had a chance to replace arguments 2016-05-23 12:24:28 +03:00
Pavel V. Talanov
97f2b0df3e Implement "Decompile Kotlin to Java" action
Add this action to "Attach sources" notification panel if present
 #KT-11657 Fixed
2016-05-23 12:04:42 +03:00
Pavel V. Talanov
4fc3c6b41f Minor: typo in changeLog 2016-05-23 11:52:57 +03:00
Alexander Udalov
fcf19b9db4 Remove SAFE_CALL_IN_QUALIFIER diagnostic which was never reported
See UNEXPECTED_SAFE_CALL which is reported instead
2016-05-20 22:40:55 +02:00
Alexander Udalov
38bcacd988 Do not produce trailing space when rendering root package header 2016-05-20 22:40:41 +02:00
Nikolay Krasko
a37e7a782b Restore packing plugin-api module output to plugin 2016-05-20 20:04:05 +03:00
Nikolay Krasko
413ab743cd Check there's no direct usages of asm (org.objectweb.asm) library in project
Such usages should be replaced with asm from idea (org.jetbrains.org.objectweb.asm)
2016-05-20 16:00:54 +03:00
Nikolay Krasko
92c3b1f570 Don't use reference to asm directly. Use asm from Idea instead. 2016-05-20 16:00:54 +03:00
Stanislav Erokhin
543ae45eec Fixed type checking recursive problem.
#KT-11995 Fixed
2016-05-20 09:28:59 +03:00
Pavel V. Talanov
69156f22fb Minor, missed '#' 2016-05-19 22:06:38 +03:00
Pavel V. Talanov
305fe89d30 Update ChangeLog for 1.0.3
Improve ticket number presentation for 1.0.3
2016-05-19 22:03:17 +03:00
Ilya Gorbunov
6be6726b5d Do not deploy anymore kotlin maven plugin tests and build common test utilities to maven central
(cherry picked from commit fda9797dc4)
2016-05-19 18:31:15 +03:00
Ilya Gorbunov
23ce84721c Sanitize escape sequences when verifying maven output
(cherry picked from commit bdf80ec747)
2016-05-19 18:31:15 +03:00
Ilya Gorbunov
5000772ddc Specify kotlin snapshot version in maven plugin integration tests only once.
(cherry picked from commit 7f5b586e3f)
2016-05-19 18:31:15 +03:00
Zalim Bashorov
f197ee5363 JS backend: use ResolvedCall when translate super expression and remove some heuristics when translate receivers; generate right receiver when reference to super of outer class;
(cherry picked from commit 7b1afd4)
2016-05-19 17:37:35 +03:00
Alexey Sedunov
695e20a48e Spring Support: Show autowiring candidates line markers for @Autowired-annotated constructors and constructor parameters
#KT-12120 Fixed
(cherry picked from commit 26be254)
2016-05-19 15:09:20 +03:00
Alexey Sedunov
0ad6a3802b Spring Support: Fixed bean references in factory method calls
#KT-12384 Fixed
(cherry picked from commit 2bd03fe)
2016-05-19 15:09:19 +03:00
Alexey Sedunov
bf1e2bd0dd Spring Support: Fixed "Spring Facet Code Configuration (Kotlin)" inspection description
#KT-12143 Fixed
(cherry picked from commit 417995b)
2016-05-19 15:09:18 +03:00
Alexey Sedunov
20a7f83915 Spring Support: Report object declarations in "Final Kotlin class or function with Spring annotation" inspection
#KT-12148 Fixed
(cherry picked from commit 53b08a1)
2016-05-19 15:09:17 +03:00
Alexey Sedunov
fa2e925ed7 Spring Support: Fixed "Autowired members defined in invalid Spring bean (Kotlin)" inspection description
#KT-12363 Fixed
(cherry picked from commit aaa42e8)
2016-05-19 15:09:16 +03:00
Alexey Sedunov
d262e462bb Spring Support: Implement Spring @Autowired inspection
#KT-12278 Fixed
 #KT-12147 Fixed
 #KT-12366 Fixed
 #KT-12122 Fixed
(cherry picked from commit 85d07e5)
2016-05-19 15:09:15 +03:00
Alexey Sedunov
02fa66fbaa Refactoring: Extract registerWithElementsUnwrapped() function
(cherry picked from commit 36f3d30)
2016-05-19 15:08:14 +03:00
Mikhail Glukhikh
c081d0b9a9 Simplify for: take into account two or more possible local variables for the same loop parameter property
(cherry picked from commit f81192d)
2016-05-19 14:38:48 +03:00
Mikhail Glukhikh
9085175fb3 Simplify for: take into account local property mutability
(cherry picked from commit 9108ab1)
2016-05-19 14:37:52 +03:00
Mikhail Glukhikh
d4b17dbdfa Simplify for: take into account loop parameter nullability
(cherry picked from commit d0fd3de)
2016-05-19 14:37:37 +03:00
Mikhail Glukhikh
bde4b943fe Simplify for now works even if no variables are declared inside loop #KT-12145 Fixed
(cherry picked from commit a56248a)
2016-05-19 14:35:35 +03:00
Mikhail Glukhikh
6b8a54b230 Import as alias with another name is now counted as usage itself #KT-11933 Fixed
(cherry picked from commit c95e11c)
2016-05-19 14:29:45 +03:00
Mikhail Glukhikh
15c09c483e Cleanup: simplify for
(cherry picked from commit 0cf61b1)
2016-05-19 14:29:31 +03:00
Mikhail Glukhikh
4ba9433187 Simplify for intention: now is not active if map / data class properties aren't used in a loop #KT-11716 Fixed
(cherry picked from commit d366da5)
2016-05-19 14:29:14 +03:00
Mikhail Glukhikh
b5d89c549c Can be parameter inspection: usage in secondary constructor is now handled as property use
(cherry picked from commit 3930184)
2016-05-19 14:28:57 +03:00
Mikhail Glukhikh
a796b66e05 Can be parameter inspection: minor test correction
(cherry picked from commit bc7fbdc)
2016-05-19 14:28:42 +03:00
Mikhail Glukhikh
64fa595716 Can be parameter inspection: handle usage in super call; again #KT-10819 Fixed
(cherry picked from commit b026969)
2016-05-19 14:28:27 +03:00
Alexey Andreev
ec78ab5ffa KT-12254 Prevent JsEmptyExpression from getting into initializer JS when compiling code like val x = throw Exception() 2016-05-19 11:42:32 +03:00
Alexey Andreev
b75677cccd KT-8005 Add test to prove the issue is no more reproducible 2016-05-19 11:38:13 +03:00
Alexey Andreev
fdf15407ea KT-8299 Make proper access to private fields in generated methods of data classes 2016-05-19 11:34:51 +03:00
Alexey Tsvetkov
827b74fc06 Minor: add repository path for android test 2016-05-18 15:41:18 +03:00
Alexey Tsvetkov
06c6234561 Keep order of parsed annotations 2016-05-18 15:41:10 +03:00
Alexey Tsvetkov
fdbf6f10e8 Minor: fix downloading sdk in test 2016-05-18 15:40:54 +03:00
Alexey Tsvetkov
38d7a357fc Avoid cache corruption on compile error
#KT-11874 fixed
2016-05-18 15:40:48 +03:00
Alexey Tsvetkov
2b6b7181e1 Fix Application leak in AbstractAnnotationProcessorBoxTest 2016-05-18 15:40:44 +03:00
Alexey Tsvetkov
5117bf1184 Refactoring: rename ClassBuilderMode entry LIGHT_CLASSES_WITH_METADATA->KAPT 2016-05-18 15:39:43 +03:00
Alexey Tsvetkov
e64649fb0a Fix collecting source retention annotations
#KT-12187 fixed
2016-05-18 15:39:38 +03:00
Alexey Tsvetkov
167dd1a927 Add class stubs dir to stub generation task classpath 2016-05-18 15:39:30 +03:00
Alexey Tsvetkov
f9722393dc Serialize error type to proto when generating stubs 2016-05-18 15:39:27 +03:00
Alexey Tsvetkov
bef65e4283 Refactoring: rename javaAptSourceDir->hackAnnotationDir 2016-05-18 15:39:23 +03:00
Alexey Tsvetkov
dcaf6dcef5 Refactoring: rename AnnotatedElementDescriptor->AnnotatedElement 2016-05-18 15:39:19 +03:00
Alexey Tsvetkov
0cc3f4be3d Exclude compiled files when compiling incrementally 2016-05-18 15:39:16 +03:00
Alexey Tsvetkov
5f8220c937 Report compiled classes when generating kapt stubs 2016-05-18 15:39:12 +03:00
Alexey Tsvetkov
385d335042 Include metadata in light classes for kapt 2016-05-18 15:39:09 +03:00
Alexey Tsvetkov
571f31c743 Fix incremental compilation with kapt generating stubs
Changes:
* map incremental property to compile kotlin after java task
* when generating stubs compile kotlin task should not remove or copy classfiles
2016-05-18 15:38:12 +03:00
Alexey Tsvetkov
626e6657d9 Add kapt incremental tests 2016-05-18 15:38:08 +03:00
Alexey Tsvetkov
fb5390a738 Update kapt annotations file incrementally 2016-05-18 15:38:03 +03:00
Alexey Tsvetkov
a4176b0cbb Serialize KotlinAnnotationProvider 2016-05-18 15:37:59 +03:00
Alexey Tsvetkov
d93d4dc38a Minor: extract constant 2016-05-18 15:37:55 +03:00
Alexey Tsvetkov
4f6317694e Refactoring: make AnnotatedElementDescriptor hierarchy sealed 2016-05-18 15:37:51 +03:00
Alexey Tsvetkov
4f6f3879c6 Pass reader as param 2016-05-18 15:37:47 +03:00
Alexey Tsvetkov
eb84b61b69 Make fun local since it's bound to outer function semantics 2016-05-18 15:37:43 +03:00
Alexey Tsvetkov
0e0dbb25b5 Read annotations during construction of KotlinAnnotationsProvider
The rationale is to access kotlinClassesInternal and annotatedKotlinElementsInternal
in any order
2016-05-18 15:37:38 +03:00
Alexey Tsvetkov
dd740b6e6b Minor: add const 2016-05-18 15:37:34 +03:00
Alexey Tsvetkov
7e359015d6 Pass reader in constructor to KotlinAnnotationProvider 2016-05-18 15:37:30 +03:00
Alexey Tsvetkov
1714b1c092 Make annotation collector tests more thorough 2016-05-18 15:37:27 +03:00
Alexey Tsvetkov
cc7f7103be Refactoring: move kapt tests to separate class 2016-05-18 15:37:23 +03:00
Alexey Tsvetkov
4fc118b20a Prevent compile tasks from running when nothing changes
#KT-10932 fixed
2016-05-18 15:37:13 +03:00
Alexey Tsvetkov
5427d81aa7 Minor: use more recent version of gradle in test 2016-05-18 15:33:21 +03:00
Alexey Tsvetkov
b151a5f6e8 Minor: do not print output in assertion message 2016-05-18 15:33:17 +03:00
Alexey Tsvetkov
73afad23b3 Refactoring: extract properties for gradle task's properties access in plugin 2016-05-18 15:33:13 +03:00
Mikhail Glukhikh
d4b27e2649 Unused symbol inspection refactoring: no use of bundled unused.*
(cherry picked from commit 20bff9f)
2016-05-18 14:51:59 +03:00
Mikhail Glukhikh
f1131da000 Overridden functions using default arguments in recursive call are no more considered tail recursive #KT-4285 Fixed
(cherry picked from commit a4ad995)
2016-05-18 14:51:48 +03:00
Mikhail Glukhikh
73a9c1568f Exhaustive when with 'Unit' result now also generates an exception in else branch #KT-12192 Fixed
(cherry picked from commit f35fd32)
2016-05-18 14:51:37 +03:00
Sergey Mashkov
529777fa0b KT-12074 Building Kotlin maven projects using a parent pom will silently fail
integration tests
2016-05-18 14:48:38 +03:00
Sergey Mashkov
79b1764554 Maven: add maven plugin multimodule test 2016-05-18 14:48:38 +03:00
Sergey Mashkov
b80115be88 KT-12074 Building Kotlin maven projects using a parent pom will silently fail
We should consider module's basedir if there is relative source directory specified for the execution
2016-05-18 14:48:38 +03:00
Nikolay Krasko
3d0d002bd6 Remove unused import 2016-05-18 14:18:52 +03:00
Ilya Gorbunov
f1c7b50814 Change memory growth assertions in testKotlinOnlyDaemonMemory: ensure that the maximum of the used memory established after several first builds doesn't raise significantly in the subsequent builds. Current constraint is 500K per 10 builds which gives 50K per build at average.
(cherry picked from commit 5ba8046b48)
2016-05-18 05:49:14 +03:00
Nikolay Krasko
4d35991a1c Remove unused method that causes compatibility problem in update AS plugin 2016-05-17 21:37:22 +03:00
Dmitry Jemerov
c23e8713a4 remove duplicate source root; update testdata according to the appearance of decompiler in dependencies
(cherry picked from commit fd78424)
2016-05-17 19:55:05 +02:00
Sergey Mashkov
518a030fe5 Maven: fix integration tests 2016-05-17 18:18:25 +03:00
Alexey Andreev
2255bde6e1 Minor style and formatting improvements of CallArgumentsTranslator 2016-05-17 10:34:03 +03:00
Alexey Andreev
2c7714e5d9 KT-12305 Fix passing single argument to native vararg function 2016-05-17 10:34:03 +03:00
Mikhail Glukhikh
6c4223ee44 Do not return primary constructor as an analyzable parent, probably #EA-73679 Fixed
(cherry picked from commit 79852e9)
2016-05-16 18:54:56 +03:00
Dmitry Jemerov
55c7c37da4 add "Decompile" button to Kotlin Bytecode toolwindow
(cherry picked from commit 1653f9f)
2016-05-16 16:05:56 +02:00
Alexey Sedunov
0ad6c8cefe Minor: Move META-INF to "resources" source root
(cherry picked from commit 60f23e9)
2016-05-16 14:16:27 +03:00
Alexey Sedunov
4e5e6c0b46 Code Insight: Suppress file reference completion on typing. Disable file references on string literals with escape sequences
(cherry picked from commit 29310b5)
2016-05-16 14:16:10 +03:00
Alexey Sedunov
51c49eba48 Spring Support: Replace light elements bound to line markers with their originals
#KT-12091 Fixed
(cherry picked from commit edb3fd8)
2016-05-16 14:16:00 +03:00
Mikhail Glukhikh
5113cb2935 'Long' type is now stored for 'Long' literal #KT-12267 Fixed
(cherry picked from commit 182ade1)
2016-05-16 11:21:14 +03:00
Mikhail Glukhikh
42ba9cf03f Code cleanup: protected is effectively private
(cherry picked from commit 9bd3be6)
2016-05-16 11:21:01 +03:00
Mikhail Glukhikh
28089434ad Code cleanup: redundant modality (minor)
(cherry picked from commit e31806e)
2016-05-16 11:20:48 +03:00
Mikhail Glukhikh
1726a31c6b Code cleanup: redundant visibility (minor)
(cherry picked from commit 1301d90)
2016-05-16 11:20:36 +03:00
Mikhail Glukhikh
b5523e32e2 Code cleanup: type parameters can have in / out variance
(cherry picked from commit 733f3e8)
2016-05-16 11:20:21 +03:00
Yaroslav Ulanovych
3e9da49c2f Fix KT-11839 maven goal to execute kotlin script 2016-05-15 16:12:43 +02:00
Natalia Ukhorskaya
aaae96bba6 Debugger: do not use forceResolveScope for codeFragments in completion and AutoImportFix.
#KT-12137 Fixed
2016-05-13 16:48:53 +03:00
Natalia Ukhorskaya
c452dd0491 Update icon for "New -> Kotlin Activity" Action
Assets were taken from DSGN-2829
2016-05-13 16:45:34 +03:00
Mikhail Glukhikh
93ed1705b9 Unused symbol: take into account possible JUnit static method annotations #KT-11320 Fixed
(cherry picked from commit 6da8ab7)
2016-05-13 16:42:05 +03:00
Mikhail Glukhikh
28c7244901 Unused symbol: secondary constructors are also under analysis #KT-10812 Fixed
(cherry picked from commit 8920e67)
2016-05-13 16:41:51 +03:00
Alexander Udalov
0f88682587 Add empty source jars to kotlin-build-common Maven artifacts
Maven Central requires all artifacts to have sources and javadocs
2016-05-12 23:47:27 +03:00
Valentin Kipyatkov
c5b1256960 KT-12080 Move parameter names higher up in code completion
#KT-12080 Fixed
(cherry picked from commit dd16eb1)
2016-05-12 22:24:41 +03:00
Ilya Gorbunov
c79731dbee Add tests for deserialization of collections persisted with kotlin 1.0
(cherry picked from commit 15dcd3d)
2016-05-12 21:35:06 +03:00
Ilya Gorbunov
4ffa2eaf39 Fix serialVersionUID for EmptyList after introducing RandomAccess interface. #KT-10794
(cherry picked from commit 6a07d5f)
2016-05-12 21:35:01 +03:00
Dmitry Jemerov
b3ccdbc626 specify github revision number in build parameters
(cherry picked from commit 11c0b30)
2016-05-12 17:00:23 +02:00
Nikolay Krasko
3200a17c51 Formatter: Don't enforce empty line between secondary constructors without body (KT-12175)
#KT-12175 Fixed
2016-05-12 17:35:50 +03:00
Nikolay Krasko
7be9805c3d Use left bound element types to tight empty delegation contructor call to declaration
CONSTRUCTOR_DELEGATION_CALL and CONSTRUCTOR_DELEGATION_REFERENCE types were modified.
2016-05-12 17:35:50 +03:00
Nikolay Krasko
d214e347ea Make code fragments files non-physical with event system disabled (KT-12232)
Fix "File copy should be non-physical and non-event-system-enabled! Language=Language:
kotlin; file=JetFile: fragment.kt of class org.jetbrains.kotlin.psi.KtExpressionCodeFragment" assert.

Inspired by Java fragment files

 #KT-12232 Fixed
2016-05-12 17:35:49 +03:00
Mikhael Bogdanov
395d359c7f Disabled dexInProcess and incremental compilation in test android module, explicitly set Xmx for dex process cause of teamcity memory allocation fails
(cherry picked from commit af2cf71)
2016-05-12 16:22:07 +03:00
Mikhael Bogdanov
046bb7348c Added support for 'JVM.INHERIT_MULTIFILE_PARTS' flag in android tests
(cherry picked from commit 1d2a83e)
2016-05-12 16:22:06 +03:00
Mikhael Bogdanov
3ee5272011 Added support for reflection tests on android
(cherry picked from commit ed60cf8)
2016-05-12 16:22:04 +03:00
Mikhael Bogdanov
e8e33b2636 Fix for KT-12125: Wrong increment/decrement on Byte/Char/Short.MAX_VALUE/MIN_VALUE
#KT-12125 Fixed
(cherry picked from commit d6a64af)
2016-05-12 16:22:01 +03:00
Mikhael Bogdanov
47bb721097 Support new tests on android, disabled not applicable ones
(cherry picked from commit ca31ce8)
2016-05-12 16:21:59 +03:00
Nikolay Krasko
ed7197e519 No more patched jflex 1.4.3 in idea repository. Download artifact from maven.
02c7c658e8
2016-05-12 13:53:50 +03:00
Nikolay Krasko
c3a9007ac3 Make downloading idea sources optional 2016-05-12 13:53:49 +03:00
Alexey Sedunov
343192c2ae Spring Support: Implement bean references in @Qualifier annotations
#KT-12092 Fixed
(cherry picked from commit df46a8c)
2016-05-12 13:09:47 +03:00
Alexey Sedunov
d2fc64ff56 Code Insight: Support file path references inside of Kotlin string literals
#KT-11704 Fixed
(cherry picked from commit 4a65b1c)
2016-05-12 13:09:45 +03:00
Alexey Sedunov
ee5b01be5c Spring Support: Support "Autowired members defined in invalid Spring bean" inspection on Kotlin declarations
#KT-12079 Fixed
(cherry picked from commit 44f565e)
2016-05-12 13:09:43 +03:00
Alexey Sedunov
d062b478bd Change Signature: Do not force substitution of error types
#EA-81021 Fixed
(cherry picked from commit d4aa179)
2016-05-12 13:09:42 +03:00
Valentin Kipyatkov
761d171de1 Added missing test data
(cherry picked from commit 0c367c6)
2016-05-11 20:16:38 +03:00
Valentin Kipyatkov
c3d4772e1e Do not use setting specifyFieldTypeByDefault for locals
(cherry picked from commit 9622231)
2016-05-11 20:16:31 +03:00
Valentin Kipyatkov
2245fdc9d5 Better code
(cherry picked from commit bf9e4a3)
2016-05-11 20:16:25 +03:00
Valentin Kipyatkov
2f7e4b0e2a Moved local method out
(cherry picked from commit 07c961d)
2016-05-11 20:16:19 +03:00
Valentin Kipyatkov
89a54a9982 KT-11952 J2K: Assertion failed in PropertyDetectionCache.get on conversion of access to Java constant of anonymous type
#KT-11952 Fixed
(cherry picked from commit bdd425c)
2016-05-11 20:16:12 +03:00
Valentin Kipyatkov
c88d6150e1 Fixed test data
(cherry picked from commit de02b56)
2016-05-11 20:16:06 +03:00
Valentin Kipyatkov
968d4ce680 Minor changes after code review
(cherry picked from commit 70a5540)
2016-05-11 20:15:59 +03:00
Valentin Kipyatkov
a35f80c6c1 KT-4727 J2K: Convert Java code copied from browser or other sources
#KT-4727 Fixed
(cherry picked from commit cca3237)
2016-05-11 20:15:53 +03:00
Valentin Kipyatkov
9932fcfdb8 Renamed class
(cherry picked from commit 4cbb098)
2016-05-11 20:15:46 +03:00
Valentin Kipyatkov
83edb851e3 Support of KT-11255 Support Move Element Left/Right actions for Kotlin (except for enum entries)
#KT-11255 Fixed
(cherry picked from commit 0720794)
2016-05-11 20:15:37 +03:00
Valentin Kipyatkov
9e10127828 Refactored AbstractCodeMoverTest
(cherry picked from commit 7e99a6b)
2016-05-11 20:15:29 +03:00
Valentin Kipyatkov
a0a6d1ee85 Restored lost tests
(cherry picked from commit 06db49b)
2016-05-11 20:15:23 +03:00
Valentin Kipyatkov
926634ab10 Converted to Kotlin
(cherry picked from commit b6301e8)
2016-05-11 20:15:15 +03:00
Valentin Kipyatkov
31d0e08515 KT-11974 Invert if-condition intention loses comments
#KT-11974 Fixed
(cherry picked from commit 8da5af3)
2016-05-11 20:15:05 +03:00
Mikhail Glukhikh
4437222d01 Unused symbol inspection: properties declared in primary constructor are now checked on 'Used' annotations #KT-11120 Fixed
(cherry picked from commit be2b37d)
2016-05-11 19:41:06 +03:00
Mikhail Glukhikh
0d1050d395 Do not try to make object's containing class abstract #KT-11466 Fixed
(cherry picked from commit a098977)
2016-05-11 19:40:55 +03:00
Alexander Udalov
031c1353b7 Update ChangeLog for 1.0.2 2016-05-11 12:20:27 +03:00
Alexey Sedunov
dc99fee4b4 Spring Support: Replace accessor name with property name when processing usages in Kotlin files
#KT-11880 Fixed
(cherry picked from commit 12987de)
2016-05-11 12:03:36 +03:00
Alexey Andreev
302ef0adac KT-11996 Fix issue with referencing outer class in case of inner class constructors and members/properties. Fix issue with referencing outer classes from secondary constructors. Remove unnecessary tests. 2016-05-10 17:56:43 +03:00
Alexey Andreev
37c14137e2 KT-11823 Generate proper argument for closure constructor for this as a free variable. Give some explanation for function that generates closure arguments as well as a clear name. Give explanation to some code in UsageTracker.isSingletonReceiver, augmented by a test case. 2016-05-10 17:55:57 +03:00
Nikolay Krasko
388a323105 Remove write action from refactoring start (KT-11486)
#KT-11486 Fixed
2016-05-10 16:13:35 +03:00
Nikolay Krasko
e9716ee88d Make KtLightModifierList behave like light element and check it in tests 2016-05-10 16:12:15 +03:00
Dmitry Jemerov
25734f92be move KDoc-related logic shared between IDEA and Dokka to ide-common module
(cherry picked from commit 42ba143)
2016-05-10 15:03:03 +02:00
Valentin Kipyatkov
32ca38de8c Fixed dialog with suggestion to process external code shown even when there is nothing to process
(cherry picked from commit 7b1bf4c)
2016-05-10 15:02:15 +03:00
Mikhail Glukhikh
832497773b Can be parameter inspection: usages in all functions are now handled as property usage
(cherry picked from commit 48ba63f)
2016-05-10 13:43:36 +03:00
Ilya Gorbunov
c1153eda3a Document functions which return set or map preserving the order of elements/entries.
#KT-11632 Fixed

(cherry picked from commit d646afabb2)
2016-05-08 03:28:56 +03:00
Dmitry Jemerov
7c3e8ae54a generate correct HTML for code blocks
(cherry picked from commit b5e5c6f)
2016-05-06 22:19:49 +02:00
Dmitry Jemerov
0b93ac51b5 support @receiver KDoc tag; somewhat more precise tag name completion
(cherry picked from commit 94c2414)
2016-05-06 22:18:43 +02:00
Dmitry Jemerov
5fd5be6e1b KDocKnownTag: J2K
(cherry picked from commit 3b57b78)
2016-05-06 22:18:34 +02:00
Dmitry Jemerov
a4ea7d3b2e KDocKnownTag: rename to .kt
(cherry picked from commit 6935cfe)
2016-05-06 22:18:26 +02:00
Dmitry Jemerov
2ba6808559 don't trim whitespace when converting whitespace to HTML
#KT-10998 Fixed
(cherry picked from commit 992817e)
2016-05-06 22:18:09 +02:00
Dmitry Jemerov
156ca8227b preserve leading indentation in KDoc code blocks
#KT-9933 Fixed
(cherry picked from commit d7b1526)
2016-05-06 22:17:36 +02:00
Dmitry Jemerov
077ec0289d integrate Ingo Kegel's Dokka fix for rendering standalone * and _ characters
(cherry picked from commit 721629f)
2016-05-06 22:17:24 +02:00
Dmitry Jemerov
b6b924d4e1 render markdown inside link texts
#KT-11791 Fixed
(cherry picked from commit 6cbf1de)
2016-05-06 22:16:59 +02:00
Dmitry Jemerov
16c391f9bd resolve references from @param to type parameters of functions
#KT-12001 Fixed
(cherry picked from commit c967cc8)
2016-05-06 22:13:33 +02:00
Kirill Rakhman
70e567a09d Add quickfix for UNUSED_LAMBDA_EXPRESSION (#867)
Fixes #KT-9757
(cherry picked from commit 97c3c63)
2016-05-06 17:51:28 +02:00
Kirill
294f5cf98d Don't mark magic Serializable methods as unused
Fixes #KT-10635
(cherry picked from commit 5b6a8dc)
2016-05-06 16:23:55 +02:00
Ilya Chernikov
3e9f302cf6 minor: fix after review 2016-05-06 12:58:51 +02:00
Ilya Chernikov
a450fbb18a minor: Make term "canceled" uniformly spelled in identifiers and strings in the daemon 2016-05-06 12:58:50 +02:00
Ilya Chernikov
e634881f96 Implement graceful connection failure behavior on daemon connect and cancellation check
Should fix (or actually - behave gracefully on) #EA-74003, #EA-74493, #EA-76032, #EA-76529, #EA-81295
Tests added
2016-05-06 12:58:49 +02:00
Ilya Chernikov
ad71747116 minor: Switch to simpler descending sort, reduce dependency 2016-05-06 12:58:48 +02:00
Nikolay Chashnikov
1f0b71abac run configuration: use default logic of creating new run configurations to avoid sharing RunConfigurationModule instances between different run configurations (KT-12204) (#869)
(cherry picked from commit 551aa70)
2016-05-06 11:02:58 +02:00
Valentin Kipyatkov
3a1e15f5c2 KT-12040 "Replace when with if" produce invalid code for first entry which has comment
#KT-12040 Fixed
(cherry picked from commit c45bee5)
2016-05-05 19:02:31 +03:00
Valentin Kipyatkov
44596b3723 KT-12138 Do not show "::error" in smart completion when any function type accepting one argument is expected
(actually made them lowest priority)

 #KT-12138 Fixed
(cherry picked from commit 16c38a2)
2016-05-05 19:02:31 +03:00
Valentin Kipyatkov
4e30143f51 Minor
(cherry picked from commit 81e4114)
2016-05-05 19:02:30 +03:00
Valentin Kipyatkov
db5a0fe4dc KT-12150 Smart completion suggests to compare non-nullable with null
#KT-12150 Fixed
(cherry picked from commit 941b415)
2016-05-05 19:02:30 +03:00
Valentin Kipyatkov
1b1306d372 No explicit runWriteAction required
(cherry picked from commit 40900b0)
2016-05-05 19:02:30 +03:00
Valentin Kipyatkov
ac2ab49e8f KT-12103 Smart completion for nested SAM-adapter produces short unresolved name
#KT-12103 Fixed
(cherry picked from commit 0769c54)
2016-05-05 19:02:29 +03:00
Valentin Kipyatkov
5c61b5dd17 Minor changes on code review
(cherry picked from commit 74b41cf)
2016-05-05 19:02:29 +03:00
Valentin Kipyatkov
5941f40444 KT-12045 J2K: creating Object() instance could be converted to Any()
#KT-12045 Fixed
(cherry picked from commit 92af610)
2016-05-05 19:02:28 +03:00
Valentin Kipyatkov
bca15e24ce KT-12054 J2K generates obj is Type<Any> instead of obj is Type<*>
#KT-12054 Fixed
(cherry picked from commit 76e067c)
2016-05-05 19:02:28 +03:00
Valentin Kipyatkov
81a15d9327 KT-12039 Convert Java to Kotlin -- static imports are imported as Class.CONST (missing .Companion)
#KT-12039 Fixed
(cherry picked from commit a8eef5e)
2016-05-05 19:02:28 +03:00
Valentin Kipyatkov
b01fe77ba2 Minor simplification
(cherry picked from commit a80d36e)
2016-05-05 19:02:27 +03:00
Valentin Kipyatkov
f99e01018e Moved import conversion out of "ast" package
(cherry picked from commit 569483a)
2016-05-05 19:02:27 +03:00
Valentin Kipyatkov
393befe4fa Do not duplicate list of default imports
(cherry picked from commit 83442db)
2016-05-05 19:02:27 +03:00
Valentin Kipyatkov
4d9d11cbfb Extracted methods
(cherry picked from commit 08a37b3)
2016-05-05 19:02:26 +03:00
Valentin Kipyatkov
c8356fb261 KT-12046 Java to Kotlin dangerous conversion (recursive property set)
#KT-12046 Fixed
(cherry picked from commit a9eadcb)
2016-05-05 19:02:26 +03:00
Valentin Kipyatkov
2938092be6 Minor
(cherry picked from commit 9c0e120)
2016-05-05 19:02:26 +03:00
Valentin Kipyatkov
ed099857c0 KT-10770 IDEA cannot keep import if a type is only referenced by kdoc.
#KT-10770 Fixed
(cherry picked from commit e1d8c72)
2016-05-05 19:02:25 +03:00
Valentin Kipyatkov
e5b4eb5c19 KT-12069 Specify language for all Kotlin code inspections
#KT-12069 Fixed
(cherry picked from commit cd2161b)
2016-05-05 19:02:25 +03:00
Valentin Kipyatkov
3239c191fb Highlighting of redundant semicolons
#KT-5010 Fixed
(cherry picked from commit 306edef)
2016-05-05 19:02:25 +03:00
Valentin Kipyatkov
6a6bff90e8 ConvertPropertyInitializerToGetterIntention to not be available inside lambda initializer
(cherry picked from commit 77033f5)
2016-05-05 19:02:24 +03:00
Valentin Kipyatkov
0a410dbbf2 Minor change on code review
(cherry picked from commit a51fe9a)
2016-05-05 19:02:24 +03:00
Valentin Kipyatkov
ea6ddd7aa6 Dropped redundant code which was required for lambda signature completion when the syntax was different
#KT-12033 Fixed
(cherry picked from commit 45d460a)
2016-05-05 19:02:23 +03:00
Valentin Kipyatkov
23cfb1d9f9 KT-12068 Special completion item for "[]" get-operator access
#KT-12068 Fixed
(cherry picked from commit 40022e8)
2016-05-05 19:02:23 +03:00
Valentin Kipyatkov
9295c87845 Completion to complete non-imported classes on the first invocation
#KT-8527 Fixed
(cherry picked from commit deb75b3)
2016-05-05 19:02:23 +03:00
Valentin Kipyatkov
cd3a11c9e2 KT-11680 Code completion of label for existing return with value inserts redundant whitespace
#KT-11680 Fixed
 #KT-9993 Fixed
(cherry picked from commit f0dd70d)
2016-05-05 19:02:22 +03:00
Nikolay Krasko
99f31b66c3 Description for AddJvmOverloadsIntention 2016-05-05 17:32:36 +03:00
Nikolay Krasko
d9c3ef655e Enable JDK 8 level in some tests for correct convert for method references 2016-05-05 17:32:29 +03:00
Alexey Andreev
a9220dd4d8 JS/RTTI: minor refactoring of expandInCalls 2016-05-05 17:29:16 +03:00
Alexey Andreev
6e75886a3d JS/RTTI: if it's known that T <: X & Y, where T is non-reified type variable, for each a is T check that a is X && a is Y 2016-05-05 17:29:15 +03:00
Alexey Andreev
fbab016ba7 JS/RTTI: in expressions like a as T when inferred type for a is S, where S <: T, don't generate type checking 2016-05-05 17:29:14 +03:00
Alexey Andreev
d6d2189344 JS/RTTI. Fix runtime checking against kotlin.CharSequence 2016-05-05 17:29:13 +03:00
Alexey Andreev
c6e18ef0d5 JS/RTTI: fix withInlineTurnedOff test 2016-05-05 17:29:12 +03:00
Alexey Andreev
ab3fca5b64 JS/RTTI: fix compiler crashing when translating expressions like (continue as T) 2016-05-05 17:29:11 +03:00
Zalim Bashorov
aedd3f2d53 JS/RTTI. Fix build and tests 2016-05-05 17:29:10 +03:00
Alexey Tsvetkov
01a32f6318 JS/RTTI. Fix run-time type checking against Comparable 2016-05-05 17:29:09 +03:00
Alexey Tsvetkov
09c5214181 JS/RTTI. Fix RegExpMatch 2016-05-05 17:29:09 +03:00
Alexey Tsvetkov
c243a99947 JS/RTTI: removed Kotlin.orNull(Kotlin.isAny) optimization 2016-05-05 17:29:08 +03:00
Alexey Tsvetkov
88ab4724e4 JS/RTTI: added another cast to reified test 2016-05-05 17:29:07 +03:00
Alexey Tsvetkov
e975106995 JS/RTTI: Added cast to Array test 2016-05-05 17:29:05 +03:00
Alexey Tsvetkov
f44891c367 JS/RTTI: simplify cast to Any test 2016-05-05 17:29:04 +03:00
Alexey Tsvetkov
e940963dd2 JS/RTTI: fixed cast to generic type parameter with upper bound different than Any 2016-05-05 17:29:03 +03:00
Alexey Tsvetkov
eed4b1f2df JS/RTTI: (minor) fixed typo 2016-05-05 17:29:03 +03:00
Alexey Tsvetkov
b8179d9548 JS/RTTI: (minor) escape code fragments in comments 2016-05-05 17:29:02 +03:00
Alexey Tsvetkov
a7b06aabaf JS/RTTI: fix nullability check 2016-05-05 17:29:01 +03:00
Alexey Tsvetkov
0677294afa JS/RTTI: use Array.isArray to check array instance 2016-05-05 17:29:01 +03:00
Alexey Tsvetkov
aaf18f7b7c JS/RTTI: use typeof f === 'function' to check function instance 2016-05-05 17:29:00 +03:00
Alexey Tsvetkov
42baad25fd JS/RTTI: cast to generic type parameter as to Any 2016-05-05 17:28:59 +03:00
Alexey Tsvetkov
2122a30d41 JS/RTTI: fix cast to Any 2016-05-05 17:28:58 +03:00
Alexey Tsvetkov
ad6638da29 JS/RTTI: support safe casts 2016-05-05 17:28:58 +03:00
Alexey Tsvetkov
2aad39e41c JS/RTTI: support unsafe casts
#KT-2670 fixed
2016-05-05 17:28:57 +03:00
Alexey Tsvetkov
5af22ecd3b JS/RTTI: made cast test generated 2016-05-05 17:28:56 +03:00
Alexey Tsvetkov
d7625532be JS/RTTI: test that reified is-check works when inline turned off 2016-05-05 17:28:56 +03:00
Alexey Tsvetkov
73e53d8cf0 JS/RTTI: fixed double testing for null for reified 2016-05-05 17:28:55 +03:00
Alexey Tsvetkov
56191cf988 JS/RTTI: avoid possible side-effect for is-check on nullable type
#KT-7038 fixed
2016-05-05 17:28:54 +03:00
Alexey Tsvetkov
fff9783879 JS/RTTI: use generation for rtti test 2016-05-05 17:28:53 +03:00
Alexey Tsvetkov
e06eb6976e JS/RTTI: fixed is-check on nullable reified parameters
#KT-7016 fixed
    #KT-8012 fixed
2016-05-05 17:28:53 +03:00
Alexander Udalov
e8a89c1060 Revert "Minor, move SpecialNames.isSafeIdentifier check a little earlier"
This reverts commit 6858ec13de.

It turns out, this re-introduces an AssertionError at ClassId.<init> ("Class
name must not be root") when LazyJavaPackageScope#getContributedClassifier is
called during SAM constructor resolution below in
LazyJavaPackageScope#computeNonDeclaredFunctions, which was overlooked at the
time the commit was pushed
2016-05-04 17:45:18 +03:00
Mikhael Bogdanov
780fef14bf 'bytecodeText' test for synthetic accessor generic signature converted to 'writeSignature' test
(cherry picked from commit cd6b709)
2016-05-04 17:19:22 +03:00
Mikhael Bogdanov
a9bcde41d1 Fix for KT-12127: Undeclared type variable on delegated property backing field
#KT-12127 Fixed
(cherry picked from commit ee7bbbf)
2016-05-04 17:19:20 +03:00
Mikhael Bogdanov
f54ce18402 Update android test dependency to android 4.4.2 cause of missed test result problem on 4.1.2
(cherry picked from commit 09509b6)
2016-05-03 09:20:14 +03:00
Michael Bogdanov
d3baf847bf Support test with self imports, kotlin multifile tests
(cherry picked from commit e2ae2f3)
2016-05-03 09:20:12 +03:00
Michael Bogdanov
1f24f8ef75 Fix for "adb: Syntax error: ")" unexpected"
(cherry picked from commit 0f110b0)
2016-05-03 09:20:03 +03:00
Michael Bogdanov
3fbee04549 Ability to run tests via adb
(cherry picked from commit adda3ef)
2016-05-03 09:20:01 +03:00
Michael Bogdanov
5203f0f852 Android tests exclusion
(cherry picked from commit d4a7e36)
2016-05-03 09:20:00 +03:00
Michael Bogdanov
99d3ae396d Switch to gradle from gradle wrapper, use https instead of http to download files
(cherry picked from commit 896429a)
2016-05-03 09:19:58 +03:00
Michael Bogdanov
a62fac14a9 Code clean
(cherry picked from commit 309348c)
2016-05-03 09:19:56 +03:00
Michael Bogdanov
5fb178426c Wait some time before emulator stop, diabled emulator log redirection (otherise result reports would be inconsistent)
~emulator
(cherry picked from commit 7d77f91)
2016-05-03 09:19:54 +03:00
Michael Bogdanov
3093d958b3 More logging on adb server start
(cherry picked from commit be1cb40)
2016-05-03 09:19:52 +03:00
Michael Bogdanov
a3f7e0c769 Support WITH_REFLECT and 'Class.forName' android tests
(cherry picked from commit db6c72d)
2016-05-03 09:19:49 +03:00
Michael Bogdanov
f3b9ba2f06 Wait until emulator booted
(cherry picked from commit ed3d874)
2016-05-03 09:19:33 +03:00
Michael Bogdanov
e15b36e141 Use gradle build instead of ant one for android test module
(cherry picked from commit 2992e23)
2016-05-03 09:19:31 +03:00
Michael Bogdanov
efb6bbde69 Ecluded test from compilation: android report bad class file cause of missed generic parameter definition
(cherry picked from commit 3ad8b5b)
2016-05-03 09:19:29 +03:00
Michael Bogdanov
65ddf8a2c9 Temporary disable lint checks cause of problem with implicit 'stream' import
(cherry picked from commit 0abdc75)
2016-05-03 09:19:27 +03:00
Michael Bogdanov
eab688f5c1 Added support for tests with 'JvmName' annotation
(cherry picked from commit 3cebb7c)
2016-05-03 09:19:25 +03:00
Michael Bogdanov
bf77b1dc40 Call 'invokeBox' with proper class instance (not try to find it via reflection)
(cherry picked from commit 11e42c6)
2016-05-03 09:19:24 +03:00
Michael Bogdanov
7d7aa9ff05 Added gradle android test project
(cherry picked from commit 1eb3d2e)
2016-05-03 09:19:22 +03:00
Michael Bogdanov
21a21c55b7 Writing android sdk to local.properties
(cherry picked from commit 1f84ff7)
2016-05-03 09:19:20 +03:00
Ilya Gorbunov
5f4d716f5e Handle special cases of drop, take, takeLast when it is known in advance that the result is a single-item list. #KT-9990
(cherry picked from commit 249d08a66e)
2016-04-30 05:33:21 +03:00
Ilya Gorbunov
64f7009480 Change evaluation test data not to encounter special implementation of single element list.
(cherry picked from commit d70b46fd37)
2016-04-30 05:33:16 +03:00
Ilya Gorbunov
2a7814b2bb Optimize operations to return special collection implementations when result is empty or has single element.
#KT-9990

(cherry picked from commit a665b2183c)
2016-04-30 05:33:09 +03:00
Ilya Gorbunov
40e901f46e Remove runtime specialization in inline last and lastOrNull to prevent double inlining of predicate body.
(cherry picked from commit 2d12ed68c8)
2016-04-30 05:33:03 +03:00
Ilya Gorbunov
3b187abbe1 Do not use indexed access for lists not supporting RandomAccess
Add RandomAccess specialization.

(cherry picked from commit 09c1ff1233)
2016-04-30 05:32:57 +03:00
Ilya Gorbunov
3b9dcc11b2 Use list iterators instead of indexed access in operations on lists taking a lambda.
Related to #KT-9607

(cherry picked from commit f4f82656f7)
2016-04-30 05:32:51 +03:00
Nikolay Krasko
3b29421f6f Do not request write action for MoveDeclarationToSeparateFileIntention (EA-81511)
There's nothing but delegation to move refactoring. This started to fail in br146 because of this commit:
334772b7a8
2016-04-29 21:50:35 +03:00
Nikolay Krasko
9c9b64efea Revert another class of ComparisonFailure
Idea throws this class but not org.junit.ComparisonFailure
2016-04-29 21:50:34 +03:00
Nikolay Krasko
51de23f66f Fix path replacement in reference tests
The commit fixes ReferenceResolveInJavaTestGenerated$BinaryAndSource.testFileFacade.
2016-04-29 21:50:33 +03:00
Zalim Bashorov
97c1fedf38 Fix NoSuchMethodError when try to access in test to internal member from production for gradle projects imported into IDEA 16 or higher
#KT-11993 Fixed
(cherry picked from commit ed0fa2c)
2016-04-29 18:27:06 +03:00
Alexander Udalov
6e7388737a Do not locate running build in override.version
A build was finding itself with such request every time which made the version
override pointless
2016-04-29 17:21:06 +03:00
Alexander Udalov
2c77a23943 Update ChangeLog for 1.0.2 2016-04-29 15:44:41 +03:00
Alexander Udalov
6858ec13de Minor, move SpecialNames.isSafeIdentifier check a little earlier 2016-04-29 15:32:31 +03:00
Alexander Udalov
c6194d925c Minor optimization of lookup tracker records 2016-04-29 15:32:29 +03:00
Alexander Udalov
853200aa98 Combine Java package scope and Kotlin scopes in JvmPackageScope
Use it in LazyJavaPackageFragment#scope instead of a weird lazy chained scope.
Also move lookup tracker records to it, to prevent them from being written in
each package scope individually (this was hurting performance)
2016-04-29 15:32:27 +03:00
Alexander Udalov
9f63317900 Optimize class lookups in DeserializedPackageMemberScope
Do not try to load classes (and litter in ClassDeserializer#classes cache with
unsuccessful requests) which the deserialized scope knows nothing about. This
is possible because deserialized scopes have the full list of their class names
2016-04-29 15:32:24 +03:00
Kirill Rakhman
ce84e168d1 Implement Intention to add @JvmOverloads
Fixes #KT-11523
(cherry picked from commit 8e5481b)
2016-04-29 13:39:16 +02:00
Kirill Rakhman
d506346db3 Add quickfix to make referenced primary constructor parameter a property
Fixes #KT-12089
(cherry picked from commit f309920)
2016-04-29 12:16:09 +02:00
Kirill Rakhman
17cfee37b9 Quick fix for SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE
Fixes #KT-11876
(cherry picked from commit 1c5322b)
2016-04-29 11:54:12 +02:00
Mikhail Glukhikh
3cd9bb9f86 IDEA: unnecessary 'val's removed from constructors
(cherry picked from commit 84a3f72)
2016-04-29 09:19:02 +03:00
Mikhail Glukhikh
0ff15c38a3 Core & compiler: unnecessary 'val's removed from constructors
(cherry picked from commit 5a66ef2)
2016-04-29 09:18:51 +03:00
Mikhail Glukhikh
831469f4d9 Android: unnecessary 'val's removed from constructors
(cherry picked from commit ee46c34)
2016-04-29 09:18:42 +03:00
Mikhail Glukhikh
f7b212b449 UAST: unnecessary 'val' removed from constructor
(cherry picked from commit 5c9d6fd)
2016-04-29 09:18:33 +03:00
Mikhail Glukhikh
3d3b061c31 JS: unnecessary 'val' removed from constructor
(cherry picked from commit a4be89e)
2016-04-29 09:10:38 +03:00
Kirill Rakhman
6f874e6dbc Add intrinsic for KCallable.name property Fixes #KT-11531 2016-04-28 23:04:06 +03:00
Ilya Gorbunov
f60cc2a2f7 reified assertFailsWith available in kotlin-test for JS
#KT-11346

(cherry picked from commit 4b533b297e)
2016-04-28 21:11:04 +03:00
Ilya Gorbunov
f9bc1b8c3b Make stdlib functions dependent on reified is checks available in JS.
#KT-11346 Fixed

(cherry picked from commit 409094f0f7)
2016-04-28 21:11:03 +03:00
Ilya Gorbunov
73be96e304 JS: Make AbstractList.size pure abstract.
#KT-7228 Fixed

(cherry picked from commit a5fd95c7d9)
2016-04-28 21:11:02 +03:00
Nikolay Krasko
42ec16c32f Check that injection with annotation on parameter doesn't trigger not-stubbed psi 2016-04-28 16:22:38 +03:00
Nikolay Krasko
247e435752 Don't analyze function body if only parameter analyze is requested 2016-04-28 16:22:38 +03:00
Nikolay Krasko
fd21f5ee80 Missing new line in error message (KT-12070)
#KT-12070 Fixed
2016-04-28 16:22:37 +03:00
Nikolay Krasko
0644a54883 Use partial resolve for annotation search 2016-04-28 16:22:36 +03:00
Nikolay Krasko
6117b822ab Use kotlin specific methods for pattern creation 2016-04-28 16:22:35 +03:00
Nikolay Krasko
6270ed81bf Refactoring: use language injection in ResolveElementCache.kt 2016-04-28 16:22:35 +03:00
Nikolay Krasko
249180f9f0 Refactoring: return injection tests to single test-class 2016-04-28 16:22:34 +03:00
Nikolay Krasko
93f8c711af Enable bootstrapping against 1.0.3 in 1.0.3 branch
This also should enable version auto-increment.
2016-04-28 13:41:14 +03:00
Kirill Rakhman
1f5a861402 Add quickfix to add 'toString' (#866)
Fixes #KT-12121
(cherry picked from commit 2629d23)
2016-04-28 11:31:29 +02:00
Nikolay Krasko
1a2c67cb4b Test data modification: Don't compute compiled bytecode for same expression twice
Result of dc9fa6d9ac commit.
Previously computation were saved into the map that were invalidated by the computation. Now map is recreated after computation and result is saved into it.
2016-04-28 00:14:02 +03:00
Sergey Mashkov
45daf1f42b Maven: rebase to master 2016-04-27 22:10:51 +03:00
Sergey Mashkov
65985b184f Maven: review 2016-04-27 22:10:50 +03:00
Sergey Mashkov
ec113ac691 Maven: convert to Kotlin 2016-04-27 22:10:50 +03:00
Sergey Mashkov
31a57190e0 Maven: reorganize code: move classes across packages 2016-04-27 22:10:49 +03:00
Sergey Mashkov
adad2ef5fe Maven: inspection maven plugin and ide plugin should have the same version 2016-04-27 22:10:49 +03:00
Sergey Mashkov
5e8f91bd2a Maven: versions inspection: kotlin plugin and library should have the same version 2016-04-27 22:10:49 +03:00
Sergey Mashkov
b49693f30f Maven: kotlin-maven-plugin configuration source dirs completion 2016-04-27 22:10:48 +03:00
Sergey Mashkov
5f826b7ff4 KT-11743 Intention to replace kotlin-test with kotlin-test-junit 2016-04-27 22:10:48 +03:00
Sergey Mashkov
c50c111fdf Maven: never generate JUnit (but keep code so we will be able to introduce checkbox in configurator to optionally add junit and chose version) 2016-04-27 22:10:47 +03:00
Sergey Mashkov
b20aa6e5bd KT-11731 Default maven integration doesn't include documentation
trigger sources download for stdlib/runtime/test at project import
2016-04-27 22:10:47 +03:00
Sergey Mashkov
4927d6cce2 Maven: extract maven support to the separate module 2016-04-27 22:10:47 +03:00
Sergey Mashkov
693ea83924 KT-11556 "Kotlin not configured" in Kotlin/JS project 2016-04-27 22:10:46 +03:00
Sergey Mashkov
4ed3befa71 KT-11701 Add Maven Dependency quick fix could be supported in Kotlin sources
~ initial draft
2016-04-27 22:10:46 +03:00
Sergey Mashkov
82b26e009a KT-11436 "Choose Configurator" control opens dialogs with inconsistent modality (linux) 2016-04-27 22:10:45 +03:00
Sergey Mashkov
5814197257 KT-11643 Inspections and intentions to fix misconfigured Maven pom
make misconfigured maven project configurable
2016-04-27 22:10:45 +03:00
Sergey Mashkov
4e4f7438f1 KT-11643 Inspections and intentions to fix misconfigured Maven pom 2016-04-27 22:10:45 +03:00
Sergey Mashkov
faf758ffdd KT-9492 Configuring multiple Maven Modules
- kotlin mavne configurator shouldn't configure child modules but parents as children inherit everything
2016-04-27 22:10:44 +03:00
Sergey Mashkov
cd5c533351 KT-11642 Kotlin Maven configurator tags order 2016-04-27 22:10:44 +03:00
Mikhail Glukhikh
1ad77837cf Correct handling of empty super type list while adding an entry #KT-12011 Fixed
(cherry picked from commit 918f843)
2016-04-27 18:48:49 +03:00
Mikhail Glukhikh
82c331d03d Can be parameter inspection: use inside object literals is now handled as "property use"
(cherry picked from commit 1744897)
2016-04-27 18:48:34 +03:00
Mikhail Glukhikh
97330a72cd Can be parameter inspection: use in selector position is now always handled as "property use"
(cherry picked from commit 64ae9af)
2016-04-27 18:48:23 +03:00
Mikhail Glukhikh
c04153910f Can be parameter inspection: use inside function literals is now handled as "property use" #KT-11949 Fixed
(cherry picked from commit 795b924)
2016-04-27 18:48:11 +03:00
Alexey Sedunov
6ae2d28cf5 Change Signature: Do not use local declaration as a context for a type code fragment
(cherry picked from commit e6ab2f1)
2016-04-27 18:27:45 +03:00
Mikhail Glukhikh
e104817ed1 Regular checkType() is now called during condition analysis, TYPE_MISMATCH_IN_CONDITION removed #KT-11998 Fixed
(cherry picked from commit 6b945ba)
2016-04-27 18:20:31 +03:00
Alexander Udalov
e402b82f00 Consider non-running as well as running builds in version override 2016-04-27 14:13:44 +03:00
Alexander Udalov
88ad4bb956 Perform version override earlier and only on teamcity 2016-04-27 10:56:06 +03:00
Mikhail Zarechenskiy
e9b1476112 Move part of code that related to 'Optimize imports' action to ide-common module 2016-04-26 21:34:20 +03:00
Mikhail Zarechenskiy
4ea9332892 Get rid of guava's collections and dependency on Idea's settings from util function
This commit prepares 'prepareOptimizedImports' function to
move to the ide-common module to reuse it in the Eclipse plugin
2016-04-26 21:34:12 +03:00
Nikolay Krasko
a19fc430cd Do no analyze for annotation search if no annotation entries present 2016-04-26 20:46:53 +03:00
Nikolay Krasko
c914583a7a Add note about fixing deadlock in debugger (KT-12067) 2016-04-26 20:46:52 +03:00
Nikolay Krasko
fcfa0b0297 Enable injection in injection tests 2016-04-26 20:46:51 +03:00
Nikolay Krasko
9fde765e22 Make parameter injection work for Java methods 2016-04-26 20:46:51 +03:00
Nikolay Krasko
437e5e98cc First version of injection with annotation on parameter 2016-04-26 20:46:50 +03:00
Nikolay Krasko
2aeea4ef0e Implement withAnnotation() pattern for parameter pattern 2016-04-26 20:46:49 +03:00
Nikolay Krasko
d0304a251e Refactoring replace trimMargin() with trimIndent(). This is preparation for injection bootstrapping in tests. 2016-04-26 20:46:48 +03:00
Nikolay Krasko
7d2698473d Add write action for shorten references in finish template after building call (KT-12056)
Write action was removed in idea 146

#KT-12056 Fixed
2016-04-26 20:46:47 +03:00
Nikolay Krasko
51ab247bc5 Add write action for shortening references in templates (KT-11418)
Write action was removed in idea 146.

#KT-11418 Fixed
2016-04-26 20:46:46 +03:00
Nikolay Krasko
ff83391e97 Revert write actions in utility code (EA-81892)
Revert commits:
ab0fe0a900
97a97614b5
2016-04-26 20:46:46 +03:00
Nikolay Krasko
3c97ae4c5c Auto-test running intention isApplicable() from pooled thread 2016-04-26 20:46:45 +03:00
Alexey Sedunov
917a8f09db Change Signature: Fix context element for type code fragments to avoid bogus "Type can not be resolved" warnings
#KT-11862 Fixed
(cherry picked from commit 9858b17)
2016-04-26 20:17:20 +03:00
Zalim Bashorov
a523fd3742 Minor: fix tests
(cherry picked from commit 3048c29)
2016-04-26 19:13:28 +03:00
Alexey Andreev
fe2b7d6060 KT-11100 Fix generation of name of FakeCallableDescriptorForObject that is presumably used to express invoke operator on (companion) objects 2016-04-26 17:08:09 +03:00
Kirill
ce5e02bd20 Format spaces in infix call (KT-12018)
#KT-12018 Fixed
2016-04-26 15:44:23 +03:00
Kirill
212bb21e7c Format spaces in cast expression (KT-12035)
#KT-12035 Fixed
2016-04-26 15:44:14 +03:00
Alexey Sedunov
ea22c0f891 Move: Optimize imports after applying "Move declaration to separate file" intention
#KT-10174 Fixed
(cherry picked from commit a00c524)
2016-04-26 14:08:50 +03:00
Alexey Sedunov
a0e2193383 Move: Keep original file package name when moving top-level declarations to separate file (provided it's not ambiguous)
#KT-10950 Fixed
(cherry picked from commit 676000c)
2016-04-26 14:08:42 +03:00
Alexey Sedunov
711ae62ed2 Move: Allow choosing source root in "Move file to directory" intention
#KT-11512 Fixed
(cherry picked from commit 332fe29)
2016-04-26 14:08:34 +03:00
Alexey Sedunov
f5df3b7d7e Move: Convert implicit receiver to this when moving class member to companion object
#KT-11483 Fixed
(cherry picked from commit aaa873f)
2016-04-26 14:08:21 +03:00
Alexey Sedunov
77a0fb4e01 Move: Add missing write action
#KT-11482 Fixed
(cherry picked from commit 6faedc1)
2016-04-26 14:08:11 +03:00
Denis Zharkov
cd8305b07a Use different version numbers for 1.0.3 2016-04-25 18:57:01 +03:00
Zalim Bashorov
cfaa68317a Add Unit to compiled part of Kotlin JS stdlib and don't show "Kotlin not configured" for Kotlin JS projects
#KT-11556 Fixed

(cherry picked from commit 658eac2)
2016-04-25 18:04:38 +03:00
5327 changed files with 95230 additions and 31611 deletions

View File

@@ -1,27 +0,0 @@
<component name="ArtifactManager">
<artifact name="KotlinBarePlugin">
<output-path>$PROJECT_DIR$/out/artifacts/BareKotlin</output-path>
<properties id="ant-postprocessing">
<options enabled="true">
<file>file://$PROJECT_DIR$/idea-runner/runner.xml</file>
<target>copy-runtime-for-idea-plugin</target>
</options>
</properties>
<root id="root">
<element id="directory" name="kotlinc">
<element id="dir-copy" path="$PROJECT_DIR$/dist/kotlinc" />
</element>
<element id="directory" name="lib">
<element id="archive" name="kotlin-bare-plugin.jar">
<element id="module-output" name="bare-plugin" />
<element id="module-output" name="descriptor.loader.java" />
<element id="module-output" name="frontend.java" />
<element id="module-output" name="descriptors" />
</element>
<element id="directory" name="jps">
<element id="artifact" artifact-name="KotlinJpsPlugin" />
</element>
</element>
</root>
</artifact>
</component>

View File

@@ -38,6 +38,7 @@
<element id="module-output" name="ide-common" />
<element id="file-copy" path="$PROJECT_DIR$/resources/kotlinManifest.properties" />
<element id="module-output" name="idea-android" />
<element id="module-output" name="idea-android-output-parser" />
<element id="module-output" name="js.serializer" />
<element id="module-output" name="serialization" />
<element id="module-output" name="idea-completion" />
@@ -47,8 +48,11 @@
<element id="module-output" name="idea-repl" />
<element id="module-output" name="idea-live-templates" />
<element id="module-output" name="resolution" />
<element id="module-output" name="plugin-api" />
<element id="module-output" name="idea-ultimate" />
<element id="module-output" name="formatter" />
<element id="module-output" name="idea-maven" />
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/protobuf-2.6.1.jar" path-in-jar="/" />
</element>
<element id="library" level="project" name="javax.inject" />
<element id="directory" name="jps">

8
.idea/dictionaries/Alexey_Sedunov.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<component name="ProjectDictionaryState">
<dictionary name="Alexey.Sedunov">
<words>
<w>inplace</w>
<w>renamer</w>
</words>
</dictionary>
</component>

View File

@@ -16,6 +16,7 @@
<w>preloading</w>
<w>preprocess</w>
<w>redeclarations</w>
<w>smap</w>
<w>subclassed</w>
<w>subgraph</w>
<w>substep</w>

5
.idea/kotlinc.xml generated
View File

@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JsCompilerArguments">
<option name="moduleKind" value="plain" />
</component>
<component name="KotlinCompilerSettings">
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check" />
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check -language-version 1.0" />
</component>
</project>

View File

@@ -6,6 +6,7 @@
<CLASSES>
<root url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib" />
<root url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib/jps" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/android-common.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>

View File

@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="java-decompiler-plugin">
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/java-decompiler/lib/java-decompiler.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -8,7 +8,6 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/protobuf-java-2.5.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/antLayout/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/jps/jps-builders/src" />
@@ -24,4 +23,4 @@
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/jps" recursive="false" />
</library>
</component>
</component>

View File

@@ -4,11 +4,11 @@
<root url="file://$PROJECT_DIR$/annotations" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/protobuf-2.5.0.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/protobuf-2.6.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/protobuf-java-2.5.0-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/protobuf-2.6.1-sources.jar!/" />
</SOURCES>
</library>
</component>

2
.idea/misc.xml generated
View File

@@ -49,7 +49,7 @@
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SuppressABINotification">

5
.idea/modules.xml generated
View File

@@ -10,10 +10,10 @@
<module fileurl="file://$PROJECT_DIR$/android-studio/android-studio.iml" filepath="$PROJECT_DIR$/android-studio/android-studio.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/compiler/android-tests/android-tests.iml" filepath="$PROJECT_DIR$/compiler/android-tests/android-tests.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/plugins/annotation-collector/annotation-collector.iml" filepath="$PROJECT_DIR$/plugins/annotation-collector/annotation-collector.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/annotation-processing/annotation-processing.iml" filepath="$PROJECT_DIR$/plugins/annotation-processing/annotation-processing.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/ant/ant.iml" filepath="$PROJECT_DIR$/ant/ant.iml" />
<module fileurl="file://$PROJECT_DIR$/compiler/backend/backend.iml" filepath="$PROJECT_DIR$/compiler/backend/backend.iml" group="compiler/java" />
<module fileurl="file://$PROJECT_DIR$/compiler/backend-common/backend-common.iml" filepath="$PROJECT_DIR$/compiler/backend-common/backend-common.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" group="ide/jps" />
<module fileurl="file://$PROJECT_DIR$/build-common/build-common.iml" filepath="$PROJECT_DIR$/build-common/build-common.iml" />
<module fileurl="file://$PROJECT_DIR$/core/builtins/builtins.iml" filepath="$PROJECT_DIR$/core/builtins/builtins.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" filepath="$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" group="compiler/cli" />
@@ -41,15 +41,18 @@
<module fileurl="file://$PROJECT_DIR$/idea/idea.iml" filepath="$PROJECT_DIR$/idea/idea.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-analysis/idea-analysis.iml" filepath="$PROJECT_DIR$/idea/idea-analysis/idea-analysis.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-android/idea-android.iml" filepath="$PROJECT_DIR$/idea/idea-android/idea-android.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-android/idea-android-output-parser/idea-android-output-parser.iml" filepath="$PROJECT_DIR$/idea/idea-android/idea-android-output-parser/idea-android-output-parser.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-completion/idea-completion.iml" filepath="$PROJECT_DIR$/idea/idea-completion/idea-completion.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-core/idea-core.iml" filepath="$PROJECT_DIR$/idea/idea-core/idea-core.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" filepath="$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-live-templates/idea-live-templates.iml" filepath="$PROJECT_DIR$/idea/idea-live-templates/idea-live-templates.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-maven/idea-maven.iml" filepath="$PROJECT_DIR$/idea/idea-maven/idea-maven.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" filepath="$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea-runner/idea-runner.iml" filepath="$PROJECT_DIR$/idea-runner/idea-runner.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" filepath="$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/compiler/preloader/instrumentation/instrumentation.iml" filepath="$PROJECT_DIR$/compiler/preloader/instrumentation/instrumentation.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/j2k/j2k.iml" filepath="$PROJECT_DIR$/j2k/j2k.iml" group="j2k" />
<module fileurl="file://$PROJECT_DIR$/plugins/java-model-wrappers/java-model-wrappers.iml" filepath="$PROJECT_DIR$/plugins/java-model-wrappers/java-model-wrappers.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-plugin.iml" group="ide/jps" />
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-tests/jps-tests.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-tests/jps-tests.iml" group="ide/jps" />
<module fileurl="file://$PROJECT_DIR$/js/js.dart-ast/js.dart-ast.iml" filepath="$PROJECT_DIR$/js/js.dart-ast/js.dart-ast.iml" group="compiler/js" />

View File

@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx900m -XX:MaxPermSize=320m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx900m -XX:MaxPermSize=320m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1300m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1100m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -8,7 +8,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=64m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin" />
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=64m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -3,12 +3,12 @@
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="android-tests" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="1.8" />
<option name="ALTERNATIVE_JRE_PATH" value="1.6" />
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin.android.tests" />
<option name="MAIN_CLASS_NAME" value="org.jetbrains.kotlin.android.tests.AndroidRunner" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx850m -XX:+UseCodeCacheFlushing" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx850m -XX:+UseCodeCacheFlushing -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx900m -XX:MaxPermSize=320m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx700m -XX:MaxPermSize=300m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -8,7 +8,7 @@
<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="VM_PARAMETERS" value="-ea -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="pattern" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx700m" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx700m -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=64m -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -8,7 +8,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -8,7 +8,7 @@
<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="VM_PARAMETERS" value="-ea -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

View File

@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="pattern" />
<option name="VM_PARAMETERS" value="-ea -Xmx850m" />
<option name="VM_PARAMETERS" value="-ea -Xmx850m -Djna.nosys=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />

2
.idea/scopes/IDE.xml generated
View File

@@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="IDE" pattern="file[idea]:src/*/||file[idea]:testData/*/||file[ide-common]:src/*/||file[idea-analysis]:src/*/||file[idea-android]:src/*/||file[idea-completion]:src/*/||file[idea-completion]:testData/*/||file[idea-core]:src/*/||file[idea-jps-common]:/*/||file[idea-live-templates]:/*/||file[idea-live-templates]:testData/*/||file[idea-repl]:/*/" />
<scope name="IDE" pattern="file[idea]:src/*/||file[idea]:testData/*/||file[ide-common]:src/*/||file[idea-analysis]:src/*/||file[idea-android]:src/*/||file[idea-completion]:src/*/||file[idea-completion]:testData/*/||file[idea-core]:src/*/||file[idea-jps-common]:/*/||file[idea-live-templates]:/*/||file[idea-live-templates]:testData/*/||file[idea-repl]:/*/||src[idea-android-output-parser]:*..*" />
</component>

View File

@@ -1,47 +1,791 @@
# CHANGELOG
<!-- Find: ([^\[/])(KT-\d+) -->
<!-- Replace: $1[$2](https://youtrack.jetbrains.com/issue/$2) -->
<!-- Find: ([^\`/\[])(KT-\d+) -->
<!-- Replace: $1[`$2`](https://youtrack.jetbrains.com/issue/$2) -->
## 1.1
## 1.0.4
### Compiler
#### Analysis & diagnostics
- [`KT-10968`](https://youtrack.jetbrains.com/issue/KT-10968), [`KT-11075`](https://youtrack.jetbrains.com/issue/KT-11075), [`KT-12286`](https://youtrack.jetbrains.com/issue/KT-12286) Type inference of callable references
- [`KT-11892`](https://youtrack.jetbrains.com/issue/KT-11892) Report error on qualified super call to a supertype extended by a different supertype
- [`KT-12875`](https://youtrack.jetbrains.com/issue/KT-12875) Report error on incorrect call of member extension invoke
- [`KT-12847`](https://youtrack.jetbrains.com/issue/KT-12847) Report error on accessing protected property setter from super class' companion
- [`KT-12322`](https://youtrack.jetbrains.com/issue/KT-12322) Overload resolution ambiguity with constructor reference when class has a companion object
- [`KT-11440`](https://youtrack.jetbrains.com/issue/KT-11440) Overload resolution ambiguity on specialized Map.put implementation from Java
- [`KT-11389`](https://youtrack.jetbrains.com/issue/KT-11389) Runtime exception when calling Java primitive overloadings
- [`KT-8200`](https://youtrack.jetbrains.com/issue/KT-8200) Exception when using non-generic interface with generic arguments
- [`KT-10237`](https://youtrack.jetbrains.com/issue/KT-10237) Exception on an unresolved symbol in a type parameter bound in the 'where' clause
- [`KT-11821`](https://youtrack.jetbrains.com/issue/KT-11821) Exception on incorrect number of generic arguments in a type parameter bound in the 'where' clause
- [`KT-12482`](https://youtrack.jetbrains.com/issue/KT-12482) Exception: Implementation doesn't have the most specific type, but none of the other overridden methods does either
- [`KT-12687`](https://youtrack.jetbrains.com/issue/KT-12687) Exception when 'data' modifier is applied to object
- [`KT-9620`](https://youtrack.jetbrains.com/issue/KT-9620) AssertionError in DescriptorResolver#checkBounds
- [`KT-3689`](https://youtrack.jetbrains.com/issue/KT-3689) IllegalAccess on a property with private setter of the subclass
- [`KT-6391`](https://youtrack.jetbrains.com/issue/KT-6391) Wrong warning for array casting (Array<Any?> to Array<Any>)
- [`KT-8596`](https://youtrack.jetbrains.com/issue/KT-8596) Exception when analyzing nested class constructor reference in an argument position
- [`KT-12982`](https://youtrack.jetbrains.com/issue/KT-12982) Incorrect type inference when accessing mutable protected property via reflection
- [`KT-13206`](https://youtrack.jetbrains.com/issue/KT-13206) Report "Cast never succeeds" if and only if ClassCastException can be predicted
- [`KT-12467`](https://youtrack.jetbrains.com/issue/KT-12467) IllegalStateException: Concrete fake override should have exactly one concrete super-declaration: []
- [`KT-13340`](https://youtrack.jetbrains.com/issue/KT-13340) Report "return is not allowed here" only on the return keyword, not the whole expression
- [`KT-2349`](https://youtrack.jetbrains.com/issue/KT-2349), [`KT-6054`](https://youtrack.jetbrains.com/issue/KT-6054) Report "uninitialized enum entry" if enum entry is referenced before its declaration
- [`KT-12809`](https://youtrack.jetbrains.com/issue/KT-12809) Report "uninitialized variable" if property is referenced before its declaration
- [`KT-260`](https://youtrack.jetbrains.com/issue/KT-260) Do not report "cast never succeeds" when casting nullable to nullable
- [`KT-11769`](https://youtrack.jetbrains.com/issue/KT-11769) Prohibit access from enum instance initialization code to members of enum's companion object
- [`KT-13371`](https://youtrack.jetbrains.com/issue/KT-13371) Fix CompilationException: Rewrite at slice LEAKING_THIS key: REFERENCE_EXPRESSION
- [`KT-13401`](https://youtrack.jetbrains.com/issue/KT-13401) Fix StackOverflowError when checking variance
- [`KT-13330`](https://youtrack.jetbrains.com/issue/KT-13330), [`KT-13349`](https://youtrack.jetbrains.com/issue/KT-13349) Fix AssertionError: Illegal resolved call to variable with invoke
- [`KT-13421`](https://youtrack.jetbrains.com/issue/KT-13421) Fix AssertionError: Only integer constants should be checked for overflow
- [`KT-13555`](https://youtrack.jetbrains.com/issue/KT-13555) Fix internal error "resolveToInstruction"
- [`KT-8989`](https://youtrack.jetbrains.com/issue/KT-8989) Change error messages: Replace "invisible_fake" with "invisible (private in a supertype)"
- [`KT-13612`](https://youtrack.jetbrains.com/issue/KT-13612) Val reassignment in try / catch
- [`KT-5469`](https://youtrack.jetbrains.com/issue/KT-5469) Incorrect "is never used" warning for value used in catch block
- [`KT-13510`](https://youtrack.jetbrains.com/issue/KT-13510) Missing "Nested class not allowed" error for anonymous object inside val initializer
- [`KT-13685`](https://youtrack.jetbrains.com/issue/KT-13685) Fix NPE when resolving callable references on incomplete code
- Change error messages: Fix quotes around keywords in diagnostic messages
- Change error messages: Remove quotes around visibilities
#### Parser
- [`KT-7118`](https://youtrack.jetbrains.com/issue/KT-7118) Improve error message after trailing dot in floating point literal
- [`KT-4948`](https://youtrack.jetbrains.com/issue/KT-4948) Recover by following keyword
- [`KT-7915`](https://youtrack.jetbrains.com/issue/KT-7915) Recover after val with no subsequent name
- [`KT-12987`](https://youtrack.jetbrains.com/issue/KT-12987) Recover after val with no name before declaration starting with soft keyword
#### JVM code generation
- [`KT-12909`](https://youtrack.jetbrains.com/issue/KT-12909) Do not generate redundant bridge for special built-in override
- [`KT-11915`](https://youtrack.jetbrains.com/issue/KT-11915) Exception in entrySet when Map implementation in Kotlin extends another one
- [`KT-12755`](https://youtrack.jetbrains.com/issue/KT-12755) Exception on property generation in multi-file classes
- [`KT-12983`](https://youtrack.jetbrains.com/issue/KT-12983) VerifyError: Bad type on operand stack in arraylength
- [`KT-12908`](https://youtrack.jetbrains.com/issue/KT-12908) Variable initialization in loop causes VerifyError: Bad local variable type
- [`KT-13040`](https://youtrack.jetbrains.com/issue/KT-13040) Invalid bytecode generated for extension lambda invocation with safe call
- [`KT-13023`](https://youtrack.jetbrains.com/issue/KT-13023) Char operations throw ClassCastException for boxed Chars
- [`KT-11634`](https://youtrack.jetbrains.com/issue/KT-11634) Exception for super call in delegation
- [`KT-12359`](https://youtrack.jetbrains.com/issue/KT-12359) Redundant stubs are generated on inheriting from java.util.Collection
- [`KT-11833`](https://youtrack.jetbrains.com/issue/KT-11833) Error generating constructors of class on anonymous object inheriting from nested class of super class
- [`KT-13133`](https://youtrack.jetbrains.com/issue/KT-13133) Incorrect InnerClasses attribute value for anonymous object copied from an inline function
- [`KT-13241`](https://youtrack.jetbrains.com/issue/KT-13241) Indices optimization leads to VerifyError with smart cast receiver
- [`KT-13374`](https://youtrack.jetbrains.com/issue/KT-13374) Fix compiler exception when inline function contains anonymous object implementing an interface by delegation
##### Generated code performance
- [`KT-11964`](https://youtrack.jetbrains.com/issue/KT-11964) No TABLESWITCH in when on enum bytecode if enum constant is imported
- [`KT-6916`](https://youtrack.jetbrains.com/issue/KT-6916) Optimize 'for' over 'downTo'
- [`KT-12733`](https://youtrack.jetbrains.com/issue/KT-12733) Optimize 'for' over 'rangeTo' as a non-qualified call
### Standard Library
- [`KT-13115`](https://youtrack.jetbrains.com/issue/KT-13115), [`KT-13297`](https://youtrack.jetbrains.com/issue/KT-13297) Improve documentation formatting, clarify documentation for `FileTreeWalk`, `Sequence` and `generateSequence`.
- [`KT-12894`](https://youtrack.jetbrains.com/issue/KT-12894) Do not fail in `Closeable.use` if the resource is `null`.
### Reflection
- [`KT-12915`](https://youtrack.jetbrains.com/issue/KT-12915) Runtime exception on callBy of JvmStatic function with default arguments
- [`KT-12967`](https://youtrack.jetbrains.com/issue/KT-12967) Runtime exception on reference to generic property
- [`KT-13370`](https://youtrack.jetbrains.com/issue/KT-13370) NullPointerException on companionObjectInstance of a built-in class
- [`KT-13462`](https://youtrack.jetbrains.com/issue/KT-13462) Make KClass for primitive type equal to the corresponding KClass for wrapper type
### IDE
- [`KT-12655`](https://youtrack.jetbrains.com/issue/KT-12655) New Kotlin file: extra error message for already existing file
- [`KT-12760`](https://youtrack.jetbrains.com/issue/KT-12760) Prohibit running non-Unit returning main function
- [`KT-12893`](https://youtrack.jetbrains.com/issue/KT-12893) Impossible to open Kotlin compiler settings
- [`KT-10433`](https://youtrack.jetbrains.com/issue/KT-10433) Copy-pasting reference to companion object member causes import dialog
- [`KT-12803`](https://youtrack.jetbrains.com/issue/KT-12803) Class is marked as unused when it is only used is in method reference
- [`KT-13084`](https://youtrack.jetbrains.com/issue/KT-13084) Run test method action executes all tests from same kotlin file
- [`KT-12718`](https://youtrack.jetbrains.com/issue/KT-12718) Deadlock due to index reentering
- [`KT-13114`](https://youtrack.jetbrains.com/issue/KT-13114) 'Unused declaration' option 'JUnit static methods' is always enabled
- [`KT-12997`](https://youtrack.jetbrains.com/issue/KT-12997) Override/Implement Members: Support "Copy JavaDoc" options for library classes
- [`KT-12887`](https://youtrack.jetbrains.com/issue/KT-12887) "Extend selection" should select call's invoked expression
- [`KT-13383`](https://youtrack.jetbrains.com/issue/KT-13383), [`KT-13379`](https://youtrack.jetbrains.com/issue/KT-13379) Override/Implement Members: Do not make return type non-nullable if base return type is explicitly nullable
- [`KT-13218`](https://youtrack.jetbrains.com/issue/KT-13218) Extract Function: Fix AssertionError on callable references
- [`KT-6520`](https://youtrack.jetbrains.com/issue/KT-6520) Introduce 'maino' and 'psvmo' templates for generating main in object
- [`KT-13455`](https://youtrack.jetbrains.com/issue/KT-13455) Override/Implement: Make return type non-nullable (platform collection case) when overriding Java method
- [`KT-10209`](https://youtrack.jetbrains.com/issue/KT-10209) Find Usages: Do not duplicate containing declaration in super member warning dialog
- [`KT-12977`](https://youtrack.jetbrains.com/issue/KT-12977) Hybrid dependency causes "outdated binary" warning to appear in non-js project
- [`KT-13057`](https://youtrack.jetbrains.com/issue/KT-13057) Go to inheritors on Enum should navigate to all enum classes
- Fix exception when choose Gradle configurer after project is synced
- Allow configuring Kotlin in Gradle module without Kotlin sources
- Show all Kotlin annotations when browsing hierarchy of "java.lang.Annotation"
#### Completion
- [`KT-12793`](https://youtrack.jetbrains.com/issue/KT-12793) Suggest abstract protected extension methods
#### Performance
- [`KT-12645`](https://youtrack.jetbrains.com/issue/KT-12645) Lazily calculate FQ name for local classes
- [`KT-13071`](https://youtrack.jetbrains.com/issue/KT-13071) Fix severe freezes because of long lint checks on large files
#### Highlighting
- [`KT-12937`](https://youtrack.jetbrains.com/issue/KT-12937) Java synthetic accessors highlighting does not differ from local variables
#### KDoc
- [`KT-12998`](https://youtrack.jetbrains.com/issue/KT-12998) Backslash is not rendered
- [`KT-12999`](https://youtrack.jetbrains.com/issue/KT-12999) Backtick inside inline code block is not rendered
- [`KT-13000`](https://youtrack.jetbrains.com/issue/KT-13000) Exclamation mark is not rendered
- [`KT-10398`](https://youtrack.jetbrains.com/issue/KT-10398) Fully qualified link is not resolved in editor
- [`KT-12932`](https://youtrack.jetbrains.com/issue/KT-12932) Link to library element is not clickable
- [`KT-10654`](https://youtrack.jetbrains.com/issue/KT-10654) Quick Doc can't follow KDoc link in referenced function description
- [`KT-9271`](https://youtrack.jetbrains.com/issue/KT-9271) Show Quick Doc for implicit lambda parameter 'it'
#### Formatter
- [`KT-12830`](https://youtrack.jetbrains.com/issue/KT-12830) Remove spaces before *?* in nullable types
- [`KT-13314`](https://youtrack.jetbrains.com/issue/KT-13314) Format spaces around !is and !in
#### Intention actions, inspections and quickfixes
##### New features
- [`KT-12152`](https://youtrack.jetbrains.com/issue/KT-12152) "Leaking this" inspection reports dangerous operations inside constructors including:
* Accessing non-final property in constructor
* Calling non-final function in constructor
* Using 'this' as function argument in constructor of non-final class
- [`KT-13187`](https://youtrack.jetbrains.com/issue/KT-13187) "Make constructor parameter a val" should make the val private or public depending on its option
- [`KT-5771`](https://youtrack.jetbrains.com/issue/KT-5771) Mark setter parameter type as redundant and provide quickfix to remove it
- [`KT-9228`](https://youtrack.jetbrains.com/issue/KT-9228) Add quickfix to remove '@' from annotation used as argument of another annotation
- [`KT-12251`](https://youtrack.jetbrains.com/issue/KT-12251) Add quickfix to fix type mismatch for primitive literals
- [`KT-12838`](https://youtrack.jetbrains.com/issue/KT-12838) Add quickfix for "Illegal usage of inline parameter" that adds `noinline`
- [`KT-13134`](https://youtrack.jetbrains.com/issue/KT-13134) Add quickfix for wrong Long suffix (Use `L` instead of `l`)
- [`KT-10903`](https://youtrack.jetbrains.com/issue/KT-10903) Add intention to convert lambda to function reference
- [`KT-7492`](https://youtrack.jetbrains.com/issue/KT-7492) Support "Create abstract function/property" inside an abstract class
- [`KT-10668`](https://youtrack.jetbrains.com/issue/KT-10668) Support "Create member/extension" corresponding to the extension receiver of enclosing function
- [`KT-12553`](https://youtrack.jetbrains.com/issue/KT-12553) Show versions in inspection about different version of Kotlin plugin in Maven and IDE plugin
- [`KT-12489`](https://youtrack.jetbrains.com/issue/KT-12489) Implement intention to replace camel-case test function name with a space-separated one
- [`KT-12730`](https://youtrack.jetbrains.com/issue/KT-12730) Warn about using different versions of Kotlin Gradle plugin and bundled compiler
- [`KT-13173`](https://youtrack.jetbrains.com/issue/KT-13173) Handle more cases in "Add Const Modifier" Intention
- [`KT-12628`](https://youtrack.jetbrains.com/issue/KT-12628) Quickfix for `invoke` operator unsafe calls
- [`KT-11425`](https://youtrack.jetbrains.com/issue/KT-11425) Inspection and quickfix to replace usages of `equals()` and `compareTo()` with operators
- [`KT-13113`](https://youtrack.jetbrains.com/issue/KT-13113) Inspection to detect redundant string templates
- [`KT-13011`](https://youtrack.jetbrains.com/issue/KT-13011) Inspection and quickfix for unnecessary lateinit
- [`KT-10731`](https://youtrack.jetbrains.com/issue/KT-10731) Inspection and quickfix for unnecessary use of toString() inside string interpolation
- [`KT-12043`](https://youtrack.jetbrains.com/issue/KT-12043) Intention to add / remove braces for when entry/entries
- [`KT-13483`](https://youtrack.jetbrains.com/issue/KT-13483) Intention to replace `a..b-1` with `a until b` and vice versa
- [`KT-6975`](https://youtrack.jetbrains.com/issue/KT-6975) Quickfix for adding 'inline' to a function with reified generic
##### Bugfixes
- Show receiver type in the text of "Create extension" quick fix
- Show target class name in the text of "Create member" quick fix
- [`KT-12869`](https://youtrack.jetbrains.com/issue/KT-12869) Usages of overridden Java method through synthetic accessors are not found
- [`KT-12813`](https://youtrack.jetbrains.com/issue/KT-12813) "Find Usages" for property returns function calls
- [`KT-7722`](https://youtrack.jetbrains.com/issue/KT-7722) Approximate unresolvable types in "Create from Usage" quickfixes
- [`KT-11115`](https://youtrack.jetbrains.com/issue/KT-11115) Implement Members: Fix base member detection when abstract and non-abstract members with matching signatures are inherited from an interface
- [`KT-12876`](https://youtrack.jetbrains.com/issue/KT-12876) Bogus suggestion to move property to constructor
- [`KT-13055`](https://youtrack.jetbrains.com/issue/KT-13055) Exception in "Specify Type Explicitly" intention
- [`KT-12942`](https://youtrack.jetbrains.com/issue/KT-12942) "Replace 'when' with 'if'" intention changes semantics when 'if' statements are used
- [`KT-12646`](https://youtrack.jetbrains.com/issue/KT-12646) 'Convert to block body' should use partial body resolve
- [`KT-12919`](https://youtrack.jetbrains.com/issue/KT-12919) Use simple class name in "Change function return type" quickfix
- [`KT-13151`](https://youtrack.jetbrains.com/issue/KT-13151) Incorrect warning "Make variable immutable"
- [`KT-13170`](https://youtrack.jetbrains.com/issue/KT-13170) "Declaration has platform type" inspection: by default should not be reported for platform type arguments
- [`KT-13262`](https://youtrack.jetbrains.com/issue/KT-13262) "Wrap with safe let call" quickfix produces wrong result for qualified function
- [`KT-13364`](https://youtrack.jetbrains.com/issue/KT-13364) Do not suggest creating annotations/enum classes for unresolved type parameter bounds
- [`KT-12627`](https://youtrack.jetbrains.com/issue/KT-12627) Allow warnings suppression for secondary constructor
- [`KT-13365`](https://youtrack.jetbrains.com/issue/KT-13365) Disable "Create property" (non-abstract) in interfaces. Make "Create function" (non-abstract) generate function body in interfaces
- [`KT-8903`](https://youtrack.jetbrains.com/issue/KT-8903) Remove Unused Receiver: update function/property usages
- [`KT-11799`](https://youtrack.jetbrains.com/issue/KT-11799) Create from Usage: Make extension functions/properties 'private' by default
- [`KT-11795`](https://youtrack.jetbrains.com/issue/KT-11795) Create from Usage: Place extension properties after the usage and generate stub getter
- [`KT-12951`](https://youtrack.jetbrains.com/issue/KT-12951) Prohibit "Convert to expression body" when function body is 'if' without 'else' or 'when' is non-exhaustive
- [`KT-13430`](https://youtrack.jetbrains.com/issue/KT-13430) "Add non-null asserted (!!) call" quickfix can't process unary operators
- [`KT-13336`](https://youtrack.jetbrains.com/issue/KT-13336) "Convert concatenation to template" intention appends literal to variable omitting braces
- [`KT-13328`](https://youtrack.jetbrains.com/issue/KT-13328) Do not suggest "Replace infix with safe call" inside conditions or binary / unary expressions
- [`KT-13452`](https://youtrack.jetbrains.com/issue/KT-13452) "Replace if expression with assignment" doesn't work for cascade if-else if-else
- [`KT-13184`](https://youtrack.jetbrains.com/issue/KT-13184) "Different Kotlin Version" inspection: false positive caused by verbose plugin version name
- [`KT-13480`](https://youtrack.jetbrains.com/issue/KT-13480) "Can be replaced with comparison" inspection: false positive if extension method called 'equals' is used
- [`KT-13288`](https://youtrack.jetbrains.com/issue/KT-13288) "Unused property" inspection: false positive when extending abstract class and implementing interface
- [`KT-13432`](https://youtrack.jetbrains.com/issue/KT-13432) "Replace with safe call" quickfix does not work with `compareTo()` usage
- [`KT-13444`](https://youtrack.jetbrains.com/issue/KT-13444) "Invert if" intention changes semantics for nested if with return
- [`KT-13536`](https://youtrack.jetbrains.com/issue/KT-13536) Fix StackOverflowError from "Unused Symbol" inspection after importing enum's values()
- [`KT-12820`](https://youtrack.jetbrains.com/issue/KT-12820) Platform Type Inspection: !! quickfix shouldn't be available when any generic parameter has platform type
- [`KT-9825`](https://youtrack.jetbrains.com/issue/KT-9825) Incorrect "unused variable" warning when used in finally block
- [`KT-13715`](https://youtrack.jetbrains.com/issue/KT-13715) Prohibit applying "Change to star projection" to functional types
#### Refactorings
##### New features
- [`KT-12017`](https://youtrack.jetbrains.com/issue/KT-12017) Inline Property: Support "Do not show this dialog" and "Inline this occurrence" options
##### Bugfixes
- [`KT-11176`](https://youtrack.jetbrains.com/issue/KT-11176) Add a space before '{' in functions generated "Generate hashCode/equals/toString"
- [`KT-12294`](https://youtrack.jetbrains.com/issue/KT-12294) Introduce Property: Fix extraction of expressions referring to primary constructor parameters
- [`KT-12413`](https://youtrack.jetbrains.com/issue/KT-12413) Change Signature: Fix bogus warning about unresolved type parameters/invalid functional type replacement
- [`KT-12084`](https://youtrack.jetbrains.com/issue/KT-12084) Introduce Property: Do not skip outer classes if extractable expression is contained in object literal
- [`KT-13082`](https://youtrack.jetbrains.com/issue/KT-13082) Rename: Fix exception on property rename preview
- [`KT-13207`](https://youtrack.jetbrains.com/issue/KT-13207) Safe delete: Fix exception when removing any function in 2016.2
- [`KT-12945`](https://youtrack.jetbrains.com/issue/KT-12945) Rename: Fix function description in super method warning dialog
- [`KT-12922`](https://youtrack.jetbrains.com/issue/KT-12922) Introduce Variable: Do not suggest expressions without type
- [`KT-12943`](https://youtrack.jetbrains.com/issue/KT-12943) Rename: Show function signatures in "Rename Overloads" dialog
- [`KT-13157`](https://youtrack.jetbrains.com/issue/KT-13157) Extract Function: Automatically quote function name if necessary
- [`KT-13010`](https://youtrack.jetbrains.com/issue/KT-13010) Extract Function: Fix generation of destructuring declarations
- [`KT-13128`](https://youtrack.jetbrains.com/issue/KT-13128) Introduce Variable: Retain entered name after changing "Specify type explicitly" option
- [`KT-13054`](https://youtrack.jetbrains.com/issue/KT-13054) Introduce Variable: Skip leading/trailing comments inside selection
- [`KT-13385`](https://youtrack.jetbrains.com/issue/KT-13385) Move: Quote package name (if necessary) when moving declarations to new file
- [`KT-13395`](https://youtrack.jetbrains.com/issue/KT-13395) Introduce Property: Fix duplicate count in popup window
- [`KT-13277`](https://youtrack.jetbrains.com/issue/KT-13277) Change Signature: Fix usage processing to prevent interfering with Python support plugin
- [`KT-13254`](https://youtrack.jetbrains.com/issue/KT-13254) Rename: Conflict detection for type parameters
- [`KT-13282`](https://youtrack.jetbrains.com/issue/KT-13282), [`KT-13283`](https://youtrack.jetbrains.com/issue/KT-13283) Rename: Fix name quoting for automatic renamers
- [`KT-13239`](https://youtrack.jetbrains.com/issue/KT-13239) Rename: Warn about function name conflicts
- [`KT-13174`](https://youtrack.jetbrains.com/issue/KT-13174) Move: Warn about accessibility conflicts due to moving to unrelated module
- [`KT-13175`](https://youtrack.jetbrains.com/issue/KT-13175) Move: Warn about accessibility conflicts when moving entire file
- [`KT-13240`](https://youtrack.jetbrains.com/issue/KT-13240) Rename: Do not report shadowing conflict if redeclaration is detected
- [`KT-13253`](https://youtrack.jetbrains.com/issue/KT-13253) Rename: Report conflicts for constructor parameters
- [`KT-12971`](https://youtrack.jetbrains.com/issue/KT-12971) Push Down: Do not specifiy visibility on generated overriding members
- [`KT-13124`](https://youtrack.jetbrains.com/issue/KT-13124) Pull Up: Skip super members without explicit declarations
- [`KT-13032`](https://youtrack.jetbrains.com/issue/KT-13032) Rename: Support accessors with non-conventional names
- [`KT-13463`](https://youtrack.jetbrains.com/issue/KT-13463) Rename: Quote parameter name when necessary
- [`KT-13476`](https://youtrack.jetbrains.com/issue/KT-13476) Rename: Fix parameter rename when new name matches call selector
- [`KT-9381`](https://youtrack.jetbrains.com/issue/KT-9381) Rename: Do not search for component convention usages
- [`KT-13488`](https://youtrack.jetbrains.com/issue/KT-13488) Rename: Support rename of packages with non-standard quoted names
#### Debugger
##### New features
- [`KT-7549`](https://youtrack.jetbrains.com/issue/KT-7549) Provide an option to use the Kotlin syntax when evaluating watches and expressions in Java files
##### Bugfixes
- [`KT-13059`](https://youtrack.jetbrains.com/issue/KT-13059) Fix error stepping on *Step Over* action in the end of while block
- [`KT-13037`](https://youtrack.jetbrains.com/issue/KT-13037) Fix possible deadlock in debugger in 2016.1 and exception in 2016.2
- [`KT-12651`](https://youtrack.jetbrains.com/issue/KT-12651) Fix exception in evaluate expression when bad identifier is used for marking object
- [`KT-12896`](https://youtrack.jetbrains.com/issue/KT-12896) Fix "Step In" to inline functions for Android
- [`KT-13269`](https://youtrack.jetbrains.com/issue/KT-13269) Make quick evaluate work on receiver in qualified expressions
- [`KT-12641`](https://youtrack.jetbrains.com/issue/KT-12641) Unknown error on evaluate expression containing inline functions with complicated environment
- [`KT-13163`](https://youtrack.jetbrains.com/issue/KT-13163) Fix exception when evaluating expression: Access is allowed from event dispatch thread only.
### JS
#### New features
- [`KT-3008`](https://youtrack.jetbrains.com/issue/KT-3008) Option to generate require.js and AMD compatible modules
- [`KT-5987`](https://youtrack.jetbrains.com/issue/KT-5987) Add ability to refer to class
- [`KT-4115`](https://youtrack.jetbrains.com/issue/KT-4115) Provide method to get Kotlin type name
#### Bugfixes
- [`KT-8003`](https://youtrack.jetbrains.com/issue/KT-8003) Compiler exception on 'throw throw'
- [`KT-8318`](https://youtrack.jetbrains.com/issue/KT-8318) Wrong result for 'when' containing only 'else' block
- [`KT-12157`](https://youtrack.jetbrains.com/issue/KT-12157) Compiler exception on `when` condition containing `return`, `break` or `continue`
- [`KT-12275`](https://youtrack.jetbrains.com/issue/KT-12275) Fix code generation with inline function call in condition of `while`/`do..while`
- [`KT-13160`](https://youtrack.jetbrains.com/issue/KT-13160) Fix compiler exception when left-hand side of assignment is array access and right-hand side is inline function
- [`KT-12864`](https://youtrack.jetbrains.com/issue/KT-12864) Make enums comparable
- [`KT-12865`](https://youtrack.jetbrains.com/issue/KT-12865) Implementing Comparable breaks inheritance
- [`KT-12928`](https://youtrack.jetbrains.com/issue/KT-12928) Nested inline causes undefined reference access
- [`KT-12929`](https://youtrack.jetbrains.com/issue/KT-12929) Code with callable reference crashed at runtime (in some JS VMs)
- [`KT-13043`](https://youtrack.jetbrains.com/issue/KT-13043) Invalid invocation generated for secondary constructor that calls constructor from base class with default parameters
- [`KT-13025`](https://youtrack.jetbrains.com/issue/KT-13025) 'function?.invoke' does not work properly with extension functions
- [`KT-12807`](https://youtrack.jetbrains.com/issue/KT-12807) Lambda was lost in generated code
- [`KT-12808`](https://youtrack.jetbrains.com/issue/KT-12808) Compiler duplicates arguments and the body of lambda when lambda is in RHS of assignment operator
- [`KT-12873`](https://youtrack.jetbrains.com/issue/KT-12873) Fix ReferenceError when class delegates to complex expression
- [`KT-13658`](https://youtrack.jetbrains.com/issue/KT-13658) Wrong code when capturing object
### Tools
#### Gradle
- Gradle versions < 2.0 are not supported
- [`KT-13234`](https://youtrack.jetbrains.com/issue/KT-13234) Setting kotlinOptions.destination and kotlinOptions.classpath is deprecated
- [`KT-9392`](https://youtrack.jetbrains.com/issue/KT-9392) Kotlin classes are missing after converting Java class to Kotlin
- [`KT-12736`](https://youtrack.jetbrains.com/issue/KT-12736) Kotlin classes are deleted when generated Java source is changed
- [`KT-12658`](https://youtrack.jetbrains.com/issue/KT-12658) Build fails after android resources are edited
- [`KT-12750`](https://youtrack.jetbrains.com/issue/KT-12750) Non clean compilation fails with gradle 2.14
- [`KT-12912`](https://youtrack.jetbrains.com/issue/KT-12912) New class from subproject is unresolved with subsequent build with Gradle Daemon
- [`KT-12962`](https://youtrack.jetbrains.com/issue/KT-12962) Incremental compilation: Track changes in generated files
- [`KT-12923`](https://youtrack.jetbrains.com/issue/KT-12923) Incremental compilation: Compile error when code using internal class is modified
- [`KT-13528`](https://youtrack.jetbrains.com/issue/KT-13528) Incremental compilation: support multi-project incremental compilation
- [`KT-13732`](https://youtrack.jetbrains.com/issue/KT-13732) Android Build folder littered with `copyFlavourTypeXXX`
#### KAPT
##### New features
- [`KT-13499`](https://youtrack.jetbrains.com/issue/KT-13499) Implement Annotation Processing API (JSR 269) natively in Kotlin
##### Bugfixes
- [`KT-12776`](https://youtrack.jetbrains.com/issue/KT-12776) Android build fails with KAPT and generateStubs depending on library module names
- [`KT-13179`](https://youtrack.jetbrains.com/issue/KT-13179) Java is recompiled every time with Gradle 2.14 and KAPT
- [`KT-12303`](https://youtrack.jetbrains.com/issue/KT-12303), [`KT-12113`](https://youtrack.jetbrains.com/issue/KT-12113) Do not pass non-relevant annotations to processors
#### REPL
- [`KT-12389`](https://youtrack.jetbrains.com/issue/KT-12389) REPL just quits when toString() of user class throws an exception
#### CLI & Ant
- [`KT-13237`](https://youtrack.jetbrains.com/issue/KT-13237) Include kotlin-reflect.jar to classpath by default, add '-no-reflect' key to suppress this behavior
#### CLI
- [`KT-13491`](https://youtrack.jetbrains.com/issue/KT-13491) Support '-no-reflect' in 'kotlin' command
#### Maven
- [`KT-13211`](https://youtrack.jetbrains.com/issue/KT-13211) Provide better compilation failure info for TeamCity builds
#### Compiler daemon
- Fix exception "java.lang.NoClassDefFoundError: Could not initialize class kotlin.Unit"
## 1.0.3
### Compiler
#### Analysis & diagnostics
- Combination of `open` and `override` is no longer a warning
- [`KT-4829`](https://youtrack.jetbrains.com/issue/KT-4829) Equal conditions in `when` is now a warning
- [`KT-6611`](https://youtrack.jetbrains.com/issue/KT-6611) "This cast can never succeed" warning is no longer reported for `Foo<T> as Foo<Any>`
- [`KT-7174`](https://youtrack.jetbrains.com/issue/KT-7174) Declaring members with the same signature as non-overridable methods from Java classes (like Object.wait/notify) is now an error (when targeting JVM)
- [`KT-12302`](https://youtrack.jetbrains.com/issue/KT-12302) `abstract` modifier for a member of interface is no longer a warning
- [`KT-12452`](https://youtrack.jetbrains.com/issue/KT-12452) `open` modifier for a member of interface without implementation is now a warning
- [`KT-11111`](https://youtrack.jetbrains.com/issue/KT-11111) Overriding by inline function is now a warning, overriding by a function with reified type parameter is an error
- [`KT-12337`](https://youtrack.jetbrains.com/issue/KT-12337) Reference to a property with invisible setter now has KProperty type (as opposed to KMutableProperty)
###### Issues fixed
- [`KT-4285`](https://youtrack.jetbrains.com/issue/KT-4285) No warning for a non-tail call when the method inherits default arguments from superclass
- [`KT-4764`](https://youtrack.jetbrains.com/issue/KT-4764) Spurious "Variable must be initialized" in try/catch/finally
- [`KT-6665`](https://youtrack.jetbrains.com/issue/KT-6665) Unresolved reference leads to marking subsequent code unreachable
- [`KT-11750`](https://youtrack.jetbrains.com/issue/KT-11750) Exceptions when creating various entries with the name "name" in enums
- [`KT-11998`](https://youtrack.jetbrains.com/issue/KT-11998) Smart cast to not-null is not performed on a boolean property in `if` condition
- [`KT-10648`](https://youtrack.jetbrains.com/issue/KT-10648) Exhaustiveness check does not work when sealed class hierarchy contains intermediate sealed classes
- [`KT-10717`](https://youtrack.jetbrains.com/issue/KT-10717) Type inference for lambda with local return
- [`KT-11266`](https://youtrack.jetbrains.com/issue/KT-11266) Fixed "Empty intersection of types" internal compiler error for some cases
- [`KT-11857`](https://youtrack.jetbrains.com/issue/KT-11857) Fix visibility check for dynamic members within protected method (when targeting JS)
- [`KT-12589`](https://youtrack.jetbrains.com/issue/KT-12589) Improved "`infix` modifier is inapplicable" diagnostic message
- [`KT-11679`](https://youtrack.jetbrains.com/issue/KT-11679) Erroneous call with argument causes Throwable at ResolvedCallImpl.getArgumentMapping()
- [`KT-12623`](https://youtrack.jetbrains.com/issue/KT-12623) Fix ISE on malformed code
#### JVM code generation
- [`KT-5075`](https://youtrack.jetbrains.com/issue/KT-5075) Optimize array/collection indices usage in `for` loop
- [`KT-11116`](https://youtrack.jetbrains.com/issue/KT-11116) Optimize coercion to Unit, POP operations are backward-propagated
###### Issues fixed
- [`KT-11499`](https://youtrack.jetbrains.com/issue/KT-11499) Compiler crashes with "Incompatible stack heights"
- [`KT-11943`](https://youtrack.jetbrains.com/issue/KT-11943) CompilationException with extension property of KClass
- [`KT-12125`](https://youtrack.jetbrains.com/issue/KT-12125) Wrong increment/decrement on Byte/Char/Short.MAX_VALUE/MIN_VALUE
- [`KT-12192`](https://youtrack.jetbrains.com/issue/KT-12192) Exhaustiveness check isn't generated for when expression returning Unit
- [`KT-12200`](https://youtrack.jetbrains.com/issue/KT-12200) Erroneously optimized away assignment to a property initialized to zero
- [`KT-12582`](https://youtrack.jetbrains.com/issue/KT-12582) "VerifyError: Bad local variable type" caused by explicit loop variable type
- [`KT-12708`](https://youtrack.jetbrains.com/issue/KT-12708) Bridge method not generated when data class implements interface with copy() method
- [`KT-12106`](https://youtrack.jetbrains.com/issue/KT-12106) import static of reified companion object method throws IllegalAccessError
#### Performance
- Reduced number of IO operation when loading kotlin compiled classes
#### Сompiler options
- Allow to specify version of Kotlin language for source compatibility with older releases.
- CLI: `-language-version` command line option
- Maven: `languageVersion` configuration parameter, linked with `kotlin.compiler.languageVersion` property
- Gradle: `kotlinOptions.languageVersion` property in task configuration
- Allow to specify which java runtime target version to generate bytecode for.
- CLI: `-jvm-target` command line option
- Maven: `jvmTarget` configuration parameter, linked with `kotlin.compiler.jvmTarget` property
- Gradle: `kotlinOptions.jvmTarget` property in task configuration
- Allow to specify path to JDK to resolve classes from.
- CLI: `-jdk-home` command line option
- Maven: `jdkHome` configuration parameter, linked with `kotlin.compiler.jdkHome` property
- Gradle: `kotlinOptions.jdkHome` property in task configuration
### Standard Library
- Improve documentation (including [`KT-11632`](https://youtrack.jetbrains.com/issue/KT-11632))
- List iteration used in collection operations is performed with an indexed loop when the list supports `RandomAccess` and the operation isn't inlined
### IDE
New features:
#### Completion
###### New features
- Smart completion after `by` and `in`
- Improved completion in bodies of overridden members (when no type is specified)
- Improved presentation of completion items for property accessors
- Fixed keyword completion after `try` in assignment expression
- [`KT-8527`](https://youtrack.jetbrains.com/issue/KT-8527) Include non-imported declarations on the first completion
- [`KT-12068`](https://youtrack.jetbrains.com/issue/KT-12068) Special completion item for "[]" get-operator access
- [`KT-12080`](https://youtrack.jetbrains.com/issue/KT-12080) Parameter names are now higher up in completion list
###### Issues fixed
- Fixed enum members being present in completion as static members
- Fixed QuickDoc not working for properties generated for java classes
- [`KT-9166`](https://youtrack.jetbrains.com/issue/KT-9166) Code completion does not work for synthetic java properties on typing "g"
- [`KT-11609`](https://youtrack.jetbrains.com/issue/KT-11609) No named arguments completion should be after dot
- [`KT-11633`](https://youtrack.jetbrains.com/issue/KT-11633) Wrong indentation after completing a statement in data class
- [`KT-11680`](https://youtrack.jetbrains.com/issue/KT-11680) Code completion of label for existing return with value inserts redundant whitespace
- [`KT-11784`](https://youtrack.jetbrains.com/issue/KT-11784) Completion for `if` statement should add parentheses automatically
- [`KT-11890`](https://youtrack.jetbrains.com/issue/KT-11890) Completion for callable references does not propose static Java members
- [`KT-11912`](https://youtrack.jetbrains.com/issue/KT-11912) String interpolation is not converted to ${} form when accessing this.property
- [`KT-11957`](https://youtrack.jetbrains.com/issue/KT-11957) No `catch` and `finally` keywords in completion
- [`KT-12103`](https://youtrack.jetbrains.com/issue/KT-12103) Smart completion for nested SAM-adapter produces short unresolved name
- [`KT-12138`](https://youtrack.jetbrains.com/issue/KT-12138) Do not show "::error" in smart completion when any function type accepting one argument is expected
- [`KT-12150`](https://youtrack.jetbrains.com/issue/KT-12150) Smart completion suggests to compare non-nullable with null
- [`KT-12124`](https://youtrack.jetbrains.com/issue/KT-12124) No code completion for a java property in a specific position
- [`KT-12299`](https://youtrack.jetbrains.com/issue/KT-12299) Completion: incorrect priority of property foo over method getFoo in Kotlin-only code
- [`KT-12328`](https://youtrack.jetbrains.com/issue/KT-12328) Qualified function name inserted when typing before `if`
- [`KT-12427`](https://youtrack.jetbrains.com/issue/KT-12427) Completion doesn't work for "@receiver:" annotation target
- [`KT-12447`](https://youtrack.jetbrains.com/issue/KT-12447) Don't use CompletionProgressIndicator in Kotlin plugin
- [`KT-12669`](https://youtrack.jetbrains.com/issue/KT-12669) Completion should show variant with `()` when there is default lambda
- [`KT-12369`](https://youtrack.jetbrains.com/issue/KT-12369) Pressing dot after class name should not cause insertion of constructor call
#### Spring support
###### New features
- [`KT-11692`](https://youtrack.jetbrains.com/issue/KT-11692) Support Spring model diagrams for Kotlin classes
- [`KT-12079`](https://youtrack.jetbrains.com/issue/KT-12079) Support "Autowired members defined in invalid Spring bean" inspection on Kotlin declarations
- [`KT-12092`](https://youtrack.jetbrains.com/issue/KT-12092) Implement bean references in @Qualifier annotations
- [`KT-12135`](https://youtrack.jetbrains.com/issue/KT-12135) Automatically configure components based on `basePackageClasses` attribute of @ComponentScan
- [`KT-12136`](https://youtrack.jetbrains.com/issue/KT-12136) Implement package references inside of string literals
- [`KT-12139`](https://youtrack.jetbrains.com/issue/KT-12139) Support Spring configurations linked via @Import annotation
- [`KT-12278`](https://youtrack.jetbrains.com/issue/KT-12278) Implement Spring @Autowired inspection
- [`KT-12465`](https://youtrack.jetbrains.com/issue/KT-12465) Implement Spring @ComponentScan inspection
###### Issues fixed
- [`KT-12091`](https://youtrack.jetbrains.com/issue/KT-12091) Fixed unstable behavior of Spring line markers
- [`KT-12096`](https://youtrack.jetbrains.com/issue/KT-12096) Fixed rename of custom-named beans specified with Kotlin annotation
- [`KT-12117`](https://youtrack.jetbrains.com/issue/KT-12117) Group Kotlin classes from the same file in the Choose Bean dialog
- [`KT-12120`](https://youtrack.jetbrains.com/issue/KT-12120) Show autowiring candidates line markers for @Autowired-annotated constructors and constructor parameters
- [`KT-12122`](https://youtrack.jetbrains.com/issue/KT-12122) Fixed line marker popup on functions with @Qualifier-annotated parameters
- [`KT-12143`](https://youtrack.jetbrains.com/issue/KT-12143) Fixed "Spring Facet Code Configuration (Kotlin)" inspection description
- [`KT-12147`](https://youtrack.jetbrains.com/issue/KT-12147) Fixed exception on analyzing object declaration with @Component annotation
- [`KT-12148`](https://youtrack.jetbrains.com/issue/KT-12148) Warn about object declarations annotated with Spring `@Configuration`/`@Component`/etc.
- [`KT-12363`](https://youtrack.jetbrains.com/issue/KT-12363) Fixed "Autowired members defined in invalid Spring bean (Kotlin)" inspection description
- [`KT-12366`](https://youtrack.jetbrains.com/issue/KT-12366) Fixed exception on analyzing class declaration upon annotation typing
- [`KT-12384`](https://youtrack.jetbrains.com/issue/KT-12384) Fixed bean references in factory method calls
#### Intention actions, inspections and quickfixes
###### New features
- New icon for "New -> Kotlin Activity" action
- "Change visibility on exposure" and "Make visible" fixes now support all possible visibilities
- [`KT-8477`](https://youtrack.jetbrains.com/issue/KT-8477) New inspection "Can be primary constructor property" with quick-fix
- [`KT-5010`](https://youtrack.jetbrains.com/issue/KT-5010) "Redundant semicolon" inspection with quickfix
- [`KT-9757`](https://youtrack.jetbrains.com/issue/KT-9757) Quickfix for "Unused lambda expression" warning
- [`KT-10844`](https://youtrack.jetbrains.com/issue/KT-10844) Quick fix to add crossinline modifier
- [`KT-11090`](https://youtrack.jetbrains.com/issue/KT-11090) "Add variance modifiers to type parameters" inspection
- [`KT-11255`](https://youtrack.jetbrains.com/issue/KT-11255) Move Element Left/Right actions
- [`KT-11450`](https://youtrack.jetbrains.com/issue/KT-11450) "Modality is redundant" inspection
- [`KT-11523`](https://youtrack.jetbrains.com/issue/KT-11523) "Add @JvmOverloads annotation" intention
- [`KT-11768`](https://youtrack.jetbrains.com/issue/KT-11768) "Introduce local variable" intention
- [`KT-11806`](https://youtrack.jetbrains.com/issue/KT-11806) Quick-fix to increase visibility for invisible member
- [`KT-11807`](https://youtrack.jetbrains.com/issue/KT-11807) Use function body template when generating overriding functions with default body
- [`KT-11864`](https://youtrack.jetbrains.com/issue/KT-11864) Suggest "Create function/secondary constructor" quick fix on argument type mismatch
- [`KT-11876`](https://youtrack.jetbrains.com/issue/KT-11876) Quickfix for "Extension function type is not allowed as supertype" error
- [`KT-11920`](https://youtrack.jetbrains.com/issue/KT-11920) "Increase visibility" and "Decrease visibility" quickfixes for exposed visibility errors
- [`KT-12089`](https://youtrack.jetbrains.com/issue/KT-12089) Quickfix "Make primary constructor parameter a property"
- [`KT-12121`](https://youtrack.jetbrains.com/issue/KT-12121) "Add `toString()` call" quickfix
- [`KT-11104`](https://youtrack.jetbrains.com/issue/KT-11104) New quickfixes for nullability problems: "Surround with null check" and "Wrap with safe let call"
- [`KT-12310`](https://youtrack.jetbrains.com/issue/KT-12310) New inspection "Member has platform type" with quickfix
###### Issues fixed
- Fixed "Convert property initializer getter" intention being available inside lambda initializer
- Improved message for "Can be declared as `val`" inspection
- [`KT-3797`](https://youtrack.jetbrains.com/issue/KT-3797) Quickfix to make a function abstract should not be offered for object members
- [`KT-11866`](https://youtrack.jetbrains.com/issue/KT-11866) Suggest "Create secondary constructor" when constructors exist but are not applicable
- [`KT-11482`](https://youtrack.jetbrains.com/issue/KT-11482) Fixed exception in "Move to companion object" intention
- [`KT-11483`](https://youtrack.jetbrains.com/issue/KT-11483) Pass implicit receiver as argument when moving member function to companion object
- [`KT-11512`](https://youtrack.jetbrains.com/issue/KT-11512) Allow choosing any source root in "Move file to directory" intention
- [`KT-10950`](https://youtrack.jetbrains.com/issue/KT-10950) Keep original file package name when moving top-level declarations to separate file (provided it's not ambiguous)
- [`KT-10174`](https://youtrack.jetbrains.com/issue/KT-10174) Optimize imports after applying "Move declaration to separate file" intention
- [`KT-11764`](https://youtrack.jetbrains.com/issue/KT-11764) Intention "Replace with a `forEach` function call should replace `continue` with `return@forEach`
- [`KT-11724`](https://youtrack.jetbrains.com/issue/KT-11724) False suggestion to replace with compound assignment
- [`KT-11805`](https://youtrack.jetbrains.com/issue/KT-11805) Invert if-condition intention breaks code in case of end of line comment
- [`KT-11811`](https://youtrack.jetbrains.com/issue/KT-11811) "Make protected" intention for a val declared in parameters of constructor
- [`KT-11710`](https://youtrack.jetbrains.com/issue/KT-11710) "Replace `if` with elvis operator": incorrect code generated for `if` expression
- [`KT-11849`](https://youtrack.jetbrains.com/issue/KT-11849) Replace explicit parameter with `it` changes the meaning of code because of the shadowing
- [`KT-11870`](https://youtrack.jetbrains.com/issue/KT-11870) "Replace with Elvis" refactoring doesn't change the variable type from T? to T
- [`KT-12069`](https://youtrack.jetbrains.com/issue/KT-12069) Specify language for all Kotlin code inspections
- [`KT-11366`](https://youtrack.jetbrains.com/issue/KT-11366) "object `Companion` is never used" warning in intellij
- [`KT-11275`](https://youtrack.jetbrains.com/issue/KT-11275) Inconsistent behaviour of "move lambda argument out of parentheses" intention action when using lambda calls with function arguments without parentheses
- [`KT-11594`](https://youtrack.jetbrains.com/issue/KT-11594) "Add non-null asserted (!!) call" applied to unsafe cast to nullable type causes AE at KtPsiFactory.createExpression()
- [`KT-11982`](https://youtrack.jetbrains.com/issue/KT-11982) False "Redundant final modifier" reported
- [`KT-12040`](https://youtrack.jetbrains.com/issue/KT-12040) "Replace when with if" produce invalid code for first entry which has comment
- [`KT-12204`](https://youtrack.jetbrains.com/issue/KT-12204) "Use classpath of module" option in existing Kotlin run configuration may be changed when a new run configuration is created
- [`KT-10635`](https://youtrack.jetbrains.com/issue/KT-10635) Don't mark private writeObject and readObject methods of Serializable classes as unused
- [`KT-11466`](https://youtrack.jetbrains.com/issue/KT-11466) "Make abstract" quick fix applies to outer class of object with accidentally abstract function
- [`KT-11120`](https://youtrack.jetbrains.com/issue/KT-11120) Constructor parameter/field reported as unused symbol even if it have `used` annotation
- [`KT-11974`](https://youtrack.jetbrains.com/issue/KT-11974) Invert if-condition intention loses comments
- [`KT-10812`](https://youtrack.jetbrains.com/issue/KT-10812) Globally unused constructors are not marked as such
- [`KT-11320`](https://youtrack.jetbrains.com/issue/KT-11320) Don't mark @BeforeClass (JUnit4) annotated functions as unused
- [`KT-12267`](https://youtrack.jetbrains.com/issue/KT-12267) "Change type" quick fix converts to Int for Long literal
- [`KT-11949`](https://youtrack.jetbrains.com/issue/KT-11949) Various problems fixed with "Constructor parameter is never used as a property" inspection
- [`KT-11716`](https://youtrack.jetbrains.com/issue/KT-11716) "Simply `for` using destructuring declaration" intention: incorrect behavior for data classes
- [`KT-12145`](https://youtrack.jetbrains.com/issue/KT-12145) "Simplify `for` using destructuring declaration" should work even when no variables declared inside loop
- [`KT-11933`](https://youtrack.jetbrains.com/issue/KT-11933) Entities used only by alias are marked as unused
- [`KT-12193`](https://youtrack.jetbrains.com/issue/KT-12193) Convert to block body isn't equivalent for when expressions returning Unit
- [`KT-10779`](https://youtrack.jetbrains.com/issue/KT-10779) Simplify `for` using destructing declaration: intention / inspection quick fix is available only when all variables are used
- [`KT-11281`](https://youtrack.jetbrains.com/issue/KT-11281) Fix exception on applying "Convert to class" intention to Java interface with Kotlin inheritor(s)
- [`KT-12285`](https://youtrack.jetbrains.com/issue/KT-12285) Fix exception on test class generation
- [`KT-12502`](https://youtrack.jetbrains.com/issue/KT-12502) Convert to expression body should be forbidden for non-exhaustive when returning Unit
- [`KT-12260`](https://youtrack.jetbrains.com/issue/KT-12260) ISE while replacing an operator with safe call
- [`KT-12649`](https://youtrack.jetbrains.com/issue/KT-12649) "Convert if to when" intention incorrectly deletes code
- [`KT-12671`](https://youtrack.jetbrains.com/issue/KT-12671) "Shot type" action: "Type is unknown" error on an invoked expression
- [`KT-12284`](https://youtrack.jetbrains.com/issue/KT-12284) Too wide applicability range for "Add braces to else" intention
- [`KT-11975`](https://youtrack.jetbrains.com/issue/KT-11975) "Invert if-condition" intention does not simplify `is` expression
- [`KT-12437`](https://youtrack.jetbrains.com/issue/KT-12437) "Replace explicit parameter" intention is suggested for parameter of inner lambda in presence of `it` from outer lambda
- [`KT-12290`](https://youtrack.jetbrains.com/issue/KT-12290) Navigate to the generated declaration when using "Implement abstract member" intention
- [`KT-12376`](https://youtrack.jetbrains.com/issue/KT-12376) Don't show "Package directive doesn't match file location" in injected code
- [`KT-12777`](https://youtrack.jetbrains.com/issue/KT-12777) Fix exception in "Create class" quickfix applied to unresolved references in type arguments
#### Language injection
- [KT-11768](https://youtrack.jetbrains.com/issue/KT-11768) Implement "Introduce local variable" intention
- [KT-11692](https://youtrack.jetbrains.com/issue/KT-11692) Support Spring model diagrams for Kotlin classes
- [KT-11574](https://youtrack.jetbrains.com/issue/KT-11574) Support predefined Java positions for language injection
- [KT-2428](https://youtrack.jetbrains.com/issue/KT-11574) Support basic use-cases of language injection for expressions marked with @Language annotation
- Add comment or @Language annotation after "Inject language or reference" intention automatically
- Apply injection for the literals in property initializer through property usages
- [KT-11807](https://youtrack.jetbrains.com/issue/KT-11807) Use function body template when generating overriding functions with default body
- Enable injection from Java or Kotlin function declaration by annotating parameter with @Language annotation
- [`KT-2428`](https://youtrack.jetbrains.com/issue/KT-2428) Support basic use-cases of language injection for expressions marked with @Language annotation
- [`KT-11574`](https://youtrack.jetbrains.com/issue/KT-11574) Support predefined Java positions for language injection
- [`KT-11472`](https://youtrack.jetbrains.com/issue/KT-11472) Add comment or @Language annotation after "Inject language or reference" intention automatically
Issues fixed:
#### Refactorings
- [KT-11145](https://youtrack.jetbrains.com/issue/KT-11145) Use progress indicator when searching usages in Introduce Parameter
- [KT-11155](https://youtrack.jetbrains.com/issue/KT-11155) Allow running multiple Kotlin classes as well as running mixtures of Kotlin and Java classes
- [KT-11495](https://youtrack.jetbrains.com/issue/KT-11495) Show recursion line markers for extension function calls with different receiver
- [KT-11659](https://youtrack.jetbrains.com/issue/KT-11659) Generate abstract overrides for Any members inside of Kotlin interfaces
- [KT-11866](https://youtrack.jetbrains.com/issue/KT-11866) Suggest "Create secondary constructor" when constructors exist but are not applicable
- [KT-11908](https://youtrack.jetbrains.com/issue/KT-11866) Allow properties with custom setters to be used in generated equals/hashCode/toString
- [KT-11845](https://youtrack.jetbrains.com/issue/KT-11845) Fixed exception on attempt to find derived classes
- [KT-11736](https://youtrack.jetbrains.com/issue/KT-11736) Fixed searching of Java usages for @JvmStatic properties and @JvmStatic @JvmOverloads functions
- [KT-8817](https://youtrack.jetbrains.com/issue/KT-8817) Fixed rename of Java getters/setters through synthetic property references in Kotlin
- [KT-11617](https://youtrack.jetbrains.com/issue/KT-11617) Fixed title of Introduce Parameter declaration chooser
- [KT-11817](https://youtrack.jetbrains.com/issue/KT-11817) Fixed rename of Kotlin enum constants through Java references
- [KT-11816](https://youtrack.jetbrains.com/issue/KT-11816) Fixed usages search for Safe Delete on simple enum entries
- [KT-11282](https://youtrack.jetbrains.com/issue/KT-11282) Delete interface reference from super-type list when applying Safe Delete to Java interface
- [KT-11967](https://youtrack.jetbrains.com/issue/KT-11967) Fix Find Usages/Rename for parameter references in XML files
###### New features
- [`KT-6372`](https://youtrack.jetbrains.com/issue/KT-6372) Add name suggestions to Rename dialog
- [`KT-7851`](https://youtrack.jetbrains.com/issue/KT-7851) Respect naming conventions in automatic variable rename
- [`KT-8044`](https://youtrack.jetbrains.com/issue/KT-8044), [`KT-9432`](https://youtrack.jetbrains.com/issue/KT-9432) Support @JvmName annotation in rename refactoring
- [`KT-8512`](https://youtrack.jetbrains.com/issue/KT-8512) Support "Rename tests" options in Rename dialog
- [`KT-9168`](https://youtrack.jetbrains.com/issue/KT-9168) Support rename of synthetic properties
- [`KT-10578`](https://youtrack.jetbrains.com/issue/KT-10578) Support automatic test renaming for facade files
- [`KT-12657`](https://youtrack.jetbrains.com/issue/KT-12657) Rename implicit usages of annotation method `value`
- [`KT-12759`](https://youtrack.jetbrains.com/issue/KT-12759) Suggest renaming both property accessors with matching @JvmName when renaming one of them from Java
###### Issues fixed
- [`KT-4791`](https://youtrack.jetbrains.com/issue/KT-4791) Rename overridden property and all its accessors on attempt to rename overriding accessor in Java code
- [`KT-6363`](https://youtrack.jetbrains.com/issue/KT-6363) Do not rename ambiguous references in import directives
- [`KT-6663`](https://youtrack.jetbrains.com/issue/KT-6663) Fixed rename of ambiguous import reference to class/function when some referenced declarations are not changed
- [`KT-8510`](https://youtrack.jetbrains.com/issue/KT-8510) Preserve "Search in comments and strings" and "Search for text occurrences" settings in Rename dialog
- [`KT-8541`](https://youtrack.jetbrains.com/issue/KT-8541), [`KT-8786`](https://youtrack.jetbrains.com/issue/KT-8786) Do now show 'Rename overloads' options if target function has no overloads
- [`KT-8544`](https://youtrack.jetbrains.com/issue/KT-8544) Show more detailed description in Rename dialog
- [`KT-8562`](https://youtrack.jetbrains.com/issue/KT-8562) Show conflicts dialog on attempt of redeclaration
- [`KT-8611`](https://youtrack.jetbrains.com/issue/KT-8732) Qualify class references to resolve rename conflicts when possible
- [`KT-8732`](https://youtrack.jetbrains.com/issue/KT-8732) Implement Rename conflict analysis and fixes for properties/parameters
- [`KT-8860`](https://youtrack.jetbrains.com/issue/KT-8860) Allow renaming class by constructor delegation call referencing primary constructor
- [`KT-8892`](https://youtrack.jetbrains.com/issue/KT-8892) Suggest renaming base declarations on overriding members in object literals
- [`KT-9156`](https://youtrack.jetbrains.com/issue/KT-9156) Quote non-identifier names in Kotlin references
- [`KT-9157`](https://youtrack.jetbrains.com/issue/KT-9157) Fixed in-place rename of Kotlin expression referring Java declaration
- [`KT-9241`](https://youtrack.jetbrains.com/issue/KT-9241) Do not replace Java references to synthetic component functions when renaming constructor parameter
- [`KT-9435`](https://youtrack.jetbrains.com/issue/KT-9435) Process property accessor usages (Java) in comments and string literals
- [`KT-9444`](https://youtrack.jetbrains.com/issue/KT-9444) Rename dialog: Allow typing any identifier without backquotes
- [`KT-9446`](https://youtrack.jetbrains.com/issue/KT-9446) Copy default parameter values to overriding function which is renamed while its base function is not
- [`KT-9649`](https://youtrack.jetbrains.com/issue/KT-9649) Constraint search scope of parameter declared in a private member
- [`KT-10033`](https://youtrack.jetbrains.com/issue/KT-10033) Qualify references to members of enum companions in case of conflict with enum entries
- [`KT-10713`](https://youtrack.jetbrains.com/issue/KT-10713) Skip read-only declarations when renaming parameters
- [`KT-10687`](https://youtrack.jetbrains.com/issue/KT-10687) Qualify property references to avoid shadowing by parameters
- [`KT-11903`](https://youtrack.jetbrains.com/issue/KT-11903) Update references to facade class when renaming file via matching top-level class
- [`KT-12411`](https://youtrack.jetbrains.com/issue/KT-12411) Fix package name quotation in Move refactoring
- [`KT-12543`](https://youtrack.jetbrains.com/issue/KT-12543) Qualify property references with `this` to avoid renaming conflicts
- [`KT-12732`](https://youtrack.jetbrains.com/issue/KT-12732) Copy default parameter values to overriding function which is renamed by Java reference while its base function is unchanged
- [`KT-12747`](https://youtrack.jetbrains.com/issue/KT-12747) Fix exception on file copy
#### Java to Kotlin converter
###### New features
- [`KT-4727`](https://youtrack.jetbrains.com/issue/KT-4727) Convert Java code copied from browser or other sources
###### Issues fixed
- [`KT-11952`](https://youtrack.jetbrains.com/issue/KT-11952) Assertion failed in PropertyDetectionCache.get on conversion of access to Java constant of anonymous type
- [`KT-12046`](https://youtrack.jetbrains.com/issue/KT-12046) Recursive property setter
- [`KT-12039`](https://youtrack.jetbrains.com/issue/KT-12039) Static imports converted missing ".Companion"
- [`KT-12054`](https://youtrack.jetbrains.com/issue/KT-12054) Wrong conversion of `instanceof` checks with raw types
- [`KT-12045`](https://youtrack.jetbrains.com/issue/KT-12045) Convert `Object()` to `Any()`
#### Android Lint
###### Issues fixed
- [`KT-12015`](https://youtrack.jetbrains.com/issue/KT-12015) False positive for Bundle.getInt()
- [`KT-12023`](https://youtrack.jetbrains.com/issue/KT-12023) "minSdk" lint check doesn't work for `as`/`is`
- [`KT-12674`](https://youtrack.jetbrains.com/issue/KT-12674) "Calling new methods on older versions" errors for inlined constants
- [`KT-12681`](https://youtrack.jetbrains.com/issue/KT-12681) Running lint from main menu: diagnostics reported for java source files only
- [`KT-12173`](https://youtrack.jetbrains.com/issue/KT-12173) False positive for "Toast created but not shown" inside SAM adapter
- [`KT-12895`](https://youtrack.jetbrains.com/issue/KT-12895) NoSuchMethodError thrown when saving a Kotlin file
#### KDoc
###### New features
- Support for @receiver tag
###### Issues fixed
- Rendering of `_` and `*` standalone characters
- Rendering of code blocks
- [`KT-9933`](https://youtrack.jetbrains.com/issue/KT-9933) Indentation in code fragments is not preserved
- [`KT-10998`](https://youtrack.jetbrains.com/issue/KT-10998) Spaces around links are missing in return block
- [`KT-11791`](https://youtrack.jetbrains.com/issue/KT-11791) Markdown links rendering
- [`KT-12001`](https://youtrack.jetbrains.com/issue/KT-12001) Allow use of `@param` to document type parameter
#### Maven support
###### New features
- Inspections that check that kotlin IDEA plugin, kotlin Maven plugin and kotlin stdlib are of the same version
- [`KT-11643`](https://youtrack.jetbrains.com/issue/KT-11643) Inspections and intentions to fix erroneously configured Maven pom file
- [`KT-11701`](https://youtrack.jetbrains.com/issue/KT-11701) "Add Maven Dependency quick fix" in Kotlin source files
- [`KT-11743`](https://youtrack.jetbrains.com/issue/KT-11743) Intention to replace kotlin-test with kotlin-test-junit
###### Issues fixed
- [`KT-9492`](https://youtrack.jetbrains.com/issue/KT-9492) Configuring multiple Maven Modules
- [`KT-11642`](https://youtrack.jetbrains.com/issue/KT-11642) Kotlin Maven configurator tags order
- [`KT-11436`](https://youtrack.jetbrains.com/issue/KT-11436) "Choose Configurator" control opens dialogs with inconsistent modality (linux)
- [`KT-11731`](https://youtrack.jetbrains.com/issue/KT-11731) Default maven integration doesn't include documentation
- [`KT-12568`](https://youtrack.jetbrains.com/issue/KT-12568) Execution configuration: file path completion works only in some sub-elements of <sourceDirs>
- [`KT-12558`](https://youtrack.jetbrains.com/issue/KT-12558) Configure Kotlin in Project: "Undo" should revert changes in all poms
- [`KT-12512`](https://youtrack.jetbrains.com/issue/KT-12512) "Different IDE and Maven plugin version" inspection is being invoked for non-tracked pom.xml files
#### Debugger
###### New features
- [`KT-11438`](https://youtrack.jetbrains.com/issue/KT-11438) Support navigation from stacktrace to inline function call site
###### Issues fixed
- Do not step into inline lambda argument during step over inside inline function body
- Fix step over for inline argument with non-local return
- [`KT-12067`](https://youtrack.jetbrains.com/issue/KT-12067) Deadlock in Kotlin debugger is fixed
- [`KT-12232`](https://youtrack.jetbrains.com/issue/KT-12232) No code completion in Evaluate Expression and Throwable at CodeCompletionHandlerBase.invokeCompletion()
- [`KT-12137`](https://youtrack.jetbrains.com/issue/KT-12137) Evaluate expression: code completion/intention actions allows to use symbols from modules that are not referenced
- [`KT-12206`](https://youtrack.jetbrains.com/issue/KT-12206) NoSuchFieldError in Evaluate Expression on a property of a derived class
- [`KT-12678`](https://youtrack.jetbrains.com/issue/KT-12678) NoSuchFieldError in Evaluate Expression on accessing delegated property defined in other module
- [`KT-12773`](https://youtrack.jetbrains.com/issue/KT-12773) Fix debugging for Kotlin JS projects
#### Formatter
###### Issues fixed
- [`KT-12035`](https://youtrack.jetbrains.com/issue/KT-12035) Spaces around `as`
- [`KT-12018`](https://youtrack.jetbrains.com/issue/KT-12018) Spaces between function name and arguments in infix calls
- [`KT-11961`](https://youtrack.jetbrains.com/issue/KT-11961) Spaces before angle bracket in method definition
- [`KT-12175`](https://youtrack.jetbrains.com/issue/KT-12175) Don't enforce empty line between secondary constructors without body
- [`KT-12548`](https://youtrack.jetbrains.com/issue/KT-12548) Spaces around `is` keyword
- [`KT-12446`](https://youtrack.jetbrains.com/issue/KT-12446) Spaces before class type parameters
- [`KT-12634`](https://youtrack.jetbrains.com/issue/KT-12634) Spaces between method name and parenthesis in method call
- [`KT-10680`](https://youtrack.jetbrains.com/issue/KT-10680) Spaces around `in` keyword
- [`KT-12791`](https://youtrack.jetbrains.com/issue/KT-12791) Spaces between curly brace and expression inside string template
- [`KT-12781`](https://youtrack.jetbrains.com/issue/KT-12781) Spaces between annotation and expression
- [`KT-12689`](https://youtrack.jetbrains.com/issue/KT-12689) Spaces around semicolons
- [`KT-12714`](https://youtrack.jetbrains.com/issue/KT-12714) Spaces around parentheses in enum elements
#### Other
###### New features
- Added "Decompile" button to Kotlin bytecode toolwindow
- Added Kotlin "Tips of the day"
- Added "Kotlin 1.1 EAP" to "Configure Kotlin Plugin updates"
- [`KT-2919`](https://youtrack.jetbrains.com/issue/KT-2919) Constructor calls are no longer highlighted as classes
- [`KT-6540`](https://youtrack.jetbrains.com/issue/KT-6540) Infix function calls are now highlighted as regular function calls
- [`KT-9410`](https://youtrack.jetbrains.com/issue/KT-9410) Annotations in Kotlin are now highlighted with the same color as in Java by default
- [`KT-11465`](https://youtrack.jetbrains.com/issue/KT-11465) Type parameters in Kotlin are now highlighted with the same color as in Java by default
- [`KT-11657`](https://youtrack.jetbrains.com/issue/KT-11657) Allow viewing decompiled Java source code for Kotlin-compiled classes
- [`KT-11704`](https://youtrack.jetbrains.com/issue/KT-11704) Support file path references inside of Kotlin string literals
- [`KT-12076`](https://youtrack.jetbrains.com/issue/KT-12076) Kotlin Plugin update check: always display installed version number
- [`KT-11814`](https://youtrack.jetbrains.com/issue/KT-11814) New icon for kotlin annotation classes
- [`KT-12735`](https://youtrack.jetbrains.com/issue/KT-12735) Convert JavaDoc to KDoc when overriding Java class member in Kotlin
###### Issues fixed
- [`KT-5960`](https://youtrack.jetbrains.com/issue/KT-5960) Can't find usages for Java methods used from Kotlin by call convention
- [`KT-8362`](https://youtrack.jetbrains.com/issue/KT-8362) "New Kotlin file": Keywords should be escaped in package name
- [`KT-8682`](https://youtrack.jetbrains.com/issue/KT-8682) Respect "Copy JavaDoc" option in the "Override/Implement Members..." dialog
- [`KT-8817`](https://youtrack.jetbrains.com/issue/KT-8817) Fixed rename of Java getters/setters through synthetic property references in Kotlin
- [`KT-9399`](https://youtrack.jetbrains.com/issue/KT-9399) Find Usages omits Kotlin annotation parameter usage in Java source
- [`KT-9797`](https://youtrack.jetbrains.com/issue/KT-9797) "Kotlin Bytecode" toolwindow breaks after closing
- [`KT-11145`](https://youtrack.jetbrains.com/issue/KT-11145) Use progress indicator when searching usages in Introduce Parameter
- [`KT-11155`](https://youtrack.jetbrains.com/issue/KT-11155) Allow running multiple Kotlin classes as well as running mixtures of Kotlin and Java classes
- [`KT-11495`](https://youtrack.jetbrains.com/issue/KT-11495) Show recursion line markers for extension function calls with different receiver
- [`KT-11659`](https://youtrack.jetbrains.com/issue/KT-11659) Generate abstract overrides for Any members inside of Kotlin interfaces
- [`KT-12070`](https://youtrack.jetbrains.com/issue/KT-12070) Add empty line in error message of Maven and Gradle configuration
- [`KT-11908`](https://youtrack.jetbrains.com/issue/KT-11908) Allow properties with custom setters to be used in generated equals/hashCode/toString
- [`KT-11617`](https://youtrack.jetbrains.com/issue/KT-11617) Fixed title of Introduce Parameter declaration chooser
- [`KT-11817`](https://youtrack.jetbrains.com/issue/KT-11817) Fixed rename of Kotlin enum constants through Java references
- [`KT-11816`](https://youtrack.jetbrains.com/issue/KT-11816) Fixed usages search for Safe Delete on simple enum entries
- [`KT-11282`](https://youtrack.jetbrains.com/issue/KT-11282) Delete interface reference from super-type list when applying Safe Delete to Java interface
- [`KT-11967`](https://youtrack.jetbrains.com/issue/KT-11967) Fix Find Usages/Rename for parameter references in XML files
- [`KT-10770`](https://youtrack.jetbrains.com/issue/KT-10770) "Optimize imports" will not keep import if a type is only referenced by kdoc
- [`KT-11955`](https://youtrack.jetbrains.com/issue/KT-11955) Copy/Paste inserts fully qualified name when copying function with overloads
- [`KT-12436`](https://youtrack.jetbrains.com/issue/KT-12436) "Replace explicit parameter with it": java.lang.Exception at BaseRefactoringProcessor.run()
- [`KT-12440`](https://youtrack.jetbrains.com/issue/KT-12440) Removing unused parameter results in Exception "Refactorings should not be started inside write action"
- [`KT-12006`](https://youtrack.jetbrains.com/issue/KT-12006) getLanguageLevel is slow for Kotlin light classes
- [`KT-12026`](https://youtrack.jetbrains.com/issue/KT-12026) "Constant expression required" in Java for const Kotlin values
- [`KT-12259`](https://youtrack.jetbrains.com/issue/KT-12259) ClassCastException in light classes while trying to create generic property
- [`KT-12289`](https://youtrack.jetbrains.com/issue/KT-12289) Remove unnecessary `?` from `serr` live template
- [`KT-12110`](https://youtrack.jetbrains.com/issue/KT-12110) Map help button of the Compiler - Kotlin page
- [`KT-12075`](https://youtrack.jetbrains.com/issue/KT-12075) Kotlin Plugin update check: make dumbaware
- [`KT-10255`](https://youtrack.jetbrains.com/issue/KT-10255) call BuildManager.clearState(project) in apply() method of Kotlin Compiler Settings configurable
- [`KT-11841`](https://youtrack.jetbrains.com/issue/KT-11841) New Project / Module wizard, Gradle: pure Kotlin module is created without `repositories` call in build.gradle
- [`KT-11095`](https://youtrack.jetbrains.com/issue/KT-11095) Java cannot infer generic return type of Kotlin function (with java 8 language level)
- [`KT-12090`](https://youtrack.jetbrains.com/issue/KT-12090) Intellij/Kotlin plugin does not handle generic return type of static method defined in Kotlin, called from Java
- [`KT-12206`](https://youtrack.jetbrains.com/issue/KT-12206) Fix NoSuchFieldError on accessing base property without backing field in evaluate expression
- [`KT-12516`](https://youtrack.jetbrains.com/issue/KT-12516) File Structure: Kotlin annotation classes have Java annotation icons
- [`KT-11328`](https://youtrack.jetbrains.com/issue/KT-11328) "New Kotlin class": generates packages when fully qualified name is specified
- [`KT-11778`](https://youtrack.jetbrains.com/issue/KT-11778) Exception in Lombok plugin: Rewrite at slice FUNCTION
- [`KT-11708`](https://youtrack.jetbrains.com/issue/KT-11708) "Go to declaration" doesn't work on a call to function with SAM conversion on a derived type
- [`KT-12381`](https://youtrack.jetbrains.com/issue/KT-12381) Prefer not-nullable return type when overriding Java method without nullability annotation
- [`KT-12647`](https://youtrack.jetbrains.com/issue/KT-12647) Performance improvement for test-related line markers
- [`KT-12526`](https://youtrack.jetbrains.com/issue/KT-12526) Kotlin intentions increase PSI modification counts from isAvailable, even in daemon threads
### Reflection
###### Issues fixed
- [`KT-11531`](https://youtrack.jetbrains.com/issue/KT-11531) Optimize "KCallable.name"
- [`KT-10771`](https://youtrack.jetbrains.com/issue/KT-10771) Reflection on Function objects does not support lambdas with generic return type
- [`KT-11824`](https://youtrack.jetbrains.com/issue/KT-11824) Reflection inconsistency between member property and accessor
### JS
- Improve performance of maps and sets
###### Issues fixed
- [`KT-6942`](https://youtrack.jetbrains.com/issue/KT-6942) Generate structural equality check (i.e. `Any.equals`) instead of referential check (===) value equality patterns in `when`
- [`KT-7228`](https://youtrack.jetbrains.com/issue/KT-7228) Wrong AbstractList signature
- [`KT-8299`](https://youtrack.jetbrains.com/issue/KT-8299) Wrong access to private member in autogenerated code in data class
- [`KT-11346`](https://youtrack.jetbrains.com/issue/KT-11346) Reified functions like `filterIsInstance` are now available in JS Standard Library
- [`KT-12305`](https://youtrack.jetbrains.com/issue/KT-12305) Incorrect translation of `vararg` in `@native` functions
- [`KT-12254`](https://youtrack.jetbrains.com/issue/KT-12254) JsEmptyExpression in initializer when compiling code like `val x = throw Exception()`
- [`KT-11960`](https://youtrack.jetbrains.com/issue/KT-11960) Wrong code generated when a method of a local class calls constructor of the class
- [`KT-10931`](https://youtrack.jetbrains.com/issue/KT-10931) Incorrect inlining of library method with optional parameters
- [`KT-12417`](https://youtrack.jetbrains.com/issue/KT-12417) Wrong check cast generated for KMutableProperty
### Tools
###### New features
- [`KT-11839`](https://youtrack.jetbrains.com/issue/KT-11839) Maven goal to execute kotlin script
###### Issues fixed
- KAPT: fix error when using enum constructors with parameters
- Various problems with gradle 2.2 fixed: [`KT-12478`](https://youtrack.jetbrains.com/issue/KT-12478), [`KT-12406`](https://youtrack.jetbrains.com/issue/KT-12406), [`KT-12478`](https://youtrack.jetbrains.com/issue/KT-12478)
- [`KT-12595`](https://youtrack.jetbrains.com/issue/KT-12595) JPS: Fixed com.intellij.util.io.MappingFailedException: Cannot map buffer
- [`KT-11166`](https://youtrack.jetbrains.com/issue/KT-11166) Gradle: Unable to access internal classes from test code within the same module
- [`KT-12352`](https://youtrack.jetbrains.com/issue/KT-12352) KAPT: Fix "Classpath entry points to a non-existent location" warnings
- [`KT-12074`](https://youtrack.jetbrains.com/issue/KT-12074) Building Kotlin maven projects using a parent pom will silently fail
- [`KT-11770`](https://youtrack.jetbrains.com/issue/KT-11770) Warning "RuntimeException: Could not find installation home path" when using Gradle Incremental Compilation
- [`KT-10969`](https://youtrack.jetbrains.com/issue/KT-10969) Android extensions: NullPointerException when finding view in Fragment
- [`KT-11885`](https://youtrack.jetbrains.com/issue/KT-11885) Gradle/Android: Unresolved reference "kotlinx" when classpath dependency is defined in root build.gradle
- [`KT-12786`](https://youtrack.jetbrains.com/issue/KT-12786) Deprecation warning with Gradle 2.14
## 1.0.2-1
- [KT-12159](https://youtrack.jetbrains.com/issue/KT-12159), [KT-12406](https://youtrack.jetbrains.com/issue/KT-12406), [KT-12431](https://youtrack.jetbrains.com/issue/KT-12431), [KT-12478](https://youtrack.jetbrains.com/issue/KT-12478) Support Android Studio 2.2
- [KT-11770](https://youtrack.jetbrains.com/issue/KT-11770) Fix warning "RuntimeException: Could not find installation home path" when using incremental compilation in Gradle
- [KT-12436](https://youtrack.jetbrains.com/issue/KT-12436), [KT-12440](https://youtrack.jetbrains.com/issue/KT-12440) Fix multiple exceptions during refactorings in IDEA 2016.2 EAP
- [KT-12015](https://youtrack.jetbrains.com/issue/KT-12015), [KT-12047](https://youtrack.jetbrains.com/issue/KT-12047), [KT-12387](https://youtrack.jetbrains.com/issue/KT-12387) Fix multiple issues in Kotlin Lint checks
## 1.0.2
@@ -82,6 +826,7 @@ Issues fixed:
- [KT-5429](https://youtrack.jetbrains.com/issue/KT-5429) Write nullability annotations on extension receiver parameters
- [KT-11347](https://youtrack.jetbrains.com/issue/KT-11347) Preserve source file and line number of call site when inlining certain standard library functions
- [KT-11677](https://youtrack.jetbrains.com/issue/KT-11677) Write correct generic signatures for local classes in inlined lambdas
- [KT-12127](https://youtrack.jetbrains.com/issue/KT-12127) Do not write unnecessary generic signature for property delegate backing field
- Fix multiple issues leading to exceptions or bad bytecode being generated: [KT-11034](https://youtrack.jetbrains.com/issue/KT-11034), [KT-11519](https://youtrack.jetbrains.com/issue/KT-11519), [KT-11117](https://youtrack.jetbrains.com/issue/KT-11117), [KT-11479](https://youtrack.jetbrains.com/issue/KT-11479)
#### Java interoperability
@@ -135,9 +880,15 @@ Issues fixed:
- [KT-11030](https://youtrack.jetbrains.com/issue/KT-11030) Support local classes
- [KT-7819](https://youtrack.jetbrains.com/issue/KT-7819) Support non-local returns in local lambdas
- [KT-6912](https://youtrack.jetbrains.com/issue/KT-6912) Safe calls (`x?.let { it }`) are now inlined
- [KT-2670](https://youtrack.jetbrains.com/issue/KT-2670) Support unsafe casts (`as`)
- [KT-7016](https://youtrack.jetbrains.com/issue/KT-7016), [KT-8012](https://youtrack.jetbrains.com/issue/KT-8012) Fix `is`-checks for reified type parameters
- [KT-7038](https://youtrack.jetbrains.com/issue/KT-7038) Avoid unwanted side effects on `is`-checks for nullable types
- [KT-10614](https://youtrack.jetbrains.com/issue/KT-10614) Copy array on vararg call with spread operator
- [KT-10785](https://youtrack.jetbrains.com/issue/KT-10785) Correctly translate property names and receiver instances in assignment operations
- [KT-11611](https://youtrack.jetbrains.com/issue/KT-11611) Fix translation of default value of secondary constructor's functional parameter
- [KT-11100](https://youtrack.jetbrains.com/issue/KT-11100) Fix generation of `invoke` on objects and companion objects
- [KT-11823](https://youtrack.jetbrains.com/issue/KT-11823) Fix capturing of outer class' `this` in inner's lambdas
- [KT-11996](https://youtrack.jetbrains.com/issue/KT-11996) Fix translation of a call to a private member of an outer class from an inner class which is a subtype of the outer class
- [KT-10667](https://youtrack.jetbrains.com/issue/KT-10667) Support inheritance from nested built-in types such as Map.Entry
- [KT-7480](https://youtrack.jetbrains.com/issue/KT-7480) Remove declarations of LinkedList, SortedSet, TreeSet, Enumeration
- [KT-3064](https://youtrack.jetbrains.com/issue/KT-3064) Implement `CharSequence.repeat`
@@ -193,11 +944,12 @@ Issues fixed:
- [KT-11295](https://youtrack.jetbrains.com/issue/KT-11295) "Convert string to template" intention: fix exception on certain code
- [KT-10750](https://youtrack.jetbrains.com/issue/KT-10750), [KT-11424](https://youtrack.jetbrains.com/issue/KT-11424) "Convert if to when" intention now detects effectively else branches in subsequent code and performs more accurate comment handling
- Configure Kotlin: show only changed files in the notification "Kotlin not configured", restore all changed files in undo action
- [KT-11556](https://youtrack.jetbrains.com/issue/KT-11556) Do not show "Kotlin not configured" for Kotlin JS projects
- [KT-11593](https://youtrack.jetbrains.com/issue/KT-11593) Fix "Configure Kotlin" action for Gradle projects in IDEA 2016
- [KT-11077](https://youtrack.jetbrains.com/issue/KT-11077) Use new built-in definition file format (`.kotlin_builtins` files)
- [KT-5728](https://youtrack.jetbrains.com/issue/KT-5728) Remove closing curly brace in a string template when opening one is deleted
- [KT-10883](https://youtrack.jetbrains.com/issue/KT-10883) "Explicit get or set call" quick fix: do not move caret too far away
- [KT-5717](https://youtrack.jetbrains.com/issue/KT-5717) "Replace 'when' with 'if'": do not lose comments
- [KT-5717](https://youtrack.jetbrains.com/issue/KT-5717) "Replace `when` with `if`": do not lose comments
- [KT-10797](https://youtrack.jetbrains.com/issue/KT-10797) "Replace with operator" intention is not available anymore for non-`operator` functions
- [KT-11529](https://youtrack.jetbrains.com/issue/KT-11529) Highlighting range for unresolved annotation name does not include `@` now
- [KT-11178](https://youtrack.jetbrains.com/issue/KT-11178) Don't show "Change type arguments" fix when there's nothing to change
@@ -208,7 +960,8 @@ Issues fixed:
- [KT-11720](https://youtrack.jetbrains.com/issue/KT-11720) Fixed renaming of Kotlin beans through SpEL references
- [KT-11719](https://youtrack.jetbrains.com/issue/KT-11719) Fixed renaming of Kotlin parameters references in XML files
- [KT-11736](https://youtrack.jetbrains.com/issue/KT-11736) Fixed searching of Java usages for @JvmStatic properties and @JvmStatic @JvmOverloads functions
- Fix several issues leading to exceptions: [KT-11579](https://youtrack.jetbrains.com/issue/KT-11579), [KT-11580](https://youtrack.jetbrains.com/issue/KT-11580), [KT-11777](https://youtrack.jetbrains.com/issue/KT-11777), [KT-11868](https://youtrack.jetbrains.com/issue/KT-11868), [KT-11845](https://youtrack.jetbrains.com/issue/KT-11845)
- [KT-11862](https://youtrack.jetbrains.com/issue/KT-11862) Fixed bogus warnings about unresolved types in the Change Signature dialog
- Fix several issues leading to exceptions: [KT-11579](https://youtrack.jetbrains.com/issue/KT-11579), [KT-11580](https://youtrack.jetbrains.com/issue/KT-11580), [KT-11777](https://youtrack.jetbrains.com/issue/KT-11777), [KT-11868](https://youtrack.jetbrains.com/issue/KT-11868), [KT-11845](https://youtrack.jetbrains.com/issue/KT-11845), [KT-11486](https://youtrack.jetbrains.com/issue/KT-11486)
- Fixed NoSuchFieldException in Kotlin module settings on IDEA Ultimate
#### Debugger
@@ -271,6 +1024,8 @@ Issues fixed:
- [KT-8487](https://youtrack.jetbrains.com/issue/KT-8487) Experimental support for incremental compilation with project property `kotlin.incremental`
- [KT-11350](https://youtrack.jetbrains.com/issue/KT-11350) Fixed a bug causing Java rebuild when both Java and Kotlin are up-to-date
- [KT-10507](https://youtrack.jetbrains.com/issue/KT-10507) Fix IllegalArgumentException "Missing extension point" on parallel builds
- [KT-10932](https://youtrack.jetbrains.com/issue/KT-10932) Prevent compile tasks from running when nothing changes
- [KT-11993](https://youtrack.jetbrains.com/issue/KT-11993) Fix NoSuchMethodError on access to internal members in production from tests (IDEA 2016+)
## 1.0.1-2

View File

@@ -17,10 +17,6 @@
<property name="compiler.version.java.versioned" value="${compiler.version.java}.versioned"/>
<property name="plugin.zip" value="${artifact.output.path}/kotlin-plugin-${build.number}.zip"/>
<property name="bare.plugin.zip" value="${artifact.output.path}/kotlin-bare-plugin-${build.number}.zip"/>
<property name="kotlin.bare.plugin.xml" value="jps-plugin/bare-plugin/src/META-INF/plugin.xml"/>
<property name="kotlin.bare.plugin.xml.bk" value="${version_substitute_dir}/kotlin.bare.plugin.xml.bk"/>
<macrodef name="echoprop">
<attribute name="prop"/>
@@ -90,17 +86,11 @@
target.file.versioned="${compiler.version.java.versioned}"
test.string="public static final String VERSION = &quot;@snapshot@&quot;;"/>
<substituteVersionInFile
target.file="${kotlin.bare.plugin.xml}"
target.file.bk="${kotlin.bare.plugin.xml.bk}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"/>
</target>
<target name="revertTemplateFiles">
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
<copy file="${kotlin.bare.plugin.xml.bk}" tofile="${kotlin.bare.plugin.xml}" overwrite="true"/>
<delete dir="${version_substitute_dir}" quiet="true"/>
</target>
@@ -125,7 +115,6 @@
</macrodef>
<zipPlugin filename="${plugin.zip}" dir="Kotlin"/>
<zipPlugin filename="${bare.plugin.zip}" dir="BareKotlin"/>
</target>
<macrodef name="print-statistic">
@@ -154,10 +143,8 @@
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-jslib.jar"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="kotlin.js"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="builtins.js"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="builtins.meta.js"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="stdlib.js"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="stdlib.meta.js"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="${compiled.stdlib.meta.js}"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="${compiled.stdlib.js}"/>
</target>
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>

View File

@@ -82,13 +82,6 @@
plugin.subdir="Kotlin"
substituted.version="${relay.substitute.version}"/>
<substitudeVersionInPlugin
plugin.jar.name="kotlin-bare-plugin"
plugin.path="${relay.plugins.dir}/kotlin-bare-plugin-${relay.origin.version}.zip"
origin.version="${relay.origin.version}"
plugin.subdir="BareKotlin"
substituted.version="${relay.substitute.version}"/>
<substitudeVersionInPlugin
plugin.jar.name="kotlin-android-extensions"
plugin.path="${relay.plugins.dir}/kotlin-android-extensions-plugin-${relay.origin.version}.zip"

View File

@@ -27,6 +27,7 @@ class Kotlin2JsTask : KotlinCompilerBaseTask() {
var outputPostfix: File? = null
var sourceMap: Boolean = false
var metaInfo: Boolean = false
var moduleKind: String = "plain"
/**
* {@link K2JsArgumentConstants.CALL} (default) if need generate a main function call (main function will be auto detected)
@@ -73,5 +74,7 @@ class Kotlin2JsTask : KotlinCompilerBaseTask() {
if (noStdlib) args.add("-no-stdlib")
if (sourceMap) args.add("-source-map")
if (metaInfo) args.add("-meta-info")
args += listOf("-module-kind", moduleKind)
}
}

View File

@@ -26,6 +26,8 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
var includeRuntime: Boolean = true
var moduleName: String? = null
var noReflect: Boolean = false
private var compileClasspath: Path? = null
fun setClasspath(classpath: Path) {
@@ -68,6 +70,7 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
}
if (noStdlib) args.add("-no-stdlib")
if (noReflect) args.add("-no-reflect")
if (includeRuntime) args.add("-include-runtime")
}
}

View File

@@ -24,7 +24,7 @@ import java.io.File
import java.lang.ref.SoftReference
import java.net.JarURLConnection
object KotlinAntTaskUtil {
internal object KotlinAntTaskUtil {
private var classLoaderRef = SoftReference<ClassLoader?>(null)
private val libPath: File by lazy {
@@ -37,19 +37,16 @@ object KotlinAntTaskUtil {
antTaskJarPath.parentFile
}
val compilerJar: File by lazy {
File(libPath, "kotlin-compiler.jar").assertExists()
}
val compilerJar: File by jar("kotlin-compiler.jar")
val runtimeJar: File by jar("kotlin-runtime.jar")
val reflectJar: File by jar("kotlin-reflect.jar")
val runtimeJar: File by lazy {
File(libPath, "kotlin-runtime.jar").assertExists()
}
private fun File.assertExists(): File {
if (!this.exists()) {
throw IllegalStateException("${name} is not found in the directory of Kotlin Ant task")
private fun jar(name: String) = lazy {
File(libPath, name).apply {
if (!exists()) {
throw IllegalStateException("File is not found in the directory of Kotlin Ant task: $name")
}
}
return this
}
@Synchronized
@@ -65,8 +62,7 @@ object KotlinAntTaskUtil {
return classLoader
}
}
val Task.defaultModuleName: String?
get() = owningTarget?.name ?: project?.name
internal val Task.defaultModuleName: String?
get() = owningTarget?.name ?: project?.name

View File

@@ -31,6 +31,7 @@ class KotlinCompilerAdapter : Javac13() {
var additionalArguments: MutableList<Commandline.Argument> = ArrayList(0)
@Suppress("unused") // Used via reflection by Ant
fun createCompilerArg(): Commandline.Argument {
val argument = Commandline.Argument()
additionalArguments.add(argument)
@@ -94,15 +95,22 @@ class KotlinCompilerAdapter : Javac13() {
}
private fun addRuntimeToJavacClasspath(kotlinc: Kotlin2JvmTask) {
for (arg in kotlinc.args) {
// If "-no-stdlib" was specified explicitly, probably the user also wanted the javac classpath to not have it
if ("-no-stdlib" == arg) return
}
// If "-no-stdlib" (or "-no-reflect") was specified explicitly, probably the user also wanted the javac classpath to not have it
val addStdlib = "-no-stdlib" !in kotlinc.args
val addReflect = "-no-reflect" !in kotlinc.args
if (!addStdlib && !addReflect) return
if (compileClasspath == null) {
compileClasspath = Path(getProject())
}
compileClasspath.add(Path(getProject(), KotlinAntTaskUtil.runtimeJar.absolutePath))
if (addStdlib) {
compileClasspath.add(Path(getProject(), KotlinAntTaskUtil.runtimeJar.absolutePath))
}
// "-no-stdlib" implies "-no-reflect", see K2JVMCompiler.Companion.getClasspath
if (addReflect && addStdlib) {
compileClasspath.add(Path(getProject(), KotlinAntTaskUtil.reflectJar.absolutePath))
}
}
private fun checkAntVersion() {

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.incremental
import com.google.protobuf.MessageLite
import com.intellij.openapi.util.io.FileUtil.toSystemIndependentName
import com.intellij.util.SmartList
import com.intellij.util.io.BooleanDataDescriptor
@@ -33,6 +32,7 @@ import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
@@ -122,6 +122,11 @@ open class IncrementalCacheImpl<Target>(
}
}
// used in gradle
@Suppress("unused")
fun classesBySources(sources: Iterable<File>): Iterable<JvmClassName> =
sources.flatMap { sourceToClassesMap[it] }
fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
@@ -641,12 +646,12 @@ open class IncrementalCacheImpl<Target>(
}
private inner class InlineFunctionsMap(storageFile: File) : BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
private fun getInlineFunctionsMap(bytes: ByteArray): Map<String, Long> {
val result = HashMap<String, Long>()
val inlineFunctions = inlineFunctionsJvmNames(bytes)
private fun getInlineFunctionsMap(header: KotlinClassHeader, bytes: ByteArray): Map<String, Long> {
val inlineFunctions = inlineFunctionsJvmNames(header)
if (inlineFunctions.isEmpty()) return emptyMap()
val result = HashMap<String, Long>()
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5) {
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
val dummyClassWriter = ClassWriter(Opcodes.ASM5)
@@ -669,7 +674,7 @@ open class IncrementalCacheImpl<Target>(
}
fun process(kotlinClass: LocalFileKotlinClass, isPackage: Boolean): CompilationResult {
return put(kotlinClass.className, getInlineFunctionsMap(kotlinClass.fileContents), isPackage)
return put(kotlinClass.className, getInlineFunctionsMap(kotlinClass.classHeader, kotlinClass.fileContents), isPackage)
}
private fun put(className: JvmClassName, newMap: Map<String, Long>, isPackage: Boolean): CompilationResult {

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.components.SourceRetentionAnnotationHandler
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
import org.jetbrains.kotlin.modules.TargetId

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.incremental.components.SourceRetentionAnnotationHandler
class SourceRetentionAnnotationHandlerImpl : SourceRetentionAnnotationHandler {
private val mutableSourceRetentionAnnotations = mutableSetOf<String>()
val sourceRetentionAnnotations: Set<String>
get() = mutableSourceRetentionAnnotations
override fun register(internalName: String) {
mutableSourceRetentionAnnotations += internalName
}
}

View File

@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.compilerRunner.OutputItemsCollectorImpl
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.components.SourceRetentionAnnotationHandler
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
import org.jetbrains.kotlin.modules.KotlinModuleXmlBuilder
@@ -69,13 +70,18 @@ fun makeModuleFile(name: String, isTest: Boolean, outputDir: File, sourcesToComp
fun makeCompileServices(
incrementalCaches: Map<TargetId, IncrementalCache>,
lookupTracker: LookupTracker,
compilationCanceledStatus: CompilationCanceledStatus?
compilationCanceledStatus: CompilationCanceledStatus?,
sourceRetentionAnnotationHandler: SourceRetentionAnnotationHandler? = null
): Services =
with(Services.Builder()) {
register(IncrementalCompilationComponents::class.java, IncrementalCompilationComponentsImpl(incrementalCaches, lookupTracker))
register(IncrementalCompilationComponents::class.java,
IncrementalCompilationComponentsImpl(incrementalCaches, lookupTracker))
compilationCanceledStatus?.let {
register(CompilationCanceledStatus::class.java, it)
}
sourceRetentionAnnotationHandler?.let {
register(SourceRetentionAnnotationHandler::class.java, it)
}
build()
}
@@ -175,8 +181,8 @@ fun<Target> OutputItemsCollectorImpl.generatedFiles(
}
data class DirtyData(
val dirtyLookupSymbols: Iterable<LookupSymbol>,
val dirtyClassesFqNames: Iterable<FqName>
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
val dirtyClassesFqNames: Collection<FqName> = emptyList()
)
fun <Target> CompilationResult.getDirtyData(
@@ -261,7 +267,7 @@ private fun File.isJavaFile() = extension.equals(JavaFileType.INSTANCE.defaultEx
private fun findSrcDirRoot(file: File, roots: Iterable<File>): File? =
roots.firstOrNull { FileUtil.isAncestor(it, file, false) }
private fun <Target> withSubtypes(
fun <Target> withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheImpl<Target>>
): Set<FqName> {

View File

@@ -16,17 +16,16 @@
package org.jetbrains.kotlin.incremental
import com.google.protobuf.MessageLite
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.Deserialization
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import org.jetbrains.kotlin.utils.HashSetUtil
import java.util.*
data class Difference(
@@ -133,7 +132,7 @@ private abstract class DifferenceCalculator() {
): Collection<String> {
val oldNames = oldList.map { compareObject.oldNameResolver.getString(it) }.toSet()
val newNames = newList.map { compareObject.newNameResolver.getString(it) }.toSet()
return HashSetUtil.symmetricDifference(oldNames, newNames)
return oldNames.union(newNames) - oldNames.intersect(newNames)
}
private fun MessageLite.getHashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {

View File

@@ -16,13 +16,10 @@
package org.jetbrains.kotlin.incremental.testingUtils
import com.google.common.collect.Sets
import com.google.common.hash.Hashing
import com.google.common.io.Files
import com.google.protobuf.ExtensionRegistry
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.protobuf.ExtensionRegistry
import org.jetbrains.kotlin.serialization.DebugProtoBuf
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf
@@ -36,6 +33,7 @@ import java.io.File
import java.io.PrintWriter
import java.io.StringWriter
import java.util.*
import java.util.zip.CRC32
import kotlin.comparisons.compareBy
// Set this to true if you want to dump all bytecode (test will fail in this case)
@@ -45,7 +43,7 @@ fun assertEqualDirectories(expected: File, actual: File, forgiveExtraFiles: Bool
val pathsInExpected = getAllRelativePaths(expected)
val pathsInActual = getAllRelativePaths(actual)
val commonPaths = Sets.intersection(pathsInExpected, pathsInActual)
val commonPaths = pathsInExpected.intersect(pathsInActual)
val changedPaths = commonPaths
.filter { DUMP_ALL || !Arrays.equals(File(expected, it).readBytes(), File(actual, it).readBytes()) }
.sorted()
@@ -71,7 +69,11 @@ fun assertEqualDirectories(expected: File, actual: File, forgiveExtraFiles: Bool
Assert.assertEquals(expectedString, actualString)
}
private fun File.hash() = Files.hash(this, Hashing.crc32())
private fun File.checksumString(): String {
val crc32 = CRC32()
crc32.update(this.readBytes())
return java.lang.Long.toHexString(crc32.value)
}
private fun getDirectoryString(dir: File, interestingPaths: List<String>): String {
val buf = StringBuilder()
@@ -93,7 +95,7 @@ private fun getDirectoryString(dir: File, interestingPaths: List<String>): Strin
}
}
else {
p.println(child.name, " ", child.hash())
p.println(child.name, " ", child.checksumString())
}
}

View File

@@ -6,7 +6,7 @@ package org.jetbrains.kotlin.serialization;
public final class DebugExtOptionsProtoBuf {
private DebugExtOptionsProtoBuf() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.fqNameIdInTable);
@@ -17,9 +17,9 @@ public final class DebugExtOptionsProtoBuf {
* <code>extend .google.protobuf.FieldOptions { ... }</code>
*/
public static final
com.google.protobuf.GeneratedMessage.GeneratedExtension<
com.google.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> skipInComparison = com.google.protobuf.GeneratedMessage
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> skipInComparison = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
@@ -28,9 +28,9 @@ public final class DebugExtOptionsProtoBuf {
* <code>extend .google.protobuf.FieldOptions { ... }</code>
*/
public static final
com.google.protobuf.GeneratedMessage.GeneratedExtension<
com.google.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> nameIdInTable = com.google.protobuf.GeneratedMessage
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> nameIdInTable = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
@@ -39,9 +39,9 @@ public final class DebugExtOptionsProtoBuf {
* <code>extend .google.protobuf.FieldOptions { ... }</code>
*/
public static final
com.google.protobuf.GeneratedMessage.GeneratedExtension<
com.google.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> fqNameIdInTable = com.google.protobuf.GeneratedMessage
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> fqNameIdInTable = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
@@ -50,18 +50,18 @@ public final class DebugExtOptionsProtoBuf {
* <code>extend .google.protobuf.FieldOptions { ... }</code>
*/
public static final
com.google.protobuf.GeneratedMessage.GeneratedExtension<
com.google.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> stringIdInTable = com.google.protobuf.GeneratedMessage
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.protobuf.DescriptorProtos.FieldOptions,
java.lang.Boolean> stringIdInTable = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static com.google.protobuf.Descriptors.FileDescriptor
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
@@ -74,26 +74,27 @@ public final class DebugExtOptionsProtoBuf {
":<\n\023fq_name_id_in_table\022\035.google.protobu" +
"f.FieldOptions\030\322\206\003 \001(\010:;\n\022string_id_in_t" +
"able\022\035.google.protobuf.FieldOptions\030\323\206\003 " +
"\001(\010B\034B\027DebugExtOptionsProtoBuf\210\001\000"
"\001(\010B\031B\027DebugExtOptionsProtoBuf"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
skipInComparison.internalInit(descriptor.getExtensions().get(0));
nameIdInTable.internalInit(descriptor.getExtensions().get(1));
fqNameIdInTable.internalInit(descriptor.getExtensions().get(2));
stringIdInTable.internalInit(descriptor.getExtensions().get(3));
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
com.google.protobuf.DescriptorProtos.getDescriptor(),
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.protobuf.DescriptorProtos.getDescriptor(),
}, assigner);
skipInComparison.internalInit(descriptor.getExtensions().get(0));
nameIdInTable.internalInit(descriptor.getExtensions().get(1));
fqNameIdInTable.internalInit(descriptor.getExtensions().get(2));
stringIdInTable.internalInit(descriptor.getExtensions().get(3));
org.jetbrains.kotlin.protobuf.DescriptorProtos.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}
}

View File

@@ -6,12 +6,12 @@ package org.jetbrains.kotlin.serialization.jvm;
public final class DebugJvmPackageTable {
private DebugJvmPackageTable() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
}
public interface PackageTableOrBuilder
extends com.google.protobuf.MessageOrBuilder {
public interface PackageTableOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.serialization.jvm.PackageTable)
org.jetbrains.kotlin.protobuf.MessageOrBuilder {
// repeated .org.jetbrains.kotlin.serialization.jvm.PackageParts package_parts = 1;
/**
* <code>repeated .org.jetbrains.kotlin.serialization.jvm.PackageParts package_parts = 1;</code>
*/
@@ -40,14 +40,15 @@ public final class DebugJvmPackageTable {
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageTable}
*/
public static final class PackageTable extends
com.google.protobuf.GeneratedMessage
implements PackageTableOrBuilder {
org.jetbrains.kotlin.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.serialization.jvm.PackageTable)
PackageTableOrBuilder {
// Use PackageTable.newBuilder() to construct.
private PackageTable(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
private PackageTable(org.jetbrains.kotlin.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private PackageTable(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private PackageTable(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final PackageTable defaultInstance;
public static PackageTable getDefaultInstance() {
@@ -58,20 +59,20 @@ public final class DebugJvmPackageTable {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
private final org.jetbrains.kotlin.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
public final org.jetbrains.kotlin.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private PackageTable(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
org.jetbrains.kotlin.protobuf.UnknownFieldSet.Builder unknownFields =
org.jetbrains.kotlin.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
@@ -97,10 +98,10 @@ public final class DebugJvmPackageTable {
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
@@ -110,34 +111,33 @@ public final class DebugJvmPackageTable {
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
public static final org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
protected org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable.class, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable.Builder.class);
}
public static com.google.protobuf.Parser<PackageTable> PARSER =
new com.google.protobuf.AbstractParser<PackageTable>() {
public static org.jetbrains.kotlin.protobuf.Parser<PackageTable> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<PackageTable>() {
public PackageTable parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new PackageTable(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<PackageTable> getParserForType() {
public org.jetbrains.kotlin.protobuf.Parser<PackageTable> getParserForType() {
return PARSER;
}
// repeated .org.jetbrains.kotlin.serialization.jvm.PackageParts package_parts = 1;
public static final int PACKAGE_PARTS_FIELD_NUMBER = 1;
private java.util.List<org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts> packageParts_;
/**
@@ -179,7 +179,8 @@ public final class DebugJvmPackageTable {
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getPackagePartsCount(); i++) {
if (!getPackageParts(i).isInitialized()) {
@@ -191,7 +192,7 @@ public final class DebugJvmPackageTable {
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < packageParts_.size(); i++) {
@@ -207,7 +208,7 @@ public final class DebugJvmPackageTable {
size = 0;
for (int i = 0; i < packageParts_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, packageParts_.get(i));
}
size += getUnknownFields().getSerializedSize();
@@ -223,24 +224,24 @@ public final class DebugJvmPackageTable {
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(java.io.InputStream input)
@@ -249,7 +250,7 @@ public final class DebugJvmPackageTable {
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
@@ -259,18 +260,18 @@ public final class DebugJvmPackageTable {
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(
com.google.protobuf.CodedInputStream input)
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
@@ -284,7 +285,7 @@ public final class DebugJvmPackageTable {
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
org.jetbrains.kotlin.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@@ -292,14 +293,15 @@ public final class DebugJvmPackageTable {
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageTable}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTableOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
org.jetbrains.kotlin.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.serialization.jvm.PackageTable)
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTableOrBuilder {
public static final org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
protected org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_fieldAccessorTable
.ensureFieldAccessorsInitialized(
@@ -312,12 +314,12 @@ public final class DebugJvmPackageTable {
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
org.jetbrains.kotlin.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
if (org.jetbrains.kotlin.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getPackagePartsFieldBuilder();
}
}
@@ -340,7 +342,7 @@ public final class DebugJvmPackageTable {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
public org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor;
}
@@ -373,7 +375,7 @@ public final class DebugJvmPackageTable {
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
public Builder mergeFrom(org.jetbrains.kotlin.protobuf.Message other) {
if (other instanceof org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable) {
return mergeFrom((org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable)other);
} else {
@@ -403,7 +405,7 @@ public final class DebugJvmPackageTable {
packageParts_ = other.packageParts_;
bitField0_ = (bitField0_ & ~0x00000001);
packagePartsBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
org.jetbrains.kotlin.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getPackagePartsFieldBuilder() : null;
} else {
packagePartsBuilder_.addAllMessages(other.packageParts_);
@@ -425,13 +427,13 @@ public final class DebugJvmPackageTable {
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageTable) e.getUnfinishedMessage();
throw e;
} finally {
@@ -443,7 +445,6 @@ public final class DebugJvmPackageTable {
}
private int bitField0_;
// repeated .org.jetbrains.kotlin.serialization.jvm.PackageParts package_parts = 1;
private java.util.List<org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts> packageParts_ =
java.util.Collections.emptyList();
private void ensurePackagePartsIsMutable() {
@@ -453,7 +454,7 @@ public final class DebugJvmPackageTable {
}
}
private com.google.protobuf.RepeatedFieldBuilder<
private org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts.Builder, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackagePartsOrBuilder> packagePartsBuilder_;
/**
@@ -585,7 +586,8 @@ public final class DebugJvmPackageTable {
java.lang.Iterable<? extends org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts> values) {
if (packagePartsBuilder_ == null) {
ensurePackagePartsIsMutable();
super.addAll(values, packageParts_);
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, packageParts_);
onChanged();
} else {
packagePartsBuilder_.addAllMessages(values);
@@ -668,11 +670,11 @@ public final class DebugJvmPackageTable {
getPackagePartsBuilderList() {
return getPackagePartsFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
private org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts.Builder, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackagePartsOrBuilder>
getPackagePartsFieldBuilder() {
if (packagePartsBuilder_ == null) {
packagePartsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
packagePartsBuilder_ = new org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts.Builder, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackagePartsOrBuilder>(
packageParts_,
((bitField0_ & 0x00000001) == 0x00000001),
@@ -694,10 +696,10 @@ public final class DebugJvmPackageTable {
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.jvm.PackageTable)
}
public interface PackagePartsOrBuilder
extends com.google.protobuf.MessageOrBuilder {
public interface PackagePartsOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.serialization.jvm.PackageParts)
org.jetbrains.kotlin.protobuf.MessageOrBuilder {
// required string package_fq_name = 1;
/**
* <code>required string package_fq_name = 1;</code>
*/
@@ -709,15 +711,14 @@ public final class DebugJvmPackageTable {
/**
* <code>required string package_fq_name = 1;</code>
*/
com.google.protobuf.ByteString
org.jetbrains.kotlin.protobuf.ByteString
getPackageFqNameBytes();
// repeated string class_name = 2;
/**
* <code>repeated string class_name = 2;</code>
*/
java.util.List<java.lang.String>
getClassNameList();
org.jetbrains.kotlin.protobuf.ProtocolStringList
getClassNameList();
/**
* <code>repeated string class_name = 2;</code>
*/
@@ -729,21 +730,22 @@ public final class DebugJvmPackageTable {
/**
* <code>repeated string class_name = 2;</code>
*/
com.google.protobuf.ByteString
org.jetbrains.kotlin.protobuf.ByteString
getClassNameBytes(int index);
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageParts}
*/
public static final class PackageParts extends
com.google.protobuf.GeneratedMessage
implements PackagePartsOrBuilder {
org.jetbrains.kotlin.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.serialization.jvm.PackageParts)
PackagePartsOrBuilder {
// Use PackageParts.newBuilder() to construct.
private PackageParts(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
private PackageParts(org.jetbrains.kotlin.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private PackageParts(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private PackageParts(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final PackageParts defaultInstance;
public static PackageParts getDefaultInstance() {
@@ -754,20 +756,20 @@ public final class DebugJvmPackageTable {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
private final org.jetbrains.kotlin.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
public final org.jetbrains.kotlin.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private PackageParts(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
org.jetbrains.kotlin.protobuf.UnknownFieldSet.Builder unknownFields =
org.jetbrains.kotlin.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
@@ -784,62 +786,63 @@ public final class DebugJvmPackageTable {
break;
}
case 10: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
packageFqName_ = input.readBytes();
packageFqName_ = bs;
break;
}
case 18: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
className_ = new com.google.protobuf.LazyStringArrayList();
className_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000002;
}
className_.add(input.readBytes());
className_.add(bs);
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
className_ = new com.google.protobuf.UnmodifiableLazyStringList(className_);
className_ = className_.getUnmodifiableView();
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
public static final org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
protected org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_fieldAccessorTable
.ensureFieldAccessorsInitialized(
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts.class, org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts.Builder.class);
}
public static com.google.protobuf.Parser<PackageParts> PARSER =
new com.google.protobuf.AbstractParser<PackageParts>() {
public static org.jetbrains.kotlin.protobuf.Parser<PackageParts> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<PackageParts>() {
public PackageParts parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new PackageParts(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<PackageParts> getParserForType() {
public org.jetbrains.kotlin.protobuf.Parser<PackageParts> getParserForType() {
return PARSER;
}
private int bitField0_;
// required string package_fq_name = 1;
public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 1;
private java.lang.Object packageFqName_;
/**
@@ -856,8 +859,8 @@ public final class DebugJvmPackageTable {
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
packageFqName_ = s;
@@ -868,27 +871,26 @@ public final class DebugJvmPackageTable {
/**
* <code>required string package_fq_name = 1;</code>
*/
public com.google.protobuf.ByteString
public org.jetbrains.kotlin.protobuf.ByteString
getPackageFqNameBytes() {
java.lang.Object ref = packageFqName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
packageFqName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
}
// repeated string class_name = 2;
public static final int CLASS_NAME_FIELD_NUMBER = 2;
private com.google.protobuf.LazyStringList className_;
private org.jetbrains.kotlin.protobuf.LazyStringList className_;
/**
* <code>repeated string class_name = 2;</code>
*/
public java.util.List<java.lang.String>
public org.jetbrains.kotlin.protobuf.ProtocolStringList
getClassNameList() {
return className_;
}
@@ -907,19 +909,20 @@ public final class DebugJvmPackageTable {
/**
* <code>repeated string class_name = 2;</code>
*/
public com.google.protobuf.ByteString
public org.jetbrains.kotlin.protobuf.ByteString
getClassNameBytes(int index) {
return className_.getByteString(index);
}
private void initFields() {
packageFqName_ = "";
className_ = com.google.protobuf.LazyStringArrayList.EMPTY;
className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasPackageFqName()) {
memoizedIsInitialized = 0;
@@ -929,7 +932,7 @@ public final class DebugJvmPackageTable {
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
@@ -948,13 +951,13 @@ public final class DebugJvmPackageTable {
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSize(1, getPackageFqNameBytes());
}
{
int dataSize = 0;
for (int i = 0; i < className_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSizeNoTag(className_.getByteString(i));
}
size += dataSize;
@@ -973,24 +976,24 @@ public final class DebugJvmPackageTable {
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(java.io.InputStream input)
@@ -999,7 +1002,7 @@ public final class DebugJvmPackageTable {
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
@@ -1009,18 +1012,18 @@ public final class DebugJvmPackageTable {
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(
com.google.protobuf.CodedInputStream input)
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
@@ -1034,7 +1037,7 @@ public final class DebugJvmPackageTable {
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
org.jetbrains.kotlin.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@@ -1042,14 +1045,15 @@ public final class DebugJvmPackageTable {
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageParts}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackagePartsOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
org.jetbrains.kotlin.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.serialization.jvm.PackageParts)
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackagePartsOrBuilder {
public static final org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
getDescriptor() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
protected org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_fieldAccessorTable
.ensureFieldAccessorsInitialized(
@@ -1062,12 +1066,12 @@ public final class DebugJvmPackageTable {
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
org.jetbrains.kotlin.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
if (org.jetbrains.kotlin.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
@@ -1078,7 +1082,7 @@ public final class DebugJvmPackageTable {
super.clear();
packageFqName_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
className_ = com.google.protobuf.LazyStringArrayList.EMPTY;
className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
@@ -1087,7 +1091,7 @@ public final class DebugJvmPackageTable {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
public org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor;
}
@@ -1113,8 +1117,7 @@ public final class DebugJvmPackageTable {
}
result.packageFqName_ = packageFqName_;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
className_ = new com.google.protobuf.UnmodifiableLazyStringList(
className_);
className_ = className_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000002);
}
result.className_ = className_;
@@ -1123,7 +1126,7 @@ public final class DebugJvmPackageTable {
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
public Builder mergeFrom(org.jetbrains.kotlin.protobuf.Message other) {
if (other instanceof org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts) {
return mergeFrom((org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts)other);
} else {
@@ -1162,13 +1165,13 @@ public final class DebugJvmPackageTable {
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts) e.getUnfinishedMessage();
throw e;
} finally {
@@ -1180,7 +1183,6 @@ public final class DebugJvmPackageTable {
}
private int bitField0_;
// required string package_fq_name = 1;
private java.lang.Object packageFqName_ = "";
/**
* <code>required string package_fq_name = 1;</code>
@@ -1194,9 +1196,12 @@ public final class DebugJvmPackageTable {
public java.lang.String getPackageFqName() {
java.lang.Object ref = packageFqName_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
packageFqName_ = s;
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
packageFqName_ = s;
}
return s;
} else {
return (java.lang.String) ref;
@@ -1205,17 +1210,17 @@ public final class DebugJvmPackageTable {
/**
* <code>required string package_fq_name = 1;</code>
*/
public com.google.protobuf.ByteString
public org.jetbrains.kotlin.protobuf.ByteString
getPackageFqNameBytes() {
java.lang.Object ref = packageFqName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
packageFqName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
}
/**
@@ -1244,7 +1249,7 @@ public final class DebugJvmPackageTable {
* <code>required string package_fq_name = 1;</code>
*/
public Builder setPackageFqNameBytes(
com.google.protobuf.ByteString value) {
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
@@ -1254,20 +1259,19 @@ public final class DebugJvmPackageTable {
return this;
}
// repeated string class_name = 2;
private com.google.protobuf.LazyStringList className_ = com.google.protobuf.LazyStringArrayList.EMPTY;
private org.jetbrains.kotlin.protobuf.LazyStringList className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
private void ensureClassNameIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
className_ = new com.google.protobuf.LazyStringArrayList(className_);
className_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(className_);
bitField0_ |= 0x00000002;
}
}
/**
* <code>repeated string class_name = 2;</code>
*/
public java.util.List<java.lang.String>
public org.jetbrains.kotlin.protobuf.ProtocolStringList
getClassNameList() {
return java.util.Collections.unmodifiableList(className_);
return className_.getUnmodifiableView();
}
/**
* <code>repeated string class_name = 2;</code>
@@ -1284,7 +1288,7 @@ public final class DebugJvmPackageTable {
/**
* <code>repeated string class_name = 2;</code>
*/
public com.google.protobuf.ByteString
public org.jetbrains.kotlin.protobuf.ByteString
getClassNameBytes(int index) {
return className_.getByteString(index);
}
@@ -1320,7 +1324,8 @@ public final class DebugJvmPackageTable {
public Builder addAllClassName(
java.lang.Iterable<java.lang.String> values) {
ensureClassNameIsMutable();
super.addAll(values, className_);
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, className_);
onChanged();
return this;
}
@@ -1328,7 +1333,7 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*/
public Builder clearClassName() {
className_ = com.google.protobuf.LazyStringArrayList.EMPTY;
className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
@@ -1337,7 +1342,7 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*/
public Builder addClassNameBytes(
com.google.protobuf.ByteString value) {
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
@@ -1358,22 +1363,22 @@ public final class DebugJvmPackageTable {
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.jvm.PackageParts)
}
private static com.google.protobuf.Descriptors.Descriptor
private static final org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
private static final org.jetbrains.kotlin.protobuf.Descriptors.Descriptor
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
@@ -1386,31 +1391,31 @@ public final class DebugJvmPackageTable {
"\nclass_name\030\002 \003(\tB\026B\024DebugJvmPackageTabl" +
"e"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor,
new java.lang.String[] { "PackageParts", });
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor,
new java.lang.String[] { "PackageFqName", "ClassName", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor,
new java.lang.String[] { "PackageParts", });
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor,
new java.lang.String[] { "PackageFqName", "ClassName", });
}
// @@protoc_insertion_point(outer_class_scope)
}
}

170
build.xml
View File

@@ -24,8 +24,8 @@
<property name="build.number" value="snapshot"/>
<property name="bootstrap.build.no.tests" value="false"/>
<property name="idea.sdk" value="${basedir}/ideaSDK"/>
<property name="protobuf.jar" value="${idea.sdk}/lib/protobuf-2.5.0.jar"/>
<property name="protobuf-lite.jar" value="${basedir}/dependencies/protobuf-2.5.0-lite.jar"/>
<property name="protobuf.jar" value="${basedir}/dependencies/protobuf-2.6.1.jar"/>
<property name="protobuf-lite.jar" value="${basedir}/dependencies/protobuf-2.6.1-lite.jar"/>
<property name="javax.inject.jar" value="${basedir}/lib/javax.inject.jar"/>
<property name="java.target" value="1.6"/>
@@ -43,6 +43,10 @@
<include file="jslib_files.xml" />
<property name="compiled.stdlib.js" value="stdlib.js"/>
<property name="compiled.stdlib.meta.js" value="kotlin.meta.js"/>
<property name="stdlib.js.dir" value="${basedir}/js/js.translator/testData"/>
<!--
The compiler produced on the first step of the build (Bootstrap No Tests) is only guaranteed to work against the OLD runtime
located in dependencies/bootstrap-compiler/.../kotlin-runtime.jar, because the newly built compiler is just a Kotlin application,
@@ -319,46 +323,28 @@
<arg value="-meta-info"/>
<arg value="-kjsm"/>
<arg line="-main noCall"/>
<arg line="-module-kind commonjs"/>
</java>
</sequential>
</macrodef>
<target name="js-stdlib">
<property name="compiled.builtins.js" value="builtins.js"/>
<property name="compiled.builtins.meta.js" value="builtins.meta.js"/>
<property name="compiled.stdlib.js" value="stdlib.js"/>
<property name="compiled.stdlib.meta.js" value="stdlib.meta.js"/>
<property name="stdlib.js.dir" value="${basedir}/js/js.translator/testData"/>
<kotlin-pp src="libraries/stdlib/src" output="${intermediate-sources}/stdlib/js" profile="JS" />
<new-kotlin2js output="${js.stdlib.output.dir}/${compiled.builtins.js}">
<src>
<fileset refid="kotlin.builtin.files"/>
</src>
</new-kotlin2js>
<new-kotlin2js output="${js.stdlib.output.dir}/${compiled.stdlib.js}">
<src>
<resources refid="js.lib.files"/>
</src>
</new-kotlin2js>
<taskdef name="closure-compiler"
classname="com.google.javascript.jscomp.ant.CompileTask"
classpath="${dependencies.dir}/closure-compiler.jar"/>
<target name="js-stdlib-merge">
<!-- value should be one of: whitespace, simple, advanced -->
<property name="compilationLevel" value="whitespace"/>
<!-- value should be one of: default, quiet, verbose -->
<property name="warningLevel" value="default"/>
<taskdef name="closure-compiler"
classname="com.google.javascript.jscomp.ant.CompileTask"
classpath="${dependencies.dir}/closure-compiler.jar"/>
<closure-compiler
compilationLevel="${compilationLevel}"
prettyprint="true"
languagein="ECMASCRIPT5_STRICT"
warning="${warningLevel}"
output="${js.stdlib.output.dir}/kotlin.js">
output="${js.stdlib.output.dir}/kotlin.js"
outputWrapperFile="${stdlib.js.dir}/closure-wrapper.txt">
<sources dir="${stdlib.js.dir}">
<file name="kotlin_lib_ecma5.js"/>
@@ -367,29 +353,60 @@
<file name="long.js"/>
</sources>
<sources dir="${js.stdlib.output.dir}">
<file name="${compiled.builtins.js}"/>
</sources>
<sources dir="${js.stdlib.output.dir}">
<file name="${compiled.stdlib.js}"/>
</sources>
<sources dir="${stdlib.js.dir}">
<file name="export_Kotlin_if_possible.js"/>
<file name="merge.js"/>
</sources>
<externs dir="${stdlib.js.dir}">
<file name="externs.js"/>
</externs>
</closure-compiler>
</target>
<target name="js-stdlib">
<property environment="env"/>
<kotlin-pp src="libraries/stdlib/src" output="${intermediate-sources}/stdlib/js" profile="JS" />
<new-kotlin2js output="${js.stdlib.output.dir}/tmp/kotlin.js">
<src>
<union>
<fileset refid="kotlin.builtin.files"/>
<resources refid="js.lib.files"/>
</union>
</src>
</new-kotlin2js>
<move file="${js.stdlib.output.dir}/tmp/kotlin.js" tofile="${js.stdlib.output.dir}/${compiled.stdlib.js}" />
<move file="${js.stdlib.output.dir}/tmp/kotlin" todir="${js.stdlib.output.dir}" />
<move file="${js.stdlib.output.dir}/tmp/${compiled.stdlib.meta.js}" tofile="${js.stdlib.output.dir}/${compiled.stdlib.meta.js}" />
<condition property="jdk17" value="${env.JDK_17}" else="${env.JAVA_HOME}">
<isset property="env.JDK_17" />
</condition>
<java classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
timeout="4000000"
taskname="startAnt"
jvm="${jdk17}/bin/java">
<env key="JAVA_HOME" value="${jdk17}"/>
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
</classpath>
<arg line="-f" />
<arg line="build.xml" />
<arg line="js-stdlib-merge" />
</java>
<jar jarfile="${kotlin-home}/lib/kotlin-jslib.jar" duplicate="fail">
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
<zipfileset dir="${js.stdlib.output.dir}" prefix="">
<include name="kotlin.js"/>
<include name="${compiled.stdlib.meta.js}"/>
<include name="stdlib/**"/>
<include name="kotlin/**"/>
</zipfileset>
<manifest>
@@ -489,6 +506,13 @@
<attribute name="compress" default="true"/>
<sequential>
<local name="idea.core.uberjar.exists"/>
<available file="${dependencies.dir}/idea/idea-core-all.jar" property="idea.core.uberjar.exists"/>
<!-- TODO: move this jar creation to update_dependencies.xml eventually -->
<jar jarfile="${dependencies.dir}/idea/idea-core-all.jar" unless:true="${idea.core.uberjar.exists}">
<zipgroupfileset dir="${idea.sdk}/core" includes="*.jar" excludes="util.jar"/>
</jar>
<jar jarfile="@{jarfile}" compress="@{compress}" duplicate="preserve">
<fileset dir="${output}/classes/compiler"/>
<fileset dir="${output}/builtins">
@@ -507,7 +531,7 @@
</fileset>
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar" excludes="util.jar"/>
<zipfileset src="${dependencies.dir}/idea/idea-core-all.jar" excludes="META-INF/INDEX.LIST"/>
<zipfileset src="${idea.sdk}/lib/jna-platform.jar"/>
<zipfileset src="${idea.sdk}/lib/oromatcher.jar"/>
<zipfileset src="${idea.sdk}/jps/jps-model.jar"/>
@@ -655,38 +679,40 @@
</jar>
</target>
<target name="kotlin-build-common-test" depends="kotlin-build-common,kotlin-test">
<target name="kotlin-build-common-test">
<cleandir dir="${output}/classes/kotlin-build-common-test"/>
<javac2 destdir="${output}/classes/kotlin-build-common-test" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<withKotlin modulename="kotlin-build-common"/>
<skip pattern="kotlin/jvm/internal/.*"/>
<skip pattern="kotlin/Metadata"/>
<src path="build-common/test"/>
<classpath>
<pathelement path="${bootstrap.runtime}"/>
<pathelement path="${bootstrap.reflect}"/>
<pathelement path="${bootstrap.kotlin.test}"/>
<pathelement path="${protobuf.jar}"/>
<pathelement path="${idea.sdk}/lib/junit-4.12.jar"/>
<pathelement path="${idea.sdk}/lib/guava-17.0.jar"/>
<pathelement path="${kotlin-home}/lib/kotlin-build-common.jar"/>
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
<pathelement path="${protobuf.jar}"/>
</classpath>
</javac2>
<jar destfile="${kotlin-home}/lib/kotlin-build-common-test.jar">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="dependencies/jarjar.jar"/>
<jarjar jarfile="${kotlin-home}/lib/kotlin-build-common-test.jar">
<fileset dir="${output}/classes/kotlin-build-common-test"/>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
<zipfileset src="${protobuf.jar}"/>
<rule pattern="com.intellij.**" result="org.jetbrains.kotlin.com.intellij.@1"/>
<manifest>
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.build.common}"/>
<attribute name="Implementation-Version" value="${build.number}"/>
</manifest>
</jar>
</jarjar>
</target>
<target name="daemon-client">
@@ -697,8 +723,6 @@
<pathelement path="compiler/daemon/daemon-client/src"/>
</src>
<classpath>
<pathelement path="${bootstrap.runtime}"/>
<pathelement path="${bootstrap.reflect}"/>
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
<pathelement path="${dependencies.dir}/native-platform-uberjar.jar"/>
</classpath>
@@ -732,8 +756,6 @@
<classpath>
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
<pathelement path="${bootstrap.runtime}"/>
<pathelement path="${bootstrap.reflect}"/>
</classpath>
</javac2>
@@ -743,6 +765,55 @@
<fileset dir="${basedir}/plugins/android-extensions/android-extensions-compiler/src" includes="META-INF/services/**"/>
</jar>
</target>
<target name="annotation-processing-under-jdk8">
<property environment="env"/>
<condition property="jdk18" value="${env.JDK_18}" else="${env.JAVA_HOME}">
<isset property="env.JDK_18" />
</condition>
<java classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="true"
timeout="4000000"
taskname="startAnt"
jvm="${jdk18}/bin/java">
<env key="JAVA_HOME" value="${jdk18}"/>
<classpath>
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
</classpath>
<arg line="-f" />
<arg line="build.xml" />
<arg line="annotation-processing" />
</java>
</target>
<target name="annotation-processing">
<cleandir dir="${output}/classes/annotation-processing"/>
<javac2 destdir="${output}/classes/annotation-processing" debug="true" debuglevel="lines,vars,source"
includeAntRuntime="false" source="${java.target}" target="${java.target}">
<withKotlin modulename="annotation-processing">
<compilerarg value="-version"/>
</withKotlin>
<skip pattern="kotlin/Metadata"/>
<src>
<pathelement path="plugins/annotation-processing/src"/>
<pathelement path="plugins/java-model-wrappers/src"/>
</src>
<classpath>
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
<pathelement path="${bootstrap.runtime}"/>
<pathelement path="${bootstrap.reflect}"/>
</classpath>
</javac2>
<jar destfile="${kotlin-home}/lib/kotlin-annotation-processing.jar">
<fileset dir="${output}/classes/annotation-processing"/>
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
<fileset dir="${basedir}/plugins/annotation-processing/src" includes="META-INF/services/**"/>
</jar>
</target>
<target name="ant-tools">
<cleandir dir="${output}/classes/ant"/>
@@ -759,8 +830,6 @@
</src>
<compilerarg value="-Xlint:all"/>
<classpath>
<file file="${bootstrap.runtime}"/>
<file file="${bootstrap.reflect}"/>
<pathelement location="${dependencies.dir}/ant-1.8/lib/ant.jar"/>
<pathelement location="${kotlin-home}/lib/kotlin-preloader.jar"/>
</classpath>
@@ -998,7 +1067,6 @@
<jarjar jarfile="${output}/kotlin-reflect-jarjar.jar" filesonly="true" filesetmanifest="merge">
<zipfileset src="${output}/kotlin-reflect-before-jarjar.jar"/>
<rule pattern="org.jetbrains.kotlin.**" result="kotlin.reflect.jvm.internal.impl.@1"/>
<rule pattern="com.google.protobuf.**" result="kotlin.reflect.jvm.internal.impl.com.google.protobuf.@1"/>
<rule pattern="javax.inject.**" result="kotlin.reflect.jvm.internal.impl.javax.inject.@1"/>
</jarjar>
@@ -1074,11 +1142,11 @@
depends="builtins,stdlib,kotlin-test,core,reflection,pack-runtime,pack-runtime-sources,mock-runtime-for-test"/>
<target name="dist"
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,kotlin-build-common,ant-tools,runtime,kotlin-js-stdlib,android-extensions-compiler,daemon-client,kotlin-build-common-test"
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,kotlin-build-common,ant-tools,runtime,kotlin-js-stdlib,android-extensions-compiler,annotation-processing-under-jdk8,daemon-client,kotlin-build-common-test"
description="Builds redistributables from sources"/>
<target name="dist-quick"
depends="clean,init,prepare-dist,preloader,serialize-builtins,compiler-quick,ant-tools,runtime,kotlin-js-stdlib,android-extensions-compiler"
depends="clean,init,prepare-dist,preloader,serialize-builtins,compiler-quick,ant-tools,runtime,kotlin-js-stdlib,android-extensions-compiler,annotation-processing-under-jdk8"
description="Builds everything, but classes are reused from project out dir, doesn't run proguard and javadoc"/>
<target name="dist-quick-compiler-only"

View File

@@ -1,43 +1,6 @@
<?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" />
<module version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
</module>

View File

@@ -0,0 +1,74 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 19
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "org.jetbrains.kotlin.android.tests"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
testApplicationId "org.jetbrains.kotlin.android.tests.gradle"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java {
srcDirs = ['src']
}
res.srcDirs = ['res']
}
androidTest {
java {
srcDirs = ['src']
}
}
}
packagingOptions { exclude 'META-INF/build.txt' }
//TODO run under java 6, cause there is error on implicit 'stream' import in 'asWithMutable' test
lintOptions {
abortOnError false
}
compileOptions {
incremental = false
}
dexOptions {
dexInProcess false
javaMaxHeapSize "600m"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
}

View File

@@ -8,5 +8,5 @@
# For customization when using a Version Control System, please read the
# header note.
#sdk.dir=compiler/android-tests/android-module/android-sdk/android-sdk-windows
#sdk.dir.relative=android-sdk/android-sdk-windows
sdk.dir=../../../android.tests.dependencies/android-sdk

View File

@@ -22,11 +22,8 @@ import java.lang.reflect.Method;
public class AbstractCodegenTestCaseOnAndroid extends TestCase {
protected void invokeBoxMethod(String filePath, String expectedResult) throws Exception {
protected void invokeBoxMethod(Class clazz, String filePath, String expectedResult) throws Exception {
try {
String simpelName = filePath.substring(filePath.lastIndexOf("/") + 1);
String packageName = filePath.replaceAll("\\\\|-|\\.|/", "_");
Class clazz = Class.forName(packageName + "." + getPackageClassName(simpelName));
Method method = clazz.getMethod("box");
assertEquals(expectedResult, method.invoke(null));
}
@@ -34,8 +31,4 @@ public class AbstractCodegenTestCaseOnAndroid extends TestCase {
throw new RuntimeException("File: " + filePath, e);
}
}
public static String getPackageClassName(String fileName) {
return Character.toUpperCase(fileName.charAt(0)) + fileName.substring(1).replaceAll("\\.kt", "Kt");
}
}

View File

@@ -16,5 +16,6 @@
<orderEntry type="library" name="idea-full" level="project" />
<orderEntry type="module" module-name="util" />
<orderEntry type="module" module-name="descriptor.loader.java" scope="TEST" />
<orderEntry type="module" module-name="frontend.java" scope="TEST" />
</component>
</module>

View File

@@ -19,25 +19,27 @@ package org.jetbrains.kotlin.android.tests;
import com.intellij.util.PlatformUtils;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.android.tests.ant.AntRunner;
import org.jetbrains.kotlin.android.tests.download.SDKDownloader;
import org.jetbrains.kotlin.android.tests.emulator.Emulator;
import org.jetbrains.kotlin.android.tests.gradle.GradleRunner;
import org.jetbrains.kotlin.android.tests.run.PermissionManager;
import org.junit.Assert;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class CodegenTestsOnAndroidRunner {
private static final Pattern ERROR_IN_TEST_OUTPUT_PATTERN =
Pattern.compile("([\\s]+at .*| Caused .*| java.lang.RuntimeException: File: .*|[\\s]+\\.\\.\\. .* more| Error in .*)");
private static final Pattern NUMBER_OF_TESTS_IF_FAILED = Pattern.compile("Tests run: ([0-9]*), Failures: ([0-9]*), Errors: ([0-9]*)");
private static final Pattern NUMBER_OF_TESTS_OK = Pattern.compile(" OK \\(([0-9]*) tests\\)");
private final PathManager pathManager;
@@ -53,123 +55,22 @@ public class CodegenTestsOnAndroidRunner {
TestSuite suite = new TestSuite("MySuite");
String resultOutput = runTests();
if (resultOutput == null) return suite;
//Fix problem with exception parsing cause 'at' pattern
resultOutput = resultOutput.replaceAll("\\[checkenv\\] Installed at", "[checkenv] Installed_at");
// Test name -> stackTrace
Map<String, String> resultMap = parseOutputForFailedTests(resultOutput);
final Statistics statistics;
// If map is empty => there are no failed tests
if (resultMap.isEmpty()) {
statistics = parseOutputForTestsNumberIfTestsPassed(resultOutput);
String reportFolder = pathManager.getTmpFolder() + "/build/outputs/androidTest-results/connected";
try {
List<TestCase> testCases = parseSingleReportInFolder(reportFolder);
for (TestCase aCase : testCases) {
suite.addTest(aCase);
}
Assert.assertNotEquals("There is no test results in report", 0, testCases.size());
}
else {
statistics = parseOutputForTestsNumberIfThereIsFailedTests(resultOutput);
for (final Map.Entry<String, String> entry : resultMap.entrySet()) {
suite.addTest(new TestCase("run") {
@Override
public String getName() {
return entry.getKey();
}
@Override
protected void runTest() throws Throwable {
Assert.fail(entry.getValue() + "See more information in log above.");
}
});
}
catch (Exception e) {
throw new RuntimeException("Can't parse test results in " + reportFolder +"\n" + resultOutput);
}
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);
suite.addTest(new TestCase("run") {
@Override
public String getName() {
return "testAll: Total: " + statistics.total + ", Failures: " + statistics.failed + ", Errors: " + statistics.errors;
}
@Override
protected void runTest() throws Throwable {
Assert.assertTrue(true);
}
});
return suite;
}
/*
Output example:
[exec] Error in testKt344:
[exec] java.lang.RuntimeException: File: compiler\testData\codegen\box\regressions\kt344.kt
[exec] at org.jetbrains.kotlin.android.tests.AbstractCodegenTestCaseOnAndroid.invokeBoxMethod(AbstractCodegenTestCaseOnAndroid.java:38)
[exec] at org.jetbrains.kotlin.android.tests.CodegenTestCaseOnAndroid.testKt344(CodegenTestCaseOnAndroid.java:595)
[exec] at java.lang.reflect.Method.invokeNative(Native Method)
[exec] at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
[exec] Caused by: java.lang.reflect.InvocationTargetException
[exec] at java.lang.reflect.Method.invokeNative(Native Method)
[exec] at org.jetbrains.kotlin.android.tests.AbstractCodegenTestCaseOnAndroid.invokeBoxMethod(AbstractCodegenTestCaseOnAndroid.java:35)
[exec] ... 13 more
[exec] Caused by: java.lang.VerifyError: compiler_testData_codegen_box_regressions_kt344_kt.Compiler_testData_codegen_box_regressions_kt344_ktPackage$t6$foo$1
[exec] at compiler_testData_codegen_box_regressions_kt344_kt.Compiler_testData_codegen_box_regressions_kt344_ktPackage.t6(dummy.kt:94)
[exec] at compiler_testData_codegen_box_regressions_kt344_kt.Compiler_testData_codegen_box_regressions_kt344_ktPackage.box(dummy.kt:185)
[exec] ... 16 more
[exec] ...............
[exec] Error in testKt529:
*/
private static Map<String, String> parseOutputForFailedTests(@NotNull String output) {
Map<String, String> result = new HashMap<String, String>();
StringBuilder builder = new StringBuilder();
String failedTestNamePrefix = " Error in ";
String lastFailedTestName = "";
Matcher matcher = ERROR_IN_TEST_OUTPUT_PATTERN.matcher(output);
while (matcher.find()) {
String groupValue = matcher.group();
if (groupValue.startsWith(failedTestNamePrefix)) {
if (builder.length() > 0) {
result.put(lastFailedTestName, builder.toString());
builder.delete(0, builder.length());
}
lastFailedTestName = groupValue.substring(failedTestNamePrefix.length());
}
builder.append(groupValue);
builder.append("\n");
}
if (builder.length() > 0) {
result.put(lastFailedTestName, builder.toString());
}
return result;
}
//[exec] Tests run: 225, Failures: 0, Errors: 2
@Nullable
private static Statistics parseOutputForTestsNumberIfThereIsFailedTests(String output) {
Matcher matcher = NUMBER_OF_TESTS_IF_FAILED.matcher(output);
if (matcher.find()) {
return new Statistics(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)),
Integer.parseInt(matcher.group(3)));
}
return null;
}
//[exec] OK (223 tests)
@Nullable
private static Statistics parseOutputForTestsNumberIfTestsPassed(String output) {
Matcher matcher = NUMBER_OF_TESTS_OK.matcher(output);
if (matcher.find()) {
return new Statistics(Integer.parseInt(matcher.group(1)), 0, 0);
}
return null;
}
@Nullable
public String runTests() {
File rootForAndroidDependencies = new File(pathManager.getDependenciesRoot());
@@ -178,27 +79,27 @@ public class CodegenTestsOnAndroidRunner {
}
SDKDownloader downloader = new SDKDownloader(pathManager);
Emulator emulator = new Emulator(pathManager, Emulator.ARM);
AntRunner antRunner = new AntRunner(pathManager);
downloader.downloadAll();
downloader.unzipAll();
PermissionManager.setPermissions(pathManager);
AntRunner antRunner = new AntRunner(pathManager);
antRunner.packLibraries();
Emulator emulator = new Emulator(pathManager, Emulator.ARM);
GradleRunner gradleRunner = new GradleRunner(pathManager);
gradleRunner.clean();
gradleRunner.build();
emulator.createEmulator();
String platformPrefixProperty = System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, "Idea");
try {
PermissionManager.setPermissions(pathManager);
antRunner.packLibraries();
emulator.createEmulator();
emulator.startEmulator();
try {
emulator.waitEmulatorStart();
antRunner.cleanOutput();
antRunner.compileSources();
antRunner.installApplicationOnEmulator();
return antRunner.runTestsOnEmulator();
//runTestsViaAdb(emulator, gradleRunner);
return gradleRunner.connectedDebugAndroidTest();
}
catch (RuntimeException e) {
e.printStackTrace();
@@ -223,15 +124,55 @@ public class CodegenTestsOnAndroidRunner {
}
}
private static class Statistics {
public final int total;
public final int errors;
public final int failed;
private String runTestsViaAdb(Emulator emulator, GradleRunner gradleRunner) {
gradleRunner.installDebugAndroidTest();
String result = emulator.runTestsViaAdb();
System.out.println(result);
gradleRunner.uninstallDebugAndroidTest();
return result;
}
private Statistics(int total, int failed, int errors) {
this.total = total;
this.failed = failed;
this.errors = errors;
private static List<TestCase> parseSingleReportInFolder(String reportFolder) throws
IOException,
SAXException,
ParserConfigurationException {
File folder = new File(reportFolder);
File[] files = folder.listFiles();
assert files != null;
assert files.length == 1;
File reportFile = files[0];
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(reportFile);
Element root = doc.getDocumentElement();
NodeList testCases = root.getElementsByTagName("testcase");
List<TestCase> result = new ArrayList(testCases.getLength());
for (int i = 0; i < testCases.getLength(); i++) {
Element item = (Element) testCases.item(i);
final NodeList failure = item.getElementsByTagName("failure");
String name = item.getAttribute("name");
String clazz = item.getAttribute("classname");
if (failure.getLength() == 0) {
result.add(new TestCase(name) {
@Override
protected void runTest() throws Throwable {
}
});
}
else {
result.add(new TestCase(name) {
@Override
protected void runTest() throws Throwable {
Assert.fail(failure.item(0).getTextContent());
}
});
}
}
return result;
}
}

View File

@@ -74,6 +74,10 @@ public class PathManager {
return rootFolder + "/android.tests.dependencies";
}
public String getGradleBinFolder() {
return getDependenciesRoot() + "/gradle-2.12/bin";
}
public String getRootForDownload() {
return getDependenciesRoot() + "/download";
}

View File

@@ -34,13 +34,15 @@ public class SDKDownloader {
private final String platformToolsZipPath;
private final String skdToolsZipPath;
private final String buildToolsZipPath;
private final String gradleZipPath;
private final PathManager pathManager;
private static final String PLATFORM_TOOLS = "23.1.0";
//NOTE: PLATFORM_TOOLS 23.1.0 requires only 64 bit build agents
private static final String PLATFORM_TOOLS = "23.0.1";
private static final String SDK_TOOLS = "25.1.1";
public static final String BUILD_TOOLS = "23.0.3";
private static final int ANDROID_VERSION = 16;
private static final int ANDROID_VERSION = 19;
public SDKDownloader(PathManager pathManager) {
@@ -51,27 +53,32 @@ public class SDKDownloader {
platformToolsZipPath = pathManager.getRootForDownload() + "/platform-tools.zip";
skdToolsZipPath = pathManager.getRootForDownload() + "/tools.zip";
buildToolsZipPath = pathManager.getRootForDownload() + "/build-tools.zip";
gradleZipPath = pathManager.getRootForDownload() + "/gradle.zip";
}
public void downloadPlatform() {
download("http://dl-ssl.google.com/android/repository/android-" + ANDROID_VERSION + "_r05.zip", platformZipPath); //Same for all platforms
download("https://dl-ssl.google.com/android/repository/android-" + ANDROID_VERSION + "_r04.zip", platformZipPath); //Same for all platforms
}
private void downloadAbi() {
download("http://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-" + ANDROID_VERSION + "_r04.zip", armImage); //Same for all platforms
download("https://dl.google.com/android/repository/sys-img/android/sysimg_x86-" + ANDROID_VERSION + "_r02.zip", x86Image); //Same for all platforms
download("https://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-" + ANDROID_VERSION + "_r03.zip", armImage); //Same for all platforms
download("https://dl.google.com/android/repository/sys-img/android/sysimg_x86-" + ANDROID_VERSION + "_r03.zip", x86Image); //Same for all platforms
}
public void downloadPlatformTools() {
download(getDownloadUrl("http://dl-ssl.google.com/android/repository/platform-tools_r" + PLATFORM_TOOLS), platformToolsZipPath);
download(getDownloadUrl("https://dl-ssl.google.com/android/repository/platform-tools_r" + PLATFORM_TOOLS), platformToolsZipPath);
}
public void downloadSdkTools() {
download(getDownloadUrl("http://dl.google.com/android/repository/tools_r" + SDK_TOOLS), skdToolsZipPath);
download(getDownloadUrl("https://dl.google.com/android/repository/tools_r" + SDK_TOOLS), skdToolsZipPath);
}
public void downloadBuildTools() {
download(getDownloadUrl("http://dl.google.com/android/repository/build-tools_r" + BUILD_TOOLS), buildToolsZipPath);
download(getDownloadUrl("https://dl.google.com/android/repository/build-tools_r" + BUILD_TOOLS), buildToolsZipPath);
}
public void downloadGradle() {
download("https://services.gradle.org/distributions/gradle-2.12-bin.zip", gradleZipPath);
}
private static String getDownloadUrl(String prefix) {
@@ -97,17 +104,23 @@ public class SDKDownloader {
downloadPlatform();
downloadPlatformTools();
downloadBuildTools();
downloadGradle();
}
public void unzipAll() {
String androidSdkRoot = pathManager.getAndroidSdkRoot();
unzip(platformZipPath, pathManager.getPlatformFolderInAndroidSdk());
unzip(armImage, androidSdkRoot + "/system-images/android-" + ANDROID_VERSION + "/");
unzip(x86Image, androidSdkRoot + "/system-images/android-" + ANDROID_VERSION + "/");
new File(pathManager.getPlatformFolderInAndroidSdk() + "/android-4.4.2").renameTo(new File(pathManager.getPlatformFolderInAndroidSdk() + "/android-" + ANDROID_VERSION));
unzip(armImage, androidSdkRoot + "/system-images/android-" + ANDROID_VERSION + "/default/");
unzip(x86Image, androidSdkRoot + "/system-images/android-" + ANDROID_VERSION + "/default/");
unzip(platformToolsZipPath, androidSdkRoot);
unzip(skdToolsZipPath, androidSdkRoot);
unzip(gradleZipPath, pathManager.getDependenciesRoot());
//BUILD TOOLS
String buildTools = androidSdkRoot + "/build-tools/";
String buildToolsFolder = buildTools + BUILD_TOOLS + "/";
@@ -123,6 +136,7 @@ public class SDKDownloader {
delete(buildToolsZipPath);
delete(armImage);
delete(x86Image);
delete(gradleZipPath);
}
private static void download(String urlString, String output) {

View File

@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.android.tests.OutputUtils;
import org.jetbrains.kotlin.android.tests.PathManager;
import org.jetbrains.kotlin.android.tests.run.RunResult;
import org.jetbrains.kotlin.android.tests.run.RunUtils;
import org.junit.Assert;
import java.util.List;
import java.util.regex.Matcher;
@@ -123,7 +124,7 @@ public class Emulator {
GeneralCommandLine commandLine = createAdbCommand();
commandLine.addParameter("start-server");
System.out.println("Start adb server...");
OutputUtils.checkResult(RunUtils.execute(commandLine));
OutputUtils.checkResult(RunUtils.execute(new RunUtils.RunSettings(commandLine, null, true, "ADB START:", true)));
}
public void startEmulator() {
@@ -138,13 +139,38 @@ public class Emulator {
commandLine.addParameter("logcat");
commandLine.addParameter("-v");
commandLine.addParameter("time");
commandLine.addParameter("*:I");
commandLine.addParameter("-s");
commandLine.addParameter("dalvikvm:W");
commandLine.addParameter("TestRunner:I");
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(commandLine, null, false, "LOGCAT: ", true));
}
public void waitEmulatorStart() {
System.out.println("Waiting for emulator start...");
OutputUtils.checkResult(RunUtils.execute(getWaitCommand()));
GeneralCommandLine bootCheckCommand = createAdbCommand();
bootCheckCommand.addParameter("shell");
bootCheckCommand.addParameter("getprop");
bootCheckCommand.addParameter("sys.boot_completed");
int counter = 0;
RunResult execute = RunUtils.execute(bootCheckCommand);
while (counter < 12) {
String output = execute.getOutput();
if (output.trim().endsWith("1")) {
System.out.println("Emulator fully booted!");
return;
}
System.out.println("Waiting for emulator boot (" + counter + ")...");
try {
Thread.sleep(10000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
counter++;
execute = RunUtils.execute(bootCheckCommand);
}
Assert.fail("Can't find booted emulator: " + execute.getOutput());
}
public void stopEmulator() {
@@ -212,6 +238,15 @@ public class Emulator {
}
}
public String runTestsViaAdb() {
System.out.println("Running tests via adb...");
GeneralCommandLine adbCommand = createAdbCommand();
//adb shell am instrument -w -r org.jetbrains.kotlin.android.tests/android.test.InstrumentationTestRunner
adbCommand.addParameters("shell", "am", "instrument", "-w", "-r", "org.jetbrains.kotlin.android.tests/android.test.InstrumentationTestRunner");
RunResult execute = RunUtils.execute(adbCommand);
return execute.getOutput();
}
private void stopRedundantEmulators(PathManager pathManager) {
GeneralCommandLine commandLineForListOfDevices = createAdbCommand();
commandLineForListOfDevices.addParameter("devices");

View File

@@ -0,0 +1,76 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.android.tests.gradle;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.kotlin.android.tests.OutputUtils;
import org.jetbrains.kotlin.android.tests.PathManager;
import org.jetbrains.kotlin.android.tests.run.RunResult;
import org.jetbrains.kotlin.android.tests.run.RunUtils;
import java.util.ArrayList;
import java.util.List;
public class GradleRunner {
private final List<String> listOfCommands;
public GradleRunner(PathManager pathManager) {
listOfCommands = new ArrayList<String>();
String cmdName = SystemInfo.isWindows ? "gradle.bat" : "gradle";
listOfCommands.add(pathManager.getGradleBinFolder() + "/" + cmdName);
listOfCommands.add("--build-file");
listOfCommands.add(pathManager.getTmpFolder() + "/build.gradle");
}
public void clean() {
System.out.println("Building gradle project...");
RunResult result = RunUtils.execute(generateCommandLine("clean"));
OutputUtils.checkResult(result);
}
public void build() {
System.out.println("Building gradle project...");
RunResult result = RunUtils.execute(generateCommandLine("build"));
OutputUtils.checkResult(result);
}
public void installDebugAndroidTest() {
System.out.println("Install tests...");
OutputUtils.checkResult(RunUtils.execute(generateCommandLine("installDebug")));
OutputUtils.checkResult(RunUtils.execute(generateCommandLine("installDebugAndroidTest")));
}
public void uninstallDebugAndroidTest() {
System.out.println("Uninstall tests...");
RunUtils.execute(generateCommandLine("uninstallDebugAndroidTest"));
RunUtils.execute(generateCommandLine("uninstallDebug"));
}
public String connectedDebugAndroidTest() {
System.out.println("Starting tests...");
RunResult result = RunUtils.execute(generateCommandLine("connectedAndroidTest"));
return result.getOutput();
}
private GeneralCommandLine generateCommandLine(String taskName) {
GeneralCommandLine commandLine = new GeneralCommandLine(listOfCommands);
commandLine.addParameter(taskName);
return commandLine;
}
}

View File

@@ -31,8 +31,10 @@ public class PermissionManager {
if (!SystemInfo.isWindows) {
RunUtils.execute(generateChmodCmd(pathManager.getAntBinDirectory() + "/ant"));
setExecPermissionForSimpleNamedFiles(new File(pathManager.getToolsFolderInAndroidSdk()));
setExecPermissionForSimpleNamedFiles(new File(pathManager.getToolsFolderInAndroidSdk() + "/bin64"));
setExecPermissionForSimpleNamedFiles(new File(pathManager.getBuildToolsFolderInAndroidSdk() + "/" + SDKDownloader.BUILD_TOOLS));
setExecPermissionForSimpleNamedFiles(new File(pathManager.getPlatformToolsFolderInAndroidSdk()));
RunUtils.execute(generateChmodCmd(pathManager.getGradleBinFolder() + "/gradle"));
}
}

View File

@@ -22,6 +22,8 @@ import junit.framework.TestSuite;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class AndroidRunner extends TestSuite {
@@ -42,12 +44,15 @@ public class AndroidRunner extends TestSuite {
PathManager pathManager = getPathManager();
FileUtil.copyDir(new File(pathManager.getAndroidModuleRoot()), new File(pathManager.getTmpFolder()));
writeAndroidSkdToLocalProperties();
CodegenTestsOnAndroidGenerator.generate(pathManager);
System.out.println("Run tests on android...");
TestSuite suite = CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
suite.addTest(new AndroidJpsBuildTestCase());
//AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
//TODO: Need add separate run configuration for AndroidJpsBuildTestCase
//suite.addTest(new AndroidJpsBuildTestCase());
return suite;
}
@@ -55,4 +60,15 @@ public class AndroidRunner extends TestSuite {
// Clear tmp folder where we run android tests
FileUtil.delete(new File(pathManager.getTmpFolder()));
}
private static void writeAndroidSkdToLocalProperties() throws IOException {
System.out.println("Writing android sdk to local.properties: " + pathManager.getAndroidSdkRoot());
File file = new File(pathManager.getTmpFolder() + "/local.properties");
FileWriter fw = new FileWriter(file);
try {
fw.write("sdk.dir=" + pathManager.getAndroidSdkRoot());
} finally {
fw.close();
}
}
}

View File

@@ -0,0 +1,160 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.android.tests
import com.intellij.openapi.util.Ref
import org.jetbrains.kotlin.codegen.CodegenTestCase
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
import java.util.regex.Pattern
private val FILE_NAME_ANNOTATIONS = arrayOf("@file:JvmName", "@file:kotlin.jvm.JvmName")
private val packagePattern = Pattern.compile("(?m)^\\s*package[ |\t]+([\\w|\\.]*)")
private val importPattern = Pattern.compile("import[ |\t]([\\w|]*\\.)")
internal fun genFiles(file: File, fileContent: String, filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter): FqName? {
val testFiles = createTestFiles(file, fileContent)
if (testFiles.filter { it.name.endsWith(".java") }.isNotEmpty()) {
//TODO support java files
return null;
}
val ktFiles = testFiles.filter { it.name.endsWith(".kt") }
if (ktFiles.isEmpty()) return null
val newPackagePrefix = file.path.replace("\\\\|-|\\.|/".toRegex(), "_")
val oldPackage = Ref<FqName>()
val isSingle = testFiles.size == 1
val resultFiles = testFiles.map {
val fileName = if (isSingle) it.name else file.name.substringBeforeLast(".kt") + "/" + it.name
TestClassInfo(
fileName,
changePackage(newPackagePrefix, it.content, oldPackage),
oldPackage.get(),
getGeneratedClassName(File(fileName), it.content, newPackagePrefix, oldPackage.get())
)
}
/*replace all Class.forName*/
resultFiles.forEach {
file ->
file.content = resultFiles.fold(file.content) { r, param ->
patchClassForName(param.newClassId, param.oldPackage, r)
}
}
/*patch imports and self imports*/
resultFiles.forEach {
file ->
file.content = resultFiles.fold(file.content) { r, param ->
r.patchImports(param.oldPackage, param.newPackage)
}.patchSelfImports(file.newPackage)
}
resultFiles.forEach { resultFile -> filesHolder.addFile(resultFile.name, resultFile.content) }
val boxFiles = resultFiles.filter { hasBoxMethod(it.content) }
if (boxFiles.size != 1) {
println("Several box methods in $file")
}
return boxFiles.last().newClassId
}
private fun createTestFiles(file: File, expectedText: String): List<CodegenTestCase.TestFile> {
val files = KotlinTestUtils.createTestFiles(file.name, expectedText, object : KotlinTestUtils.TestFileFactoryNoModules<CodegenTestCase.TestFile>() {
override fun create(fileName: String, text: String, directives: Map<String, String>): CodegenTestCase.TestFile {
return CodegenTestCase.TestFile(fileName, text)
}
})
return files
}
private fun hasBoxMethod(text: String): Boolean {
return text.contains("fun box()")
}
class TestClassInfo(val name: String, var content: String, val oldPackage: FqName, val newClassId: FqName) {
val newPackage = newClassId.parent()
}
private fun changePackage(newPackagePrefix: String, text: String, oldPackage: Ref<FqName>): String {
val matcher = packagePattern.matcher(text)
if (matcher.find()) {
val oldPackageName = matcher.toMatchResult().group(1)
oldPackage.set(FqName(oldPackageName))
return matcher.replaceAll("package $newPackagePrefix.$oldPackageName")
}
else {
oldPackage.set(FqName.ROOT)
val packageDirective = "package $newPackagePrefix;\n"
if (text.contains("@file:")) {
val index = text.lastIndexOf("@file:")
val packageDirectiveIndex = text.indexOf("\n", index)
return text.substring(0, packageDirectiveIndex + 1) + packageDirective + text.substring(packageDirectiveIndex + 1)
}
else {
return packageDirective + text
}
}
}
private fun getGeneratedClassName(file: File, text: String, newPackagePrefix: String, oldPackage: FqName): FqName {
//TODO support multifile facades
var packageFqName = FqName(newPackagePrefix)
if (!oldPackage.isRoot) {
packageFqName = packageFqName.child(Name.identifier(oldPackage.asString()))
}
for (annotation in FILE_NAME_ANNOTATIONS) {
if (text.contains(annotation)) {
val indexOf = text.indexOf(annotation)
val annotationParameter = text.substring(text.indexOf("(\"", indexOf) + 2, text.indexOf("\")", indexOf))
return packageFqName.child(Name.identifier(annotationParameter))
}
}
return PackagePartClassUtils.getPackagePartFqName(packageFqName, file.name)
}
private fun patchClassForName(className: FqName, oldPackage: FqName, text: String): String {
return text.replace(("Class\\.forName\\(\"" + oldPackage.child(className.shortName()).asString() + "\"\\)").toRegex(), "Class.forName(\"" + className.asString() + "\")")
}
private fun String.patchImports(oldPackage: FqName, newPackage: FqName): String {
if (oldPackage.isRoot) return this
return this.replace(("import\\s+" + oldPackage.asString()).toRegex(), "import " + newPackage.asString())
}
private fun String.patchSelfImports(newPackage: FqName): String {
var newText = this;
val matcher = importPattern.matcher(this)
while (matcher.find()) {
val possibleSelfImport = matcher.toMatchResult().group(1)
val classOrObjectPattern = Pattern.compile("[\\s|^](class|object)\\s$possibleSelfImport[\\s|\\(|{|;|:]")
if (classOrObjectPattern.matcher(newText).find()) {
newText = newText.replace("import " + possibleSelfImport, "import " + newPackage.child(Name.identifier(possibleSelfImport)).asString())
}
}
return newText
}

View File

@@ -20,7 +20,6 @@ import com.google.common.collect.Lists;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.UsefulTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
@@ -29,13 +28,17 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
import org.jetbrains.kotlin.codegen.CodegenTestFiles;
import org.jetbrains.kotlin.codegen.GenerationUtils;
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.kotlin.config.CompilerConfiguration;
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
import org.jetbrains.kotlin.idea.KotlinFileType;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.test.ConfigurationKind;
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestJdkKind;
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase;
import org.jetbrains.kotlin.utils.Printer;
import org.junit.Assert;
@@ -43,10 +46,8 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
public class CodegenTestsOnAndroidGenerator extends KtUsefulTestCase {
private final PathManager pathManager;
private static final String testClassPackage = "org.jetbrains.kotlin.android.tests";
@@ -55,7 +56,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
private static final String baseTestClassName = "AbstractCodegenTestCaseOnAndroid";
private static final String generatorName = "CodegenTestsOnAndroidGenerator";
private final Pattern packagePattern = Pattern.compile("package (.*)");
private static int MODULE_INDEX = 1;
private final List<String> generatedTestNames = Lists.newArrayList();
@@ -113,7 +114,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
p.println("public class ", testClassName, " extends ", baseTestClassName, " {");
p.pushIndent();
generateTestMethodsForDirectories(p, new File("compiler/testData/codegen/box"));
generateTestMethodsForDirectories(p, new File("compiler/testData/codegen/box"), new File("compiler/testData/codegen/boxInline"));
p.popIndent();
p.println("}");
@@ -124,27 +125,31 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
}
private void generateTestMethodsForDirectories(Printer p, File... dirs) throws IOException {
FilesWriter holderMock = new FilesWriter(false);
FilesWriter holderFull = new FilesWriter(true);
FilesWriter holderMock = new FilesWriter(false, false);
FilesWriter holderFull = new FilesWriter(true, false);
FilesWriter holderInheritMFP = new FilesWriter(true, true);
for (File dir : dirs) {
File[] files = dir.listFiles();
Assert.assertNotNull("Folder with testData is empty: " + dir.getAbsolutePath(), files);
processFiles(p, files, holderFull, holderMock);
processFiles(p, files, holderFull, holderMock, holderInheritMFP);
}
holderFull.writeFilesOnDisk();
holderMock.writeFilesOnDisk();
holderInheritMFP.writeFilesOnDisk();
}
private class FilesWriter {
class FilesWriter {
private final boolean isFullJdkAndRuntime;
private boolean inheritMultifileParts;
public List<KtFile> files = new ArrayList<KtFile>();
private KotlinCoreEnvironment environment;
private FilesWriter(boolean isFullJdkAndRuntime) {
private FilesWriter(boolean isFullJdkAndRuntime, boolean inheritMultifileParts) {
this.isFullJdkAndRuntime = isFullJdkAndRuntime;
this.inheritMultifileParts = inheritMultifileParts;
environment = createEnvironment(isFullJdkAndRuntime);
}
@@ -152,7 +157,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
return isFullJdkAndRuntime ?
KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
myTestRootDisposable, ConfigurationKind.ALL, TestJdkKind.FULL_JDK
) :
) :
KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable, ConfigurationKind.JDK_ONLY);
}
@@ -172,18 +177,35 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
environment = createEnvironment(isFullJdkAndRuntime);
}
public void addFile(String name, String content) {
try {
files.add(CodegenTestFiles.create(name, content, environment.getProject()).getPsiFile());
} catch (Throwable e) {
new RuntimeException("Problem during creating file " + name + ": \n" + content, e);
}
}
private void writeFiles(List<KtFile> filesToCompile) {
if (filesToCompile.isEmpty()) return;
System.out.println("Generating " + filesToCompile.size() + " files" + (isFullJdkAndRuntime
? " (full jdk and runtime)" : "") + "...");
System.out.println("Generating " + filesToCompile.size() + " files" +
(inheritMultifileParts
? " (JVM.INHERIT_MULTIFILE_PARTS)"
: isFullJdkAndRuntime ? " (full jdk and runtime)" : "") + "...");
OutputFileCollection outputFiles;
try {
//hack to pass module name
CompilerConfiguration configuration = environment.getConfiguration().copy();
configuration.put(JVMConfigurationKeys.MODULE_NAME, "android-module-" + MODULE_INDEX++);
if (inheritMultifileParts) {
configuration.put(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS, true);
}
configuration.setReadOnly(true);
outputFiles = GenerationUtils.compileManyFilesGetGenerationStateForTest(
filesToCompile.iterator().next().getProject(),
filesToCompile,
new JvmPackagePartProvider(environment),
null
configuration
).getFactory();
}
catch (Throwable e) {
@@ -204,11 +226,12 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
@NotNull Printer printer,
@NotNull File[] files,
@NotNull FilesWriter holderFull,
@NotNull FilesWriter holderMock)
throws IOException
{
@NotNull FilesWriter holderMock,
@NotNull FilesWriter holderInheritMFP
) throws IOException {
holderFull.writeFilesOnDiskIfNeeded();
holderMock.writeFilesOnDiskIfNeeded();
holderInheritMFP.writeFilesOnDiskIfNeeded();
for (File file : files) {
if (SpecialFiles.getExcludedFiles().contains(file.getName())) {
@@ -217,60 +240,44 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
if (file.isDirectory()) {
File[] listFiles = file.listFiles();
if (listFiles != null) {
processFiles(printer, listFiles, holderFull, holderMock);
processFiles(printer, listFiles, holderFull, holderMock, holderInheritMFP);
}
}
else if (!FileUtilRt.getExtension(file.getName()).equals(KotlinFileType.INSTANCE.getDefaultExtension())) {
// skip non kotlin files
}
else {
String text = FileUtil.loadFile(file, true);
//TODO: support multifile tests
if (text.contains("FILE:")) continue;
//TODO: support JvmFileName annotation & WITH_REFLECT directive
if (InTextDirectivesUtils.isDirectiveDefined(text, "WITH_REFLECT") || text.contains("JvmFileName")) continue;
String fullFileText = FileUtil.loadFile(file, true);
//TODO: support multifile facades
//TODO: support multifile facades hierarchies
if (hasBoxMethod(fullFileText)) {
FilesWriter filesHolder = InTextDirectivesUtils.isDirectiveDefined(fullFileText, "FULL_JDK") ||
InTextDirectivesUtils.isDirectiveDefined(fullFileText, "WITH_RUNTIME") ||
InTextDirectivesUtils.isDirectiveDefined(fullFileText, "WITH_REFLECT") ? holderFull : holderMock;
filesHolder = fullFileText.contains("+JVM.INHERIT_MULTIFILE_PARTS") ? holderInheritMFP : filesHolder;
FqName classWithBoxMethod = AndroidTestGeneratorKt.genFiles(file, fullFileText, filesHolder);
if (classWithBoxMethod == null)
continue;
if (hasBoxMethod(text)) {
String generatedTestName = generateTestName(file.getName());
String packageName = file.getPath().replaceAll("\\\\|-|\\.|/", "_");
text = changePackage(packageName, text);
FilesWriter filesHolder = InTextDirectivesUtils.isDirectiveDefined(text, "FULL_JDK") ||
InTextDirectivesUtils.isDirectiveDefined(text, "WITH_RUNTIME") ? holderFull : holderMock;
CodegenTestFiles codegenFile = CodegenTestFiles.create(file.getName(), text, filesHolder.environment.getProject());
filesHolder.files.add(codegenFile.getPsiFile());
generateTestMethod(printer, generatedTestName, StringUtil.escapeStringCharacters(file.getPath()));
generateTestMethod(printer, generatedTestName, classWithBoxMethod.asString(), StringUtil.escapeStringCharacters(file.getPath()));
}
}
}
}
private static boolean hasBoxMethod(String text) {
return text.contains("fun box()");
}
private String changePackage(String testName, String text) {
if (text.contains("package ")) {
Matcher matcher = packagePattern.matcher(text);
return matcher.replaceAll("package " + testName);
}
else {
String packageDirective = "package " + testName + ";\n";
if (text.contains("@file:")) {
int index = text.lastIndexOf("@file:");
int packageDirectiveIndex = text.indexOf("\n", index);
return text.substring(0, packageDirectiveIndex + 1) + packageDirective + text.substring(packageDirectiveIndex + 1);
} else {
return packageDirective + text;
}
}
}
private static void generateTestMethod(Printer p, String testName, String packageName) {
private static void generateTestMethod(Printer p, String testName, String className, String filePath) {
p.println("public void test" + testName + "() throws Exception {");
p.pushIndent();
p.println("invokeBoxMethod(\"" + packageName + "\", \"OK\");");
p.println("invokeBoxMethod(" + className + ".class, \"" + filePath + "\", \"OK\");");
p.popIndent();
p.println("}");
p.println();

View File

@@ -36,45 +36,64 @@ public class SpecialFiles {
private static void fillExcludedFiles() {
excludedFiles.add("native"); // Reflection is used to check full class name
excludedFiles.add("reflection");
excludedFiles.add("enclosing"); //reflection tests
excludedFiles.add("noReflectAtRuntime"); //reflection tests
excludedFiles.add("methodsFromAny"); //reflection tests
excludedFiles.add("kt3238.kt"); // Reflection
excludedFiles.add("kt1482_2279.kt"); // Reflection
excludedFiles.add("extensionMethod.kt"); // Reflection loadClass
excludedFiles.add("nestedInPackage.kt"); // Cannot change package name
excludedFiles.add("importNestedClass.kt"); // Cannot change package name
excludedFiles.add("packageQualifiedMethod.kt"); // Cannot change package name
excludedFiles.add("classObjectToString.kt"); // Cannot change package name
excludedFiles.add("invokeOnClassObjectOfNestedClass2.kt"); // Cannot change package name
excludedFiles.add("invokeOnImportedEnum1.kt"); // Cannot change package name
excludedFiles.add("invokeOnImportedEnum2.kt"); // Cannot change package name
excludedFiles.add("sortEnumEntries.kt"); // Cannot change package name
excludedFiles.add("assertionStackTrace.kt"); // Cannot change package name
excludedFiles.add("anonymousObjectReifiedSupertype.kt"); // Cannot change package name
excludedFiles.add("innerAnonymousObject.kt"); // Cannot change package name
excludedFiles.add("nestedReifiedSignature.kt"); // Cannot change package name
excludedFiles.add("recursiveInnerAnonymousObject.kt"); // Cannot change package name
excludedFiles.add("approximateCapturedTypes.kt"); // Cannot change package name
excludedFiles.add("classForEnumEntry.kt"); // Cannot change package name
excludedFiles.add("kt10143.kt"); // Cannot change package name
excludedFiles.add("internalTopLevelOtherPackage.kt"); // Cannot change package name
excludedFiles.add("noPrivateDelegation.kt"); // Cannot change package name
excludedFiles.add("platformTypeAssertionStackTrace.kt"); // Cannot change package name
excludedFiles.add("packages.kt"); // Cannot change package name
excludedFiles.add("kt10259.kt"); // Cannot change package name
excludedFiles.add("kt11081.kt"); // Cannot change package name
excludedFiles.add("kt6990.kt"); // Cannot change package name
excludedFiles.add("mainInFiles.kt"); // Cannot change package name
excludedFiles.add("noClassForSimpleEnum.kt"); // Cannot change package name
excludedFiles.add("simpleClassLiteral.kt"); // Cannot change package name
excludedFiles.add("jvmName.kt"); // Cannot change package name
excludedFiles.add("qualifiedName.kt"); // Cannot change package name
excludedFiles.add("topLevelProperty.kt"); // Cannot change package name
excludedFiles.add("typeParameters.kt"); // Cannot change package name
excludedFiles.add("kt13133.kt"); // Cannot change package name
excludedFiles.add("kt684.kt"); // StackOverflow with StringBuilder (escape())
excludedFiles.add("kt529.kt"); // Bug
excludedFiles.add("kt344.kt"); // Bug
excludedFiles.add("comparisonWithNullCallsFun.kt"); // java.lang.NoClassDefFoundError: kotlin.Nothing
excludedFiles.add("kt3574.kt"); // java.lang.NoClassDefFoundError: kotlin.Nothing
excludedFiles.add("genericBackingFieldSignature.kt"); // Wrong signature after package renaming
excludedFiles.add("genericMethodSignature.kt"); // Wrong signature after package renaming
excludedFiles.add("kt11121.kt"); // Wrong signature after package renaming
excludedFiles.add("kt5112.kt"); // Wrong signature after package renaming
excludedFiles.add("classpath.kt"); // Some classes are not visible on android
excludedFiles.add("manyNumbers.kt"); // Out of memory
excludedFiles.add("smap"); // Line numbers
excludedFiles.add("external"); //native methods
// TODO: fix import processing
excludedFiles.add("useImportedMemberFromCompanion.kt");
excludedFiles.add("useImportedMember.kt");
excludedFiles.add("importStaticMemberFromObject.kt");
excludedFiles.add("enclosingInfo"); // Wrong enclosing info after package renaming
excludedFiles.add("signature"); // Wrong signature after package renaming
excludedFiles.add("functionNtoStringNoReflect.kt"); // disabled cause test executed with reflection
excludedFiles.add("nestedClasses.kt"); // additional nested class in 'Thread' class on Android
excludedFiles.add("kt12200Const.kt"); // no 'modifiers' field in 'java.lang.reflect.Field' class
excludedFiles.add("closureOfInnerLocalClass.kt"); // KT-8120
excludedFiles.add("closureWithSelfInstantiation.kt"); // KT-8120
}
private SpecialFiles() {

View File

@@ -1,196 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.backend.common;
import com.intellij.openapi.editor.Document;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
import java.util.*;
public class CodegenUtil {
private CodegenUtil() {
}
@Nullable
public static FunctionDescriptor getDeclaredFunctionByRawSignature(
@NotNull ClassDescriptor owner,
@NotNull Name name,
@NotNull ClassifierDescriptor returnedClassifier,
@NotNull ClassifierDescriptor... valueParameterClassifiers
) {
Collection<SimpleFunctionDescriptor> functions = owner.getDefaultType().getMemberScope().getContributedFunctions(name, NoLookupLocation.FROM_BACKEND);
for (FunctionDescriptor function : functions) {
if (!CallResolverUtilKt.isOrOverridesSynthesized(function)
&& function.getTypeParameters().isEmpty()
&& valueParameterClassesMatch(function.getValueParameters(), Arrays.asList(valueParameterClassifiers))
&& rawTypeMatches(function.getReturnType(), returnedClassifier)) {
return function;
}
}
return null;
}
@Nullable
public static PropertyDescriptor getDelegatePropertyIfAny(KtExpression expression, ClassDescriptor classDescriptor, BindingContext bindingContext) {
PropertyDescriptor propertyDescriptor = null;
if (expression instanceof KtSimpleNameExpression) {
ResolvedCall<?> call = CallUtilKt.getResolvedCall(expression, bindingContext);
if (call != null) {
CallableDescriptor callResultingDescriptor = call.getResultingDescriptor();
if (callResultingDescriptor instanceof ValueParameterDescriptor) {
ValueParameterDescriptor valueParameterDescriptor = (ValueParameterDescriptor) callResultingDescriptor;
// constructor parameter
if (valueParameterDescriptor.getContainingDeclaration() instanceof ConstructorDescriptor) {
// constructor of my class
if (valueParameterDescriptor.getContainingDeclaration().getContainingDeclaration() == classDescriptor) {
propertyDescriptor = bindingContext.get(BindingContext.VALUE_PARAMETER_AS_PROPERTY, valueParameterDescriptor);
}
}
}
// todo: when and if frontend will allow properties defined not as constructor parameters to be used in delegation specifier
}
}
return propertyDescriptor;
}
public static boolean isFinalPropertyWithBackingField(PropertyDescriptor propertyDescriptor, BindingContext bindingContext) {
return propertyDescriptor != null &&
!propertyDescriptor.isVar() &&
Boolean.TRUE.equals(bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor));
}
@NotNull
public static Map<FunctionDescriptor, FunctionDescriptor> getNonPrivateTraitMethods(ClassDescriptor descriptor) {
Map<FunctionDescriptor, FunctionDescriptor> result = new LinkedHashMap<FunctionDescriptor, FunctionDescriptor>();
for (DeclarationDescriptor declaration : DescriptorUtils.getAllDescriptors(descriptor.getDefaultType().getMemberScope())) {
if (!(declaration instanceof CallableMemberDescriptor)) continue;
CallableMemberDescriptor inheritedMember = (CallableMemberDescriptor) declaration;
CallableMemberDescriptor traitMember = ImplKt.findTraitImplementation(inheritedMember);
if (traitMember == null || Visibilities.isPrivate(traitMember.getVisibility())) continue;
assert traitMember.getModality() != Modality.ABSTRACT : "Cannot delegate to abstract trait method: " + inheritedMember;
// inheritedMember can be abstract here. In order for FunctionCodegen to generate the method body, we're creating a copy here
// with traitMember's modality
result.putAll(copyFunctions(inheritedMember, traitMember, inheritedMember.getContainingDeclaration(), traitMember.getModality(), Visibilities.PUBLIC,
CallableMemberDescriptor.Kind.DECLARATION, true));
}
return result;
}
@NotNull
public static Map<FunctionDescriptor, FunctionDescriptor> copyFunctions(
@NotNull CallableMemberDescriptor inheritedMember,
@NotNull CallableMemberDescriptor traitMember,
DeclarationDescriptor newOwner,
Modality modality,
Visibility visibility,
CallableMemberDescriptor.Kind kind,
boolean copyOverrides
) {
CallableMemberDescriptor copy = inheritedMember.copy(newOwner, modality, visibility, kind, copyOverrides);
Map<FunctionDescriptor, FunctionDescriptor> result = new LinkedHashMap<FunctionDescriptor, FunctionDescriptor>(0);
if (traitMember instanceof SimpleFunctionDescriptor) {
result.put((FunctionDescriptor) traitMember, (FunctionDescriptor) copy);
}
else if (traitMember instanceof PropertyDescriptor) {
for (PropertyAccessorDescriptor traitAccessor : ((PropertyDescriptor) traitMember).getAccessors()) {
for (PropertyAccessorDescriptor inheritedAccessor : ((PropertyDescriptor) copy).getAccessors()) {
if (inheritedAccessor.getClass() == traitAccessor.getClass()) { // same accessor kind
result.put(traitAccessor, inheritedAccessor);
}
}
}
}
return result;
}
@NotNull
public static ClassDescriptor getSuperClassBySuperTypeListEntry(@NotNull KtSuperTypeListEntry specifier, @NotNull BindingContext bindingContext) {
KotlinType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
assert superType != null : "superType should not be null: " + specifier.getText();
ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
assert superClassDescriptor != null : "superClassDescriptor should not be null: " + specifier.getText();
return superClassDescriptor;
}
private static boolean valueParameterClassesMatch(
@NotNull List<ValueParameterDescriptor> parameters,
@NotNull List<ClassifierDescriptor> classifiers
) {
if (parameters.size() != classifiers.size()) return false;
for (int i = 0; i < parameters.size(); i++) {
ValueParameterDescriptor parameterDescriptor = parameters.get(i);
ClassifierDescriptor classDescriptor = classifiers.get(i);
if (!rawTypeMatches(parameterDescriptor.getType(), classDescriptor)) {
return false;
}
}
return true;
}
private static boolean rawTypeMatches(KotlinType type, ClassifierDescriptor classifier) {
return type.getConstructor().equals(classifier.getTypeConstructor());
}
public static boolean isEnumValueOfMethod(@NotNull FunctionDescriptor functionDescriptor) {
List<ValueParameterDescriptor> methodTypeParameters = functionDescriptor.getValueParameters();
KotlinType nullableString = TypeUtils.makeNullable(DescriptorUtilsKt.getBuiltIns(functionDescriptor).getStringType());
return DescriptorUtils.ENUM_VALUE_OF.equals(functionDescriptor.getName())
&& methodTypeParameters.size() == 1
&& KotlinTypeChecker.DEFAULT.isSubtypeOf(methodTypeParameters.get(0).getType(), nullableString);
}
@Nullable
public static Integer getLineNumberForElement(@NotNull PsiElement statement, boolean markEndOffset) {
PsiFile file = statement.getContainingFile();
if (file instanceof KtFile) {
if (KtPsiFactoryKt.getDoNotAnalyze((KtFile) file) != null) {
return null;
}
}
if (statement instanceof KtConstructorDelegationReferenceExpression && statement.getTextLength() == 0) {
// PsiElement for constructor delegation reference is always generated, so we shouldn't mark it's line number if it's empty
return null;
}
Document document = file.getViewProvider().getDocument();
return document != null ? document.getLineNumber(markEndOffset ? statement.getTextRange().getEndOffset() : statement.getTextOffset()) + 1 : null;
}
}

View File

@@ -0,0 +1,213 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.backend.common
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.backend.common.bridges.findTraitImplementation
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.types.isDynamic
import org.jetbrains.kotlin.utils.keysToMapExceptNulls
object CodegenUtil {
// class Foo : Bar by baz
// descriptor = Foo
// toInterface = Bar
// delegateExpressionType = typeof(baz)
// return Map<member of Foo, corresponding member of typeOf(baz)>
@JvmStatic
fun getDelegates(
descriptor: ClassDescriptor,
toInterface: ClassDescriptor,
delegateExpressionType: KotlinType? = null
): Map<CallableMemberDescriptor, CallableDescriptor> {
if (delegateExpressionType?.isDynamic() ?: false) return emptyMap()
return descriptor.defaultType.memberScope.getContributedDescriptors().asSequence()
.filterIsInstance<CallableMemberDescriptor>()
.filter { it.kind == CallableMemberDescriptor.Kind.DELEGATION }
.asIterable()
.sortedWith(MemberComparator.INSTANCE)
.keysToMapExceptNulls { delegatingMember ->
val actualDelegates = DescriptorUtils.getAllOverriddenDescriptors(delegatingMember)
.mapNotNull { overriddenDescriptor ->
if (overriddenDescriptor.containingDeclaration == toInterface) {
val scope = (delegateExpressionType ?: toInterface.defaultType).memberScope
val name = overriddenDescriptor.name
// this is the actual member of delegateExpressionType that we are delegating to
(scope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND) +
scope.getContributedVariables(name, NoLookupLocation.FROM_BACKEND))
.firstOrNull {
(listOf(it) + DescriptorUtils.getAllOverriddenDescriptors(it))
.map(CallableMemberDescriptor::getOriginal)
.contains(overriddenDescriptor.original)
}
}
else null
}
assert(actualDelegates.size <= 1) { "Many delegates found for $delegatingMember: $actualDelegates" }
actualDelegates.firstOrNull()
}
}
@JvmStatic
fun getDeclaredFunctionByRawSignature(
owner: ClassDescriptor,
name: Name,
returnedClassifier: ClassifierDescriptor,
vararg valueParameterClassifiers: ClassifierDescriptor
): FunctionDescriptor? {
return owner.defaultType.memberScope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND).firstOrNull { function ->
!isOrOverridesSynthesized(function) &&
function.typeParameters.isEmpty() &&
valueParameterClassesMatch(function.valueParameters, valueParameterClassifiers.toList()) &&
rawTypeMatches(function.returnType!!, returnedClassifier)
}
}
@JvmStatic
fun getDelegatePropertyIfAny(
expression: KtExpression, classDescriptor: ClassDescriptor, bindingContext: BindingContext
): PropertyDescriptor? {
val call = (expression as? KtSimpleNameExpression)?.getResolvedCall(bindingContext) ?: return null
val callResultingDescriptor = call.resultingDescriptor as? ValueParameterDescriptor ?: return null
// constructor parameter
if (callResultingDescriptor.containingDeclaration is ConstructorDescriptor) {
// constructor of my class
if (callResultingDescriptor.containingDeclaration.containingDeclaration === classDescriptor) {
return bindingContext.get(BindingContext.VALUE_PARAMETER_AS_PROPERTY, callResultingDescriptor)
}
}
return null
}
@JvmStatic
fun isFinalPropertyWithBackingField(propertyDescriptor: PropertyDescriptor?, bindingContext: BindingContext): Boolean {
return propertyDescriptor != null &&
!propertyDescriptor.isVar &&
(bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor) ?: false)
}
@JvmStatic
fun getNonPrivateTraitMethods(descriptor: ClassDescriptor): Map<FunctionDescriptor, FunctionDescriptor> {
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
for (declaration in DescriptorUtils.getAllDescriptors(descriptor.defaultType.memberScope)) {
if (declaration !is CallableMemberDescriptor) continue
val traitMember = findTraitImplementation(declaration)
if (traitMember == null || Visibilities.isPrivate(traitMember.visibility)) continue
assert(traitMember.modality !== Modality.ABSTRACT) { "Cannot delegate to abstract trait method: $declaration" }
// inheritedMember can be abstract here. In order for FunctionCodegen to generate the method body, we're creating a copy here
// with traitMember's modality
result.putAll(copyFunctions(declaration, traitMember, declaration.containingDeclaration, traitMember.modality,
Visibilities.PUBLIC, CallableMemberDescriptor.Kind.DECLARATION, true))
}
return result
}
fun copyFunctions(
inheritedMember: CallableMemberDescriptor,
traitMember: CallableMemberDescriptor,
newOwner: DeclarationDescriptor,
modality: Modality,
visibility: Visibility,
kind: CallableMemberDescriptor.Kind,
copyOverrides: Boolean
): Map<FunctionDescriptor, FunctionDescriptor> {
val copy = inheritedMember.copy(newOwner, modality, visibility, kind, copyOverrides)
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
if (traitMember is SimpleFunctionDescriptor) {
result[traitMember] = copy as FunctionDescriptor
}
else if (traitMember is PropertyDescriptor) {
for (traitAccessor in traitMember.accessors) {
for (inheritedAccessor in (copy as PropertyDescriptor).accessors) {
if (inheritedAccessor.javaClass == traitAccessor.javaClass) { // same accessor kind
result.put(traitAccessor, inheritedAccessor)
}
}
}
}
return result
}
@JvmStatic
fun getSuperClassBySuperTypeListEntry(specifier: KtSuperTypeListEntry, bindingContext: BindingContext): ClassDescriptor {
val superType = bindingContext.get(BindingContext.TYPE, specifier.typeReference!!)
?: error("superType should not be null: ${specifier.text}")
return superType.constructor.declarationDescriptor as? ClassDescriptor
?: error("ClassDescriptor of superType should not be null: ${specifier.text}")
}
private fun valueParameterClassesMatch(
parameters: List<ValueParameterDescriptor>,
classifiers: List<ClassifierDescriptor>
): Boolean {
if (parameters.size != classifiers.size) return false
for ((parameterDescriptor, classDescriptor) in parameters.zip(classifiers)) {
if (!rawTypeMatches(parameterDescriptor.type, classDescriptor)) {
return false
}
}
return true
}
private fun rawTypeMatches(type: KotlinType, classifier: ClassifierDescriptor): Boolean =
type.constructor == classifier.typeConstructor
@JvmStatic
fun isEnumValueOfMethod(functionDescriptor: FunctionDescriptor): Boolean {
val methodTypeParameters = functionDescriptor.valueParameters
val nullableString = TypeUtils.makeNullable(functionDescriptor.builtIns.stringType)
return DescriptorUtils.ENUM_VALUE_OF == functionDescriptor.name
&& methodTypeParameters.size == 1
&& KotlinTypeChecker.DEFAULT.isSubtypeOf(methodTypeParameters[0].type, nullableString)
}
@JvmStatic
fun getLineNumberForElement(statement: PsiElement, markEndOffset: Boolean): Int? {
val file = statement.containingFile
if (file is KtFile && file.doNotAnalyze != null) {
return null
}
if (statement is KtConstructorDelegationReferenceExpression && statement.textLength == 0) {
// PsiElement for constructor delegation reference is always generated, so we shouldn't mark it's line number if it's empty
return null
}
val document = file.viewProvider.document
return document?.getLineNumber(if (markEndOffset) statement.textRange.endOffset else statement.textOffset)?.plus(1)
}
}

View File

@@ -1,74 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.backend.common
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.isDynamic
import org.jetbrains.kotlin.utils.keysToMapExceptNulls
import java.util.Comparator
object CodegenUtilKt {
// class Foo : Bar by baz
// descriptor = Foo
// toInterface = Bar
// delegateExpressionType = typeof(baz)
// return Map<member of Foo, corresponding member of typeOf(baz)>
@JvmStatic fun getDelegates(
descriptor: ClassDescriptor,
toInterface: ClassDescriptor,
delegateExpressionType: KotlinType? = null
): Map<CallableMemberDescriptor, CallableDescriptor> {
if (delegateExpressionType?.isDynamic() ?: false) return mapOf();
return descriptor.defaultType.memberScope.getContributedDescriptors().asSequence()
.filterIsInstance<CallableMemberDescriptor>()
.filter { it.kind == CallableMemberDescriptor.Kind.DELEGATION }
.asIterable()
.sortedWith(MemberComparator.INSTANCE)
.keysToMapExceptNulls {
delegatingMember ->
val actualDelegates = DescriptorUtils.getAllOverriddenDescriptors(delegatingMember)
.mapNotNull {
overriddenDescriptor ->
if (overriddenDescriptor.containingDeclaration == toInterface) {
val scope = (delegateExpressionType ?: toInterface.defaultType).memberScope
val name = overriddenDescriptor.name
// this is the actual member of delegateExpressionType that we are delegating to
(scope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND) + scope.getContributedVariables(name, NoLookupLocation.FROM_BACKEND))
.firstOrNull {
(listOf(it) + DescriptorUtils.getAllOverriddenDescriptors(it))
.map { it.original }
.contains(overriddenDescriptor.original)
}
}
else null
}
assert(actualDelegates.size <= 1) { "Many delegates found for $delegatingMember: $actualDelegates" }
actualDelegates.firstOrNull()
}
}
}

View File

@@ -1,171 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.backend.common;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.KtClass;
import org.jetbrains.kotlin.psi.KtClassOrObject;
import org.jetbrains.kotlin.psi.KtParameter;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.OverrideResolver;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import java.util.Collections;
import java.util.List;
/**
* A platform-independent logic for generating data class synthetic methods.
* TODO: data class with zero components gets no toString/equals/hashCode methods. This is inconsistent and should be
* changed here with the platform backends adopted.
*/
public abstract class DataClassMethodGenerator {
private final KtClassOrObject declaration;
private final BindingContext bindingContext;
private final ClassDescriptor classDescriptor;
private final KotlinBuiltIns builtIns;
public DataClassMethodGenerator(KtClassOrObject declaration, BindingContext bindingContext) {
this.declaration = declaration;
this.bindingContext = bindingContext;
this.classDescriptor = BindingContextUtils.getNotNull(bindingContext, BindingContext.CLASS, declaration);
this.builtIns = DescriptorUtilsKt.getBuiltIns(classDescriptor);
}
public void generate() {
generateComponentFunctionsForDataClasses();
generateCopyFunctionForDataClasses(getPrimaryConstructorParameters());
List<PropertyDescriptor> properties = getDataProperties();
if (!properties.isEmpty()) {
generateDataClassToStringIfNeeded(properties);
generateDataClassHashCodeIfNeeded(properties);
generateDataClassEqualsIfNeeded(properties);
}
}
protected abstract void generateComponentFunction(@NotNull FunctionDescriptor function, @NotNull ValueParameterDescriptor parameter);
protected abstract void generateCopyFunction(@NotNull FunctionDescriptor function, @NotNull List<KtParameter> constructorParameters);
protected abstract void generateToStringMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties);
protected abstract void generateHashCodeMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties);
protected abstract void generateEqualsMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties);
@NotNull
protected ClassDescriptor getClassDescriptor() {
return classDescriptor;
}
private void generateComponentFunctionsForDataClasses() {
ConstructorDescriptor constructor = classDescriptor.getUnsubstitutedPrimaryConstructor();
// primary constructor should exist for data classes
// but when generating light-classes still need to check we have one
if (constructor == null) return;
for (ValueParameterDescriptor parameter : constructor.getValueParameters()) {
FunctionDescriptor function = bindingContext.get(BindingContext.DATA_CLASS_COMPONENT_FUNCTION, parameter);
if (function != null) {
generateComponentFunction(function, parameter);
}
}
}
private void generateCopyFunctionForDataClasses(List<KtParameter> constructorParameters) {
FunctionDescriptor copyFunction = bindingContext.get(BindingContext.DATA_CLASS_COPY_FUNCTION, classDescriptor);
if (copyFunction != null) {
generateCopyFunction(copyFunction, constructorParameters);
}
}
private void generateDataClassToStringIfNeeded(@NotNull List<PropertyDescriptor> properties) {
FunctionDescriptor function = getDeclaredMember("toString", builtIns.getString());
if (function != null && isTrivial(function)) {
generateToStringMethod(function, properties);
}
}
private void generateDataClassHashCodeIfNeeded(@NotNull List<PropertyDescriptor> properties) {
FunctionDescriptor function = getDeclaredMember("hashCode", builtIns.getInt());
if (function != null && isTrivial(function)) {
generateHashCodeMethod(function, properties);
}
}
private void generateDataClassEqualsIfNeeded(@NotNull List<PropertyDescriptor> properties) {
FunctionDescriptor function = getDeclaredMember("equals", builtIns.getBoolean(), builtIns.getAny());
if (function != null && isTrivial(function)) {
generateEqualsMethod(function, properties);
}
}
private List<PropertyDescriptor> getDataProperties() {
List<PropertyDescriptor> result = Lists.newArrayList();
for (KtParameter parameter : getPrimaryConstructorParameters()) {
if (parameter.hasValOrVar()) {
result.add(bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter));
}
}
return result;
}
@NotNull
private List<KtParameter> getPrimaryConstructorParameters() {
if (declaration instanceof KtClass) {
return declaration.getPrimaryConstructorParameters();
}
return Collections.emptyList();
}
@Nullable
private FunctionDescriptor getDeclaredMember(
@NotNull String name,
@NotNull ClassDescriptor returnedClassifier,
@NotNull ClassDescriptor... valueParameterClassifiers
) {
return CodegenUtil.getDeclaredFunctionByRawSignature(
classDescriptor, Name.identifier(name), returnedClassifier, valueParameterClassifiers
);
}
/**
* @return true if the member is an inherited implementation of a method from Any
*/
private boolean isTrivial(@NotNull FunctionDescriptor function) {
if (function.getKind() == CallableMemberDescriptor.Kind.DECLARATION) {
return false;
}
for (CallableDescriptor overridden : OverrideResolver.getOverriddenDeclarations(function)) {
if (overridden instanceof CallableMemberDescriptor
&& ((CallableMemberDescriptor) overridden).getKind() == CallableMemberDescriptor.Kind.DECLARATION
&& !overridden.getContainingDeclaration().equals(builtIns.getAny())) {
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,128 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.backend.common
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.BindingContextUtils
import org.jetbrains.kotlin.resolve.OverridingUtil
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
/**
* A platform-independent logic for generating data class synthetic methods.
* TODO: data class with zero components gets no toString/equals/hashCode methods. This is inconsistent and should be
* changed here with the platform backends adopted.
*/
abstract class DataClassMethodGenerator(private val declaration: KtClassOrObject, private val bindingContext: BindingContext) {
protected val classDescriptor: ClassDescriptor = BindingContextUtils.getNotNull(bindingContext, BindingContext.CLASS, declaration)
private val builtIns = classDescriptor.builtIns
fun generate() {
generateComponentFunctionsForDataClasses()
generateCopyFunctionForDataClasses(primaryConstructorParameters)
val properties = dataProperties
if (properties.isNotEmpty()) {
generateDataClassToStringIfNeeded(properties)
generateDataClassHashCodeIfNeeded(properties)
generateDataClassEqualsIfNeeded(properties)
}
}
protected abstract fun generateComponentFunction(function: FunctionDescriptor, parameter: ValueParameterDescriptor)
protected abstract fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List<KtParameter>)
protected abstract fun generateToStringMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
protected abstract fun generateHashCodeMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
protected abstract fun generateEqualsMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
private fun generateComponentFunctionsForDataClasses() {
// primary constructor should exist for data classes
// but when generating light-classes still need to check we have one
val constructor = classDescriptor.unsubstitutedPrimaryConstructor ?: return
for (parameter in constructor.valueParameters) {
val function = bindingContext.get(BindingContext.DATA_CLASS_COMPONENT_FUNCTION, parameter)
if (function != null) {
generateComponentFunction(function, parameter)
}
}
}
private fun generateCopyFunctionForDataClasses(constructorParameters: List<KtParameter>) {
val copyFunction = bindingContext.get(BindingContext.DATA_CLASS_COPY_FUNCTION, classDescriptor) ?: return
generateCopyFunction(copyFunction, constructorParameters)
}
private fun generateDataClassToStringIfNeeded(properties: List<PropertyDescriptor>) {
val function = getDeclaredMember("toString", builtIns.string)
if (function != null && isTrivial(function)) {
generateToStringMethod(function, properties)
}
}
private fun generateDataClassHashCodeIfNeeded(properties: List<PropertyDescriptor>) {
val function = getDeclaredMember("hashCode", builtIns.int)
if (function != null && isTrivial(function)) {
generateHashCodeMethod(function, properties)
}
}
private fun generateDataClassEqualsIfNeeded(properties: List<PropertyDescriptor>) {
val function = getDeclaredMember("equals", builtIns.boolean, builtIns.any)
if (function != null && isTrivial(function)) {
generateEqualsMethod(function, properties)
}
}
private val dataProperties: List<PropertyDescriptor>
get() = primaryConstructorParameters
.filter { it.hasValOrVar() }
.map { bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, it)!! }
private val primaryConstructorParameters: List<KtParameter>
get() = (declaration as? KtClass)?.getPrimaryConstructorParameters().orEmpty()
private fun getDeclaredMember(
name: String,
returnedClassifier: ClassDescriptor,
vararg valueParameterClassifiers: ClassDescriptor
): FunctionDescriptor? = CodegenUtil.getDeclaredFunctionByRawSignature(
classDescriptor, Name.identifier(name), returnedClassifier, *valueParameterClassifiers
)
/**
* @return true if the member is an inherited implementation of a method from Any
*/
private fun isTrivial(function: FunctionDescriptor): Boolean {
return function.kind != CallableMemberDescriptor.Kind.DECLARATION &&
OverridingUtil.getOverriddenDeclarations(function).none { overridden ->
overridden is CallableMemberDescriptor &&
overridden.kind == CallableMemberDescriptor.Kind.DECLARATION &&
overridden.containingDeclaration != builtIns.any
}
}
}

View File

@@ -26,7 +26,7 @@ interface FunctionHandle {
fun getOverridden(): Iterable<FunctionHandle>
}
data class Bridge<Signature>(
data class Bridge<out Signature>(
val from: Signature,
val to: Signature
) {

View File

@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.OverrideResolver
import org.jetbrains.kotlin.resolve.OverridingUtil
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
fun <Signature> generateBridgesForFunctionDescriptor(
@@ -87,8 +87,8 @@ fun findTraitImplementation(descriptor: CallableMemberDescriptor): CallableMembe
* that should be called when the given fake override is called.
*/
fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
val overridden = OverrideResolver.getOverriddenDeclarations(descriptor)
val filtered = OverrideResolver.filterOutOverridden(overridden)
val overridden = OverridingUtil.getOverriddenDeclarations(descriptor)
val filtered = OverridingUtil.filterOutOverridden(overridden)
val result = filtered.firstOrNull { it.modality != Modality.ABSTRACT } ?: return null
@@ -108,6 +108,6 @@ fun firstSuperMethodFromKotlin(
): CallableMemberDescriptor? {
return descriptor.overriddenDescriptors.firstOrNull { overridden ->
overridden.modality != Modality.ABSTRACT &&
(overridden == implementation || OverrideResolver.overrides(overridden, implementation))
(overridden == implementation || OverridingUtil.overrides(overridden, implementation))
}
}

View File

@@ -279,7 +279,7 @@ public abstract class AnnotationCodegen {
ClassifierDescriptor classifierDescriptor = annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
assert classifierDescriptor != null : "Annotation descriptor has no class: " + annotationDescriptor;
RetentionPolicy rp = getRetentionPolicy(classifierDescriptor);
if (rp == RetentionPolicy.SOURCE && typeMapper.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES) {
if (rp == RetentionPolicy.SOURCE && !typeMapper.getClassBuilderMode().generateSourceRetentionAnnotations) {
return null;
}
@@ -400,13 +400,10 @@ public abstract class AnnotationCodegen {
private Void visitUnsupportedValue(ConstantValue<?> value) {
ClassBuilderMode mode = typeMapper.getClassBuilderMode();
switch (mode) {
case FULL:
throw new IllegalStateException("Don't know how to compile annotation value " + value);
case LIGHT_CLASSES:
return null;
default:
throw new IllegalStateException("Unknown builder mode: " + mode);
if (mode.generateBodies) {
throw new IllegalStateException("Don't know how to compile annotation value " + value);
} else {
return null;
}
}
};

View File

@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.codegen;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.google.protobuf.MessageLite;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.tree.IElementType;
import kotlin.Unit;
@@ -34,17 +33,19 @@ import org.jetbrains.kotlin.codegen.serialization.JvmStringTable;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.load.java.JavaVisibilities;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.protobuf.MessageLite;
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
import org.jetbrains.kotlin.resolve.DeprecationUtilKt;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
import org.jetbrains.kotlin.serialization.jvm.BitEncoding;
@@ -244,13 +245,10 @@ public class AsmUtil {
if (specialCase != null) {
return specialCase;
}
return getDefaultVisibilityFlag(descriptor.getVisibility());
}
public static int getDefaultVisibilityFlag(@NotNull Visibility visibility) {
Visibility visibility = descriptor.getVisibility();
Integer defaultMapping = visibilityToAccessFlag.get(visibility);
if (defaultMapping == null) {
throw new IllegalStateException(visibility + " is not a valid visibility in backend");
throw new IllegalStateException(visibility + " is not a valid visibility in backend for " + DescriptorRenderer.DEBUG_TEXT.render(descriptor));
}
return defaultMapping;
}
@@ -562,11 +560,6 @@ public class AsmUtil {
v.invokestatic(IntrinsicMethods.INTRINSICS_CLASS_NAME, "areEqual", "(Ljava/lang/Object;Ljava/lang/Object;)Z", false);
}
public static void genIncrement(Type expectedType, int myDelta, InstructionAdapter v) {
numConst(myDelta, expectedType, v);
v.add(expectedType);
}
public static void numConst(int value, Type type, InstructionAdapter v) {
if (type == Type.FLOAT_TYPE) {
v.fconst(value);
@@ -585,9 +578,11 @@ public class AsmUtil {
}
}
public static void genIncrement(Type expectedType, Type baseType, int myDelta, InstructionAdapter v) {
genIncrement(baseType, myDelta, v);
StackValue.coerce(baseType, expectedType, v);
public static void genIncrement(Type baseType, int myDelta, InstructionAdapter v) {
Type operationType = numberFunctionOperandType(baseType);
numConst(myDelta, operationType, v);
v.add(operationType);
StackValue.coerce(operationType, baseType, v);
}
public static void swap(InstructionAdapter v, Type stackTop, Type afterTop) {

View File

@@ -32,8 +32,6 @@ open class BranchedValue(
val opcode: Int
) : StackValue(Type.BOOLEAN_TYPE) {
constructor(or: BranchedValue, opcode: Int) : this(or.arg1, or.arg2, or.operandType, opcode)
override fun putSelector(type: Type, v: InstructionAdapter) {
val branchJumpLabel = Label()
condJump(branchJumpLabel, v, true)
@@ -63,7 +61,7 @@ open class BranchedValue(
companion object {
val negatedOperations = hashMapOf<Int, Int>()
val TRUE: BranchedValue = object : BranchedValue(StackValue.Constant(true, Type.BOOLEAN_TYPE), null, Type.BOOLEAN_TYPE, IFEQ) {
val TRUE: BranchedValue = object : BranchedValue(StackValue.none()/*not used*/, null, Type.BOOLEAN_TYPE, IFEQ) {
override fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
if (!jumpIfFalse) {
v.goTo(jumpLabel)
@@ -85,7 +83,7 @@ open class BranchedValue(
}
}
val FALSE: BranchedValue = object : BranchedValue(StackValue.Constant(false, Type.BOOLEAN_TYPE), null, Type.BOOLEAN_TYPE, IFEQ) {
val FALSE: BranchedValue = object : BranchedValue(StackValue.none()/*not used*/, null, Type.BOOLEAN_TYPE, IFEQ) {
override fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
if (jumpIfFalse) {
v.goTo(jumpLabel)
@@ -249,7 +247,7 @@ class NumberCompare(
}
class ObjectCompare(
val opToken: IElementType,
opToken: IElementType,
operandType: Type,
left: StackValue,
right: StackValue

View File

@@ -79,5 +79,5 @@ class CallableMethod(
invokeOpcode == INVOKESTATIC
override fun toString(): String =
"${Printer.OPCODES[invokeOpcode]} ${owner.internalName}.$signature"
"${Printer.OPCODES[invokeOpcode]} $owner.$signature"
}

View File

@@ -31,7 +31,7 @@ public class ClassBuilderFactories {
@NotNull
@Override
public ClassBuilderMode getClassBuilderMode() {
return ClassBuilderMode.FULL;
return ClassBuilderMode.full(false);
}
@NotNull
@@ -55,13 +55,22 @@ public class ClassBuilderFactories {
throw new IllegalStateException();
}
};
public static ClassBuilderFactory TEST = new TestClassBuilderFactory(false);
public static ClassBuilderFactory TEST_WITH_SOURCE_RETENTION_ANNOTATIONS = new TestClassBuilderFactory(true);
private static class TestClassBuilderFactory implements ClassBuilderFactory {
private final boolean generateSourceRetentionAnnotations;
public TestClassBuilderFactory(boolean generateSourceRetentionAnnotations) {
this.generateSourceRetentionAnnotations = generateSourceRetentionAnnotations;
}
@NotNull
public static ClassBuilderFactory TEST = new ClassBuilderFactory() {
@NotNull
@Override
public ClassBuilderMode getClassBuilderMode() {
return ClassBuilderMode.FULL;
return ClassBuilderMode.full(generateSourceRetentionAnnotations);
}
@NotNull
@@ -89,38 +98,40 @@ public class ClassBuilderFactories {
public void close() {
}
};
}
@NotNull
public static ClassBuilderFactory BINARIES = new ClassBuilderFactory() {
@NotNull
@Override
public ClassBuilderMode getClassBuilderMode() {
return ClassBuilderMode.FULL;
}
public static ClassBuilderFactory binaries(final boolean generateSourceRetentionAnnotations) {
return new ClassBuilderFactory() {
@NotNull
@Override
public ClassBuilderMode getClassBuilderMode() {
return ClassBuilderMode.full(generateSourceRetentionAnnotations);
}
@NotNull
@Override
public ClassBuilder newClassBuilder(@NotNull JvmDeclarationOrigin origin) {
return new AbstractClassBuilder.Concrete(new BinaryClassWriter());
}
@NotNull
@Override
public ClassBuilder newClassBuilder(@NotNull JvmDeclarationOrigin origin) {
return new AbstractClassBuilder.Concrete(new BinaryClassWriter());
}
@Override
public String asText(ClassBuilder builder) {
throw new UnsupportedOperationException("BINARIES generator asked for text");
}
@Override
public String asText(ClassBuilder builder) {
throw new UnsupportedOperationException("BINARIES generator asked for text");
}
@Override
public byte[] asBytes(ClassBuilder builder) {
ClassWriter visitor = (ClassWriter) builder.getVisitor();
return visitor.toByteArray();
}
@Override
public byte[] asBytes(ClassBuilder builder) {
ClassWriter visitor = (ClassWriter) builder.getVisitor();
return visitor.toByteArray();
}
@Override
public void close() {
@Override
public void close() {
}
};
}
};
}
private ClassBuilderFactories() {
}

View File

@@ -16,13 +16,50 @@
package org.jetbrains.kotlin.codegen;
public enum ClassBuilderMode {
public class ClassBuilderMode {
public final boolean generateBodies;
public final boolean generateMetadata;
public final boolean generateSourceRetentionAnnotations;
private ClassBuilderMode(boolean generateBodies, boolean generateMetadata, boolean generateSourceRetentionAnnotations) {
this.generateBodies = generateBodies;
this.generateMetadata = generateMetadata;
this.generateSourceRetentionAnnotations = generateSourceRetentionAnnotations;
}
public static ClassBuilderMode full(boolean generateSourceRetentionAnnotations) {
return generateSourceRetentionAnnotations ? KAPT2 : FULL;
}
/**
* Full function bodies
*/
FULL,
private final static ClassBuilderMode FULL = new ClassBuilderMode(
/* bodies = */ true,
/* metadata = */ true,
/* sourceRetention = */ false);
/**
* Full function bodies, write annotations with the "source" retention.
*/
private final static ClassBuilderMode KAPT2 = new ClassBuilderMode(
/* bodies = */ true,
/* metadata = */ true,
/* sourceRetention = */ true);
/**
* Generating light classes: Only function signatures
*/
LIGHT_CLASSES,
public final static ClassBuilderMode LIGHT_CLASSES = new ClassBuilderMode(
/* bodies = */ false,
/* metadata = */ false,
/* sourceRetention = */ true);
/**
* Function signatures + metadata (to support incremental compilation with kapt)
*/
public final static ClassBuilderMode KAPT = new ClassBuilderMode(
/* bodies = */ false,
/* metadata = */ true,
/* sourceRetention = */ true);
}

View File

@@ -62,6 +62,7 @@ import static org.jetbrains.kotlin.codegen.ExpressionCodegen.generateClassLitera
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConst;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLOSURE;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass;
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.METHOD_FOR_FUNCTION;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
@@ -219,10 +220,15 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
@Override
protected void generateKotlinMetadataAnnotation() {
FunctionDescriptor freeLambdaDescriptor = createFreeLambdaDescriptor(funDescriptor);
Method method = v.getSerializationBindings().get(METHOD_FOR_FUNCTION, funDescriptor);
assert method != null : "No method for " + funDescriptor;
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, freeLambdaDescriptor, method);
final DescriptorSerializer serializer =
DescriptorSerializer.createForLambda(new JvmSerializerExtension(v.getSerializationBindings(), state));
final ProtoBuf.Function functionProto = serializer.functionProto(funDescriptor).build();
final ProtoBuf.Function functionProto = serializer.functionProto(freeLambdaDescriptor).build();
WriteAnnotationUtilKt.writeKotlinMetadata(v, KotlinClassHeader.Kind.SYNTHETIC_CLASS, new Function1<AnnotationVisitor, Unit>() {
@Override
@@ -233,6 +239,30 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
});
}
/**
* Given a function descriptor, creates another function descriptor with type parameters copied from outer context(s).
* This is needed because once we're serializing this to a proto, there's no place to store information about external type parameters.
*/
@NotNull
private static FunctionDescriptor createFreeLambdaDescriptor(@NotNull FunctionDescriptor descriptor) {
FunctionDescriptor.CopyBuilder<? extends FunctionDescriptor> builder = descriptor.newCopyBuilder();
List<TypeParameterDescriptor> typeParameters = new ArrayList<TypeParameterDescriptor>(0);
builder.setTypeParameters(typeParameters);
DeclarationDescriptor container = descriptor.getContainingDeclaration();
while (container != null) {
if (container instanceof ClassDescriptor) {
typeParameters.addAll(((ClassDescriptor) container).getDeclaredTypeParameters());
}
else if (container instanceof CallableDescriptor && !(container instanceof ConstructorDescriptor)) {
typeParameters.addAll(((CallableDescriptor) container).getTypeParameters());
}
container = container.getContainingDeclaration();
}
return typeParameters.isEmpty() ? descriptor : builder.build();
}
@Override
protected void done() {
writeOuterClassAndEnclosingMethod();
@@ -270,7 +300,7 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
v.newMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC,
bridge.getName(), bridge.getDescriptor(), null, ArrayUtil.EMPTY_STRING_ARRAY);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
if (!state.getClassBuilderMode().generateBodies) return;
mv.visitCode();
@@ -304,7 +334,7 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
// TODO: ImplementationBodyCodegen.markLineNumberForSyntheticFunction?
private void generateFunctionReferenceMethods(@NotNull FunctionDescriptor descriptor) {
int flags = ACC_PUBLIC | ACC_FINAL;
boolean generateBody = state.getClassBuilderMode() == ClassBuilderMode.FULL;
boolean generateBody = state.getClassBuilderMode().generateBodies;
{
MethodVisitor mv =
@@ -374,7 +404,7 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
Method constructor = new Method("<init>", Type.VOID_TYPE, argTypes);
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), visibilityFlag, "<init>", constructor.getDescriptor(), null,
ArrayUtil.EMPTY_STRING_ARRAY);
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateBodies) {
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);

View File

@@ -23,16 +23,20 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.getSpecialSignatureInfo
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.isBuiltinWithSpecialDescriptorInJvm
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.NonReportingOverrideStrategy
import org.jetbrains.kotlin.resolve.OverrideResolver
import org.jetbrains.kotlin.resolve.OverridingStrategy
import org.jetbrains.kotlin.resolve.OverridingUtil
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.org.objectweb.asm.Opcodes.*
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_PUBLIC
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_SYNTHETIC
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import java.util.*
@@ -49,6 +53,7 @@ class CollectionStubMethodGenerator(
private val typeMapper = state.typeMapper
fun generate() {
if (descriptor.kind == ClassKind.INTERFACE) return
val superCollectionClasses = findRelevantSuperCollectionClasses()
if (superCollectionClasses.isEmpty()) return
@@ -193,11 +198,40 @@ class CollectionStubMethodGenerator(
): List<FunctionDescriptor> {
val result = ArrayList<FunctionDescriptor>()
OverrideResolver.generateOverridesInAClass(klass, listOf(), object : NonReportingOverrideStrategy() {
generateOverridesInAClass(klass, object : NonReportingOverrideStrategy() {
override fun addFakeOverride(fakeOverride: CallableMemberDescriptor) {
if (fakeOverride !is FunctionDescriptor) return
if (fakeOverride.findOverriddenFromDirectSuperClass(mutableCollectionClass)?.kind == DECLARATION) {
result.add(fakeOverride)
val foundOverriddenFromDirectSuperClass = fakeOverride.findOverriddenFromDirectSuperClass(mutableCollectionClass) ?: return
if (foundOverriddenFromDirectSuperClass.kind == DECLARATION) {
// For regular classes there should no be fake overrides having return types incompatible with return types of their
// overridden, while here it's possible to create declaration like `fun remove(e: E): ImmutableCollection<E>`
// in read-only class that obviously conflicts with `fun remove(e: E): Boolean`.
// But overrides binding algorithm suppose there should be no conflicts like this, so it simply chooses a random
// representative for fake override, while we interested here in ones from mutable version.
//
// NB: READ_ONLY_ARE_EQUAL_TO_MUTABLE_TYPE_CHECKER is used here for cases like:
// `fun iterator(): CharIterator` defined in read-only collection
// The problem is that 'CharIterator' is not a subtype of 'MutableIterator' while from Java's point of view it is,
// so we must hack our subtyping a little bit
val newDescriptor =
if (READ_ONLY_ARE_EQUAL_TO_MUTABLE_TYPE_CHECKER.isSubtypeOf(
fakeOverride.returnType!!, foundOverriddenFromDirectSuperClass.returnType!!))
fakeOverride
else
foundOverriddenFromDirectSuperClass.copy(
fakeOverride.containingDeclaration,
foundOverriddenFromDirectSuperClass.modality,
foundOverriddenFromDirectSuperClass.visibility,
fakeOverride.kind, false)
newDescriptor.overriddenDescriptors =
fakeOverride.overriddenDescriptors.filter {
superDescriptor ->
// filter out incompatible descriptors, e.g. `fun remove(e: E): ImmutableCollection<E>` for `fun remove(e: E): Boolean`
READ_ONLY_ARE_EQUAL_TO_MUTABLE_TYPE_CHECKER.isSubtypeOf(newDescriptor.returnType!!, superDescriptor.returnType!!)
}
result.add(newDescriptor)
}
}
@@ -220,6 +254,20 @@ class CollectionStubMethodGenerator(
}
}
private fun generateOverridesInAClass(classDescriptor: ClassDescriptor, strategy: OverridingStrategy) {
@Suppress("UNCHECKED_CAST")
val membersFromSupertypesByName =
classDescriptor.typeConstructor.supertypes.flatMapTo(linkedSetOf()) { type ->
DescriptorUtils.getAllDescriptors(type.memberScope).filter {
it is PropertyDescriptor || it is SimpleFunctionDescriptor
} as List<CallableMemberDescriptor>
}.groupBy { it.name }
for ((name, fromSupertypes) in membersFromSupertypesByName) {
OverridingUtil.generateOverridesInFunctionGroup(name, fromSupertypes, emptyList(), classDescriptor, strategy)
}
}
private fun createSyntheticSubclass(): Pair<MutableClassDescriptor, List<TypeParameterDescriptor>> {
val child = MutableClassDescriptor(descriptor.containingDeclaration, ClassKind.CLASS, false,
Name.special("<synthetic inheritor of ${descriptor.name}>"), descriptor.source)
@@ -243,18 +291,24 @@ class CollectionStubMethodGenerator(
private fun FunctionDescriptor.signature(): JvmMethodGenericSignature = typeMapper.mapSignatureWithGeneric(this, OwnerKind.IMPLEMENTATION)
private fun generateMethodStub(signature: JvmMethodGenericSignature, synthetic: Boolean) {
// TODO: investigate if it makes sense to generate abstract stubs in traits
var access = ACC_PUBLIC
if (descriptor.kind == ClassKind.INTERFACE) access = access or ACC_ABSTRACT
if (synthetic) access = access or ACC_SYNTHETIC
assert(descriptor.kind != ClassKind.INTERFACE) { "No stubs should be generated for interface ${descriptor.fqNameUnsafe}" }
val access = ACC_PUBLIC or (if (synthetic) ACC_SYNTHETIC else 0)
val asmMethod = signature.asmMethod
val genericSignature = if (synthetic) null else signature.genericsSignature
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, asmMethod.name, asmMethod.descriptor, genericSignature, null)
if (descriptor.kind != ClassKind.INTERFACE) {
mv.visitCode()
AsmUtil.genThrow(InstructionAdapter(mv), "java/lang/UnsupportedOperationException", "Mutating immutable collection")
FunctionCodegen.endVisit(mv, "built-in stub for $signature", null)
}
mv.visitCode()
AsmUtil.genThrow(InstructionAdapter(mv), "java/lang/UnsupportedOperationException", "Mutating immutable collection")
FunctionCodegen.endVisit(mv, "built-in stub for $signature", null)
}
}
private val READ_ONLY_ARE_EQUAL_TO_MUTABLE_TYPE_CHECKER = KotlinTypeChecker.withAxioms { x, y ->
val firstClass = x.declarationDescriptor as? ClassDescriptor ?: return@withAxioms x == y
val secondClass = y.declarationDescriptor as? ClassDescriptor ?: return@withAxioms x == y
val j2k = JavaToKotlinClassMap.INSTANCE
val firstReadOnly = if (j2k.isMutable(firstClass)) j2k.convertMutableToReadOnly(firstClass) else firstClass
val secondReadOnly = if (j2k.isMutable(secondClass)) j2k.convertMutableToReadOnly(secondClass) else secondClass
firstReadOnly.typeConstructor == secondReadOnly.typeConstructor
}

View File

@@ -16,53 +16,21 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
import org.jetbrains.kotlin.util.ExceptionUtilKt;
public class CompilationException extends RuntimeException {
private final PsiElement element;
public CompilationException(@NotNull String message, @Nullable Throwable cause, @NotNull PsiElement element) {
super(getMessage(message, cause, element), cause);
public CompilationException(@NotNull String message, @Nullable Throwable cause, @Nullable PsiElement element) {
super(ExceptionUtilKt.getExceptionMessage("Back-end (JVM)", message, cause, element), cause);
this.element = element;
}
@NotNull
@Nullable
public PsiElement getElement() {
return element;
}
private static String where(@NotNull Throwable cause) {
StackTraceElement[] stackTrace = cause.getStackTrace();
if (stackTrace != null && stackTrace.length > 0) {
return stackTrace[0].getFileName() + ":" + stackTrace[0].getLineNumber();
}
return "unknown";
}
public static String getMessage(@NotNull final String message, @Nullable final Throwable cause, @NotNull final PsiElement element) {
return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Override
public String compute() {
StringBuilder result =
new StringBuilder("Back-end (JVM) Internal error: ").append(message).append("\n");
if (cause != null) {
String causeMessage = cause.getMessage();
result.append("Cause: ").append(causeMessage == null ? cause.toString() : causeMessage).append("\n");
}
result.append("File being compiled and position: ").append(DiagnosticUtils.atLocation(element)).append("\n");
result.append("PsiElement: ").append(element.getText()).append("\n");
if (cause != null) {
result.append("The root cause was thrown at: ").append(where(cause));
}
return result.toString();
}
});
}
}

View File

@@ -134,7 +134,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
annotationCodegen.genAnnotations(it.value, signature.valueParameters[it.index].asmType)
}
if (state.classBuilderMode == ClassBuilderMode.LIGHT_CLASSES) {
if (!state.classBuilderMode.generateBodies) {
FunctionCodegen.generateLocalVariablesForParameters(mv, signature, null, Label(), Label(), remainingParameters, isStatic)
mv.visitEnd()
return

View File

@@ -38,13 +38,10 @@ import org.jetbrains.kotlin.codegen.binding.CodegenBinding;
import org.jetbrains.kotlin.codegen.context.*;
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension;
import org.jetbrains.kotlin.codegen.inline.*;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicCallable;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethod;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicPropertyGetter;
import org.jetbrains.kotlin.codegen.intrinsics.*;
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsnsKt;
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter;
import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter;
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.codegen.when.SwitchCodegen;
@@ -54,8 +51,6 @@ import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.jvm.bindingContextSlices.BindingContextSlicesKt;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor;
@@ -66,6 +61,7 @@ import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.*;
@@ -77,6 +73,8 @@ import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluat
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluatorKt;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices;
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
@@ -286,7 +284,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
RuntimeAssertionInfo runtimeAssertionInfo = null;
if (selector instanceof KtExpression) {
runtimeAssertionInfo = bindingContext.get(BindingContextSlicesKt.getRUNTIME_ASSERTION_INFO(), (KtExpression) selector);
runtimeAssertionInfo = bindingContext.get(JvmBindingContextSlices.RUNTIME_ASSERTION_INFO, (KtExpression) selector);
}
if (BuiltinSpecialBridgesKt.isValueArgumentForCallToMethodWithTypeCheckBarrier(selector, bindingContext)) return stackValue;
@@ -389,18 +387,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
@NotNull CodegenContext<?> context,
@NotNull KtSuperExpression expression
) {
BindingContext bindingContext = context.getState().getBindingContext();
PsiElement labelPsi = bindingContext.get(LABEL_TARGET, expression.getTargetLabel());
ClassDescriptor labelTarget = (ClassDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, labelPsi);
DeclarationDescriptor descriptor = bindingContext.get(REFERENCE_TARGET, expression.getInstanceReference());
// "super<descriptor>@labelTarget"
if (labelTarget != null) {
return labelTarget;
}
assert descriptor instanceof ClassDescriptor : "Don't know how to generate super-call to not a class";
CodegenContext result = getParentContextSubclassOf((ClassDescriptor) descriptor, context);
assert result != null : "Can't find parent context for " + descriptor;
return result.getThisDescriptor();
KotlinType thisTypeForSuperCall = context.getState().getBindingContext().get(BindingContext.THIS_TYPE_FOR_SUPER_EXPRESSION, expression);
assert thisTypeForSuperCall != null : "This type for superCall ''" + expression.getText() + "'' should be not null!";
ClassifierDescriptor descriptor = thisTypeForSuperCall.getConstructor().getDeclarationDescriptor();
assert descriptor instanceof ClassDescriptor :
"'This' reference target for ''" + expression.getText() + "''should be class descriptor, but was " + descriptor;
return (ClassDescriptor) descriptor;
}
@NotNull
@@ -502,6 +494,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
generateLoopBody(expression.getBody());
markStartLineNumber(expression);
v.goTo(condition);
v.mark(end);
@@ -528,6 +521,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
KtExpression condition = expression.getCondition();
StackValue conditionValue;
StackValueWithLeaveTask leaveTask = null;
if (body instanceof KtBlockExpression) {
// If body's a block, it can contain variable declarations which may be used in the condition of a do-while loop.
// We handle this case separately because otherwise such variable will be out of the frame map after the block ends
@@ -537,7 +531,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
statements.addAll(doWhileStatements);
statements.add(condition);
conditionValue = generateBlock(statements, false, continueLabel, null);
//Need to split leave task and condition cause otherwise BranchedValue optimizations wouldn't work
leaveTask = generateBlock(statements, false, continueLabel, null);
conditionValue = leaveTask.getStackValue();
}
else {
if (body != null) {
@@ -548,6 +544,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
}
BranchedValue.Companion.loopJump(conditionValue, beginLoopLabel, false, v);
if (leaveTask != null) {
leaveTask.getLeaveTasks().invoke(conditionValue);
}
v.mark(breakLabel);
blockStackElements.pop();
@@ -556,15 +555,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
@Override
public StackValue visitForExpression(@NotNull KtForExpression forExpression, StackValue receiver) {
// Is it a "1..2" or so
RangeCodegenUtil.BinaryCall binaryCall = RangeCodegenUtil.getRangeAsBinaryCall(forExpression);
if (binaryCall != null) {
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(binaryCall.op, bindingContext);
if (resolvedCall != null) {
if (RangeCodegenUtil.isOptimizableRangeTo(resolvedCall.getResultingDescriptor())) {
generateForLoop(new ForInRangeLiteralLoopGenerator(forExpression, binaryCall));
return StackValue.none();
}
ResolvedCall<? extends CallableDescriptor> loopRangeCall = RangeCodegenUtil.getLoopRangeResolvedCall(forExpression, bindingContext);
if (loopRangeCall != null) {
AbstractForLoopGenerator optimizedForLoopGenerator = createOptimizedForLoopGeneratorOrNull(forExpression, loopRangeCall);
if (optimizedForLoopGenerator != null) {
generateForLoop(optimizedForLoopGenerator);
return StackValue.none();
}
}
@@ -592,6 +588,45 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
return StackValue.none();
}
@Nullable
private AbstractForLoopGenerator createOptimizedForLoopGeneratorOrNull(
@NotNull KtForExpression forExpression,
@NotNull ResolvedCall<? extends CallableDescriptor> loopRangeCall
) {
CallableDescriptor loopRangeCallee = loopRangeCall.getResultingDescriptor();
if (RangeCodegenUtil.isOptimizableRangeTo(loopRangeCallee)) {
return new ForInRangeLiteralLoopGenerator(forExpression, loopRangeCall);
}
else if (RangeCodegenUtil.isOptimizableDownTo(loopRangeCallee)) {
return new ForInDownToProgressionLoopGenerator(forExpression, loopRangeCall);
}
else if (RangeCodegenUtil.isArrayOrPrimitiveArrayIndices(loopRangeCallee)) {
return new ForInArrayIndicesRangeLoopGenerator(forExpression, loopRangeCall);
}
else if (RangeCodegenUtil.isCollectionIndices(loopRangeCallee)) {
return new ForInCollectionIndicesRangeLoopGenerator(forExpression, loopRangeCall);
}
return null;
}
@NotNull
private static KotlinType getExpectedReceiverType(@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall) {
ReceiverParameterDescriptor extensionReceiver = resolvedCall.getResultingDescriptor().getExtensionReceiverParameter();
assert extensionReceiver != null : "Extension receiver should be non-null";
return extensionReceiver.getType();
}
@Nullable
private static KtExpression getSingleArgumentExpression(@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall) {
List<ResolvedValueArgument> resolvedValueArguments = resolvedCall.getValueArgumentsByIndex();
if (resolvedValueArguments == null) return null;
if (resolvedValueArguments.size() != 1) return null;
List<ValueArgument> valueArguments = resolvedValueArguments.get(0).getArguments();
if (valueArguments.size() != 1) return null;
return valueArguments.get(0).getArgumentExpression();
}
private OwnerKind contextKind() {
return context.getContextKind();
}
@@ -765,9 +800,15 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// This method consumes range/progression from stack
// The result is stored to local variable
protected void generateRangeOrProgressionProperty(Type loopRangeType, String getterName, Type elementType, int varToStore) {
v.invokevirtual(loopRangeType.getInternalName(), getterName, "()" + elementType.getDescriptor(), false);
v.store(varToStore, elementType);
protected void generateRangeOrProgressionProperty(
@NotNull Type loopRangeType,
@NotNull String getterName,
@NotNull Type getterReturnType,
@NotNull Type varType,
int varToStore
) {
v.invokevirtual(loopRangeType.getInternalName(), getterName, "()" + getterReturnType.getDescriptor(), false);
StackValue.local(varToStore, varType).store(StackValue.onStack(getterReturnType), v);
}
}
@@ -922,6 +963,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
private abstract class AbstractForInProgressionOrRangeLoopGenerator extends AbstractForLoopGenerator {
protected int endVar;
private StackValue loopParameter;
private AbstractForInProgressionOrRangeLoopGenerator(@NotNull KtForExpression forExpression) {
super(forExpression);
@@ -948,8 +991,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
protected void checkPostCondition(@NotNull Label loopExit) {
assert endVar != -1 :
"endVar must be allocated, endVar = " + endVar;
v.load(loopParameterVar, asmElementType);
loopParameter().put(asmElementType, v);
v.load(endVar, asmElementType);
if (asmElementType.getSort() == Type.LONG) {
v.lcmp();
@@ -963,11 +1005,27 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
@Override
public void checkPreCondition(@NotNull Label loopExit) {
}
@NotNull
protected StackValue loopParameter() {
if (loopParameter == null) {
loopParameter = StackValue.local(loopParameterVar, loopParameterType);
}
return loopParameter;
}
}
private abstract class AbstractForInRangeLoopGenerator extends AbstractForInProgressionOrRangeLoopGenerator {
private AbstractForInRangeLoopGenerator(@NotNull KtForExpression forExpression) {
private final int step;
private AbstractForInRangeLoopGenerator(@NotNull KtForExpression forExpression, int step) {
super(forExpression);
this.step = step;
assert step == 1 || step == -1 : "'step' should be either 1 or -1: " + step;
}
private AbstractForInRangeLoopGenerator(@NotNull KtForExpression forExpression) {
this(forExpression, 1);
}
@Override
@@ -981,15 +1039,24 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
@Override
public void checkEmptyLoop(@NotNull Label loopExit) {
v.load(loopParameterVar, asmElementType);
loopParameter().put(asmElementType, v);
v.load(endVar, asmElementType);
if (asmElementType.getSort() == Type.LONG) {
v.lcmp();
v.ifgt(loopExit);
if (step > 0) {
v.ifgt(loopExit);
}
else {
v.iflt(loopExit);
}
}
else {
v.ificmpgt(loopExit);
if (step > 0) {
v.ificmpgt(loopExit);
}
else {
v.ificmplt(loopExit);
}
}
}
@@ -1001,35 +1068,49 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
protected void increment(@NotNull Label loopExit) {
checkPostCondition(loopExit);
if (asmElementType == Type.INT_TYPE) {
v.iinc(loopParameterVar, 1);
if (loopParameterType == Type.INT_TYPE) {
v.iinc(loopParameterVar, step);
}
else {
v.load(loopParameterVar, asmElementType);
genIncrement(asmElementType, 1, v);
v.store(loopParameterVar, asmElementType);
StackValue loopParameter = loopParameter();
loopParameter.put(asmElementType, v);
genIncrement(asmElementType, step, v);
loopParameter.store(StackValue.onStack(asmElementType), v);
}
}
}
private class ForInRangeLiteralLoopGenerator extends AbstractForInRangeLoopGenerator {
private final RangeCodegenUtil.BinaryCall rangeCall;
private final ReceiverValue from;
private final KtExpression to;
private ForInRangeLiteralLoopGenerator(
@NotNull KtForExpression forExpression,
@NotNull RangeCodegenUtil.BinaryCall rangeCall
) {
private ForInRangeLiteralLoopGenerator(@NotNull KtForExpression forExpression, @NotNull ResolvedCall<?> loopRangeCall) {
super(forExpression);
this.rangeCall = rangeCall;
this.from = loopRangeCall.getDispatchReceiver();
this.to = getSingleArgumentExpression(loopRangeCall);
}
@Override
protected void storeRangeStartAndEnd() {
gen(rangeCall.left, asmElementType);
v.store(loopParameterVar, asmElementType);
loopParameter().store(generateReceiverValue(from, false), v);
StackValue.local(endVar, asmElementType).store(gen(to), v);
}
}
gen(rangeCall.right, asmElementType);
v.store(endVar, asmElementType);
private class ForInDownToProgressionLoopGenerator extends AbstractForInRangeLoopGenerator {
private final ReceiverValue from;
private final KtExpression to;
private ForInDownToProgressionLoopGenerator(@NotNull KtForExpression forExpression, @NotNull ResolvedCall<?> loopRangeCall) {
super(forExpression, -1);
this.from = loopRangeCall.getExtensionReceiver();
this.to = getSingleArgumentExpression(loopRangeCall);
}
@Override
protected void storeRangeStartAndEnd() {
loopParameter().store(generateReceiverValue(from, false), v);
StackValue.local(endVar, asmElementType).store(gen(to), v);
}
}
@@ -1047,8 +1128,59 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
v.dup();
// ranges inherit first and last from corresponding progressions
generateRangeOrProgressionProperty(asmLoopRangeType, "getFirst", asmElementType, loopParameterVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getLast", asmElementType, endVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getFirst", asmElementType, loopParameterType, loopParameterVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getLast", asmElementType, asmElementType, endVar);
}
}
private abstract class ForInOptimizedIndicesLoopGenerator extends AbstractForInRangeLoopGenerator {
protected final ReceiverValue receiverValue;
protected final KotlinType expectedReceiverType;
private ForInOptimizedIndicesLoopGenerator(@NotNull KtForExpression forExpression, @NotNull ResolvedCall<?> loopRangeCall) {
super(forExpression);
this.receiverValue = loopRangeCall.getExtensionReceiver();
this.expectedReceiverType = getExpectedReceiverType(loopRangeCall);
}
@Override
protected void storeRangeStartAndEnd() {
loopParameter().store(StackValue.constant(0, asmElementType), v);
StackValue receiver = generateReceiverValue(receiverValue, false);
Type receiverType = asmType(expectedReceiverType);
receiver.put(receiverType, v);
getReceiverSizeAsInt();
v.iconst(1);
v.sub(Type.INT_TYPE);
StackValue.local(endVar, asmElementType).store(StackValue.onStack(Type.INT_TYPE), v);
}
/**
* <code>(receiver -> size:I)</code>
*/
protected abstract void getReceiverSizeAsInt();
}
private class ForInCollectionIndicesRangeLoopGenerator extends ForInOptimizedIndicesLoopGenerator {
private ForInCollectionIndicesRangeLoopGenerator(@NotNull KtForExpression forExpression, @NotNull ResolvedCall<?> loopRangeCall) {
super(forExpression, loopRangeCall);
}
@Override
protected void getReceiverSizeAsInt() {
v.invokeinterface("java/util/Collection", "size", "()I");
}
}
private class ForInArrayIndicesRangeLoopGenerator extends ForInOptimizedIndicesLoopGenerator {
private ForInArrayIndicesRangeLoopGenerator(@NotNull KtForExpression forExpression, @NotNull ResolvedCall<?> loopRangeCall) {
super(forExpression, loopRangeCall);
}
@Override
protected void getReceiverSizeAsInt() {
v.arraylength();
}
}
@@ -1079,15 +1211,14 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
v.dup();
v.dup();
generateRangeOrProgressionProperty(asmLoopRangeType, "getFirst", asmElementType, loopParameterVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getLast", asmElementType, endVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getStep", incrementType, incrementVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getFirst", asmElementType, loopParameterType, loopParameterVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getLast", asmElementType, asmElementType, endVar);
generateRangeOrProgressionProperty(asmLoopRangeType, "getStep", incrementType, incrementType, incrementVar);
}
@Override
public void checkEmptyLoop(@NotNull Label loopExit) {
v.load(loopParameterVar, asmElementType);
loopParameter().put(asmElementType, v);
v.load(endVar, asmElementType);
v.load(incrementVar, incrementType);
@@ -1132,7 +1263,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
protected void increment(@NotNull Label loopExit) {
checkPostCondition(loopExit);
v.load(loopParameterVar, asmElementType);
StackValue loopParameter = loopParameter();
loopParameter.put(asmElementType, v);
v.load(incrementVar, asmElementType);
v.add(asmElementType);
@@ -1140,7 +1272,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
StackValue.coerce(Type.INT_TYPE, asmElementType, v);
}
v.store(loopParameterVar, asmElementType);
loopParameter.store(StackValue.onStack(asmElementType), v);
}
}
@@ -1163,44 +1295,44 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
) {
assert expression instanceof KtContinueExpression || expression instanceof KtBreakExpression;
if (!blockStackElements.isEmpty()) {
BlockStackElement stackElement = blockStackElements.peek();
if (stackElement instanceof FinallyBlockStackElement) {
FinallyBlockStackElement finallyBlockStackElement = (FinallyBlockStackElement) stackElement;
//noinspection ConstantConditions
genFinallyBlockOrGoto(finallyBlockStackElement, null, afterBreakContinueLabel);
}
else if (stackElement instanceof LoopBlockStackElement) {
LoopBlockStackElement loopBlockStackElement = (LoopBlockStackElement) stackElement;
KtSimpleNameExpression labelElement = expression.getTargetLabel();
//noinspection ConstantConditions
if (labelElement == null ||
loopBlockStackElement.targetLabel != null &&
labelElement.getReferencedName().equals(loopBlockStackElement.targetLabel.getReferencedName())) {
final Label label = isBreak ? loopBlockStackElement.breakLabel : loopBlockStackElement.continueLabel;
return StackValue.operation(Type.VOID_TYPE, new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter adapter) {
PseudoInsnsKt.fixStackAndJump(v, label);
v.mark(afterBreakContinueLabel);
return Unit.INSTANCE;
}
}
);
}
}
else {
throw new UnsupportedOperationException("Wrong BlockStackElement in processing stack");
}
blockStackElements.pop();
StackValue result = generateBreakOrContinueExpression(expression, isBreak, afterBreakContinueLabel);
blockStackElements.push(stackElement);
return result;
if (blockStackElements.isEmpty()) {
throw new UnsupportedOperationException("Target label for break/continue not found");
}
throw new UnsupportedOperationException("Target label for break/continue not found");
BlockStackElement stackElement = blockStackElements.peek();
if (stackElement instanceof FinallyBlockStackElement) {
FinallyBlockStackElement finallyBlockStackElement = (FinallyBlockStackElement) stackElement;
//noinspection ConstantConditions
genFinallyBlockOrGoto(finallyBlockStackElement, null, afterBreakContinueLabel);
}
else if (stackElement instanceof LoopBlockStackElement) {
LoopBlockStackElement loopBlockStackElement = (LoopBlockStackElement) stackElement;
KtSimpleNameExpression labelElement = expression.getTargetLabel();
//noinspection ConstantConditions
if (labelElement == null ||
loopBlockStackElement.targetLabel != null &&
labelElement.getReferencedName().equals(loopBlockStackElement.targetLabel.getReferencedName())) {
final Label label = isBreak ? loopBlockStackElement.breakLabel : loopBlockStackElement.continueLabel;
return StackValue.operation(Type.VOID_TYPE, new Function1<InstructionAdapter, Unit>() {
@Override
public Unit invoke(InstructionAdapter adapter) {
PseudoInsnsKt.fixStackAndJump(v, label);
v.mark(afterBreakContinueLabel);
return Unit.INSTANCE;
}
}
);
}
}
else {
throw new UnsupportedOperationException("Wrong BlockStackElement in processing stack");
}
blockStackElements.pop();
StackValue result = generateBreakOrContinueExpression(expression, isBreak, afterBreakContinueLabel);
blockStackElements.push(stackElement);
return result;
}
private StackValue generateSingleBranchIf(
@@ -1555,7 +1687,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
throw new IllegalStateException("Can't get outer value in " + this + " for " + d);
}
private StackValue generateBlock(
private StackValueWithLeaveTask generateBlock(
List<KtExpression> statements,
boolean isStatement,
Label labelBeforeLastExpression,
@@ -1983,8 +2115,14 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
VariableAsFunctionResolvedCall call = (VariableAsFunctionResolvedCall) resolvedCall;
resolvedCall = call.getVariableCall();
}
receiver = StackValue.receiver(resolvedCall, receiver, this, null);
descriptor = resolvedCall.getResultingDescriptor();
//Check early if KCallableNameProperty is applicable to prevent closure generation
StackValue intrinsicResult = applyIntrinsic(descriptor, KCallableNameProperty.class, resolvedCall, receiver);
if (intrinsicResult != null) return intrinsicResult;
receiver = StackValue.receiver(resolvedCall, receiver, this, null);
if (descriptor instanceof FakeCallableDescriptorForObject) {
descriptor = ((FakeCallableDescriptorForObject) descriptor).getReferencedDescriptor();
}
@@ -1997,17 +2135,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
if (isSyntheticField) {
descriptor = ((SyntheticFieldDescriptor) descriptor).getPropertyDescriptor();
}
if (descriptor instanceof CallableMemberDescriptor) {
CallableMemberDescriptor memberDescriptor = DescriptorUtils.unwrapFakeOverride((CallableMemberDescriptor) descriptor);
IntrinsicMethod intrinsic = state.getIntrinsics().getIntrinsic(memberDescriptor);
if (intrinsic instanceof IntrinsicPropertyGetter) {
//TODO: intrinsic properties (see intermediateValueForProperty)
Type returnType = typeMapper.mapType(memberDescriptor);
StackValue intrinsicResult = ((IntrinsicPropertyGetter) intrinsic).generate(resolvedCall, this, returnType, receiver);
if (intrinsicResult != null) return intrinsicResult;
}
}
StackValue intrinsicResult = applyIntrinsic(descriptor, IntrinsicPropertyGetter.class, resolvedCall, receiver);
if (intrinsicResult != null) return intrinsicResult;
if (descriptor instanceof PropertyDescriptor) {
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
@@ -2056,6 +2186,25 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
throw new UnsupportedOperationException("don't know how to generate reference " + descriptor);
}
@Nullable
private StackValue applyIntrinsic(
DeclarationDescriptor descriptor,
Class<? extends IntrinsicPropertyGetter> intrinsicType,
ResolvedCall<?> resolvedCall,
@NotNull StackValue receiver
) {
if (descriptor instanceof CallableMemberDescriptor) {
CallableMemberDescriptor memberDescriptor = DescriptorUtils.unwrapFakeOverride((CallableMemberDescriptor) descriptor);
IntrinsicMethod intrinsic = state.getIntrinsics().getIntrinsic(memberDescriptor);
if (intrinsicType.isInstance(intrinsic)) {
//TODO: intrinsic properties (see intermediateValueForProperty)
Type returnType = typeMapper.mapType(memberDescriptor);
return ((IntrinsicPropertyGetter) intrinsic).generate(resolvedCall, this, returnType, receiver);
}
}
return null;
}
@Nullable
private ClassDescriptor getSuperCallTarget(@NotNull Call call) {
KtSuperExpression superExpression = CallResolverUtilKt.getSuperCallExpression(call);
@@ -2718,7 +2867,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
if (hasSpread) {
boolean arrayOfReferences = KotlinBuiltIns.isArray(outType);
if (size == 1) {
// Arrays.copyOf(array, newLength)
// Arrays.copyOf(receiverValue, newLength)
ValueArgument argument = arguments.get(0);
Type arrayType = arrayOfReferences ? Type.getType("[Ljava/lang/Object;")
: Type.getType("[" + elementType.getDescriptor());
@@ -2836,7 +2985,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
PropertyReferenceCodegen codegen = new PropertyReferenceCodegen(
state, parentCodegen, context.intoAnonymousClass(classDescriptor, this, OwnerKind.IMPLEMENTATION),
element, classBuilder, resolvedCall
element, classBuilder, variableDescriptor, resolvedCall
);
codegen.generate();
@@ -3334,7 +3483,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
Type storeType;
if (isPrimitiveNumberClassDescriptor && AsmUtil.isPrimitive(asmBaseType)) {
genIncrement(asmResultType, asmBaseType, increment, v);
genIncrement(asmBaseType, increment, v);
storeType = asmBaseType;
}
else {
@@ -3958,7 +4107,7 @@ The "returned" value of try expression with no finally is either the last expres
}
private boolean isExhaustive(@NotNull KtWhenExpression whenExpression, boolean isStatement) {
if (isStatement) {
if (isStatement && !BindingContextUtilsKt.isUsedAsExpression(whenExpression, bindingContext)) {
return Boolean.TRUE.equals(bindingContext.get(BindingContext.IMPLICIT_EXHAUSTIVE_WHEN, whenExpression));
}
else {

View File

@@ -22,30 +22,25 @@ import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
import org.jetbrains.org.objectweb.asm.Type;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isNonCompanionObject;
public class FieldInfo {
private static final CompanionObjectMapping COMPANION_OBJECT_MAPPING = new CompanionObjectMapping(JvmPlatform.INSTANCE.getBuiltIns());
@NotNull
public static FieldInfo createForSingleton(@NotNull ClassDescriptor classDescriptor, @NotNull KotlinTypeMapper typeMapper) {
if (!classDescriptor.getKind().isSingleton() || DescriptorUtils.isEnumEntry(classDescriptor)) {
throw new UnsupportedOperationException("Can't create singleton field for class: " + classDescriptor);
}
if (isNonCompanionObject(classDescriptor) || COMPANION_OBJECT_MAPPING.hasMappingToObject(classDescriptor)) {
if (isNonCompanionObject(classDescriptor) || CompanionObjectMapping.INSTANCE.isMappedIntrinsicCompanionObject(classDescriptor)) {
return createSingletonViaInstance(classDescriptor, typeMapper);
}
else {
ClassDescriptor ownerDescriptor = DescriptorUtils.getParentOfType(classDescriptor, ClassDescriptor.class);
assert ownerDescriptor != null : "Owner not found for class: " + classDescriptor;
Type ownerType = typeMapper.mapType(ownerDescriptor);
return new FieldInfo(ownerType, typeMapper.mapType(classDescriptor), classDescriptor.getName().asString(), true);
}
ClassDescriptor ownerDescriptor = DescriptorUtils.getParentOfType(classDescriptor, ClassDescriptor.class);
assert ownerDescriptor != null : "Owner not found for class: " + classDescriptor;
Type ownerType = typeMapper.mapType(ownerDescriptor);
return new FieldInfo(ownerType, typeMapper.mapType(classDescriptor), classDescriptor.getName().asString(), true);
}
@NotNull

View File

@@ -36,11 +36,9 @@ import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotated;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget;
import org.jetbrains.kotlin.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.SpecialBuiltinMembers;
import org.jetbrains.kotlin.load.kotlin.nativeDeclarations.NativeKt;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.KtElement;
import org.jetbrains.kotlin.psi.KtFunction;
@@ -49,11 +47,11 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.constants.ArrayValue;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.resolve.constants.KClassValue;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
@@ -169,9 +167,7 @@ public class FunctionCodegen {
flags |= ACC_SYNTHETIC;
}
boolean isNative = NativeKt.hasNativeAnnotation(functionDescriptor);
if (isNative && owner instanceof MultifileClassFacadeContext) {
if (functionDescriptor.isExternal() && owner instanceof MultifileClassFacadeContext) {
// Native methods are only defined in facades and do not need package part implementations
return;
}
@@ -198,7 +194,7 @@ public class FunctionCodegen {
parentBodyCodegen.addAdditionalTask(new JvmStaticGenerator(functionDescriptor, origin, state, parentBodyCodegen));
}
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES || isAbstractMethod(functionDescriptor, contextKind)) {
if (!state.getClassBuilderMode().generateBodies || isAbstractMethod(functionDescriptor, contextKind)) {
generateLocalVariableTable(
mv,
jvmSignature,
@@ -213,7 +209,7 @@ public class FunctionCodegen {
return;
}
if (!isNative) {
if (!functionDescriptor.isExternal()) {
generateMethodBody(mv, functionDescriptor, methodContext, jvmSignature, strategy, memberCodegen);
}
else if (staticInCompanionObject) {
@@ -564,9 +560,6 @@ public class FunctionCodegen {
// equals(Any?), hashCode(), toString() never need bridges
if (isMethodOfAny(descriptor)) return;
// If the function doesn't have a physical declaration among super-functions, it's a SAM adapter or alike and doesn't need bridges
if (CallResolverUtilKt.isOrOverridesSynthesized(descriptor)) return;
boolean isSpecial = SpecialBuiltinMembers.getOverriddenBuiltinReflectingJvmDescriptor(descriptor) != null;
Set<Bridge<Method>> bridgesToGenerate;
@@ -706,7 +699,7 @@ public class FunctionCodegen {
// enum constructors have two additional synthetic parameters which somewhat complicate this task
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(functionDescriptor, defaultMethod.getReturnType());
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateBodies) {
if (this.owner instanceof MultifileClassFacadeContext) {
mv.visitCode();
generateFacadeDelegateMethodBody(mv, defaultMethod, (MultifileClassFacadeContext) this.owner);
@@ -880,7 +873,7 @@ public class FunctionCodegen {
MethodVisitor mv =
v.newMethod(JvmDeclarationOriginKt.Bridge(descriptor, origin), flags, bridge.getName(), bridge.getDescriptor(), null, null);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
if (!state.getClassBuilderMode().generateBodies) return;
mv.visitCode();

View File

@@ -27,7 +27,6 @@ import kotlin.jvm.functions.Function2;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
import org.jetbrains.kotlin.backend.common.CodegenUtilKt;
import org.jetbrains.kotlin.backend.common.DataClassMethodGenerator;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.codegen.binding.MutableClosure;
@@ -50,7 +49,6 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
@@ -158,7 +156,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (!ktClass.hasModifier(KtTokens.OPEN_KEYWORD) && !isAbstract) {
// Light-class mode: Do not make enum classes final since PsiClass corresponding to enum is expected to be inheritable from
isFinal = !(ktClass.isEnum() && state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES);
isFinal = !(ktClass.isEnum() && !state.getClassBuilderMode().generateBodies);
}
isStatic = !ktClass.isInner();
}
@@ -169,8 +167,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
int access = 0;
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES && !DescriptorUtils.isTopLevelDeclaration(descriptor)) {
// ClassBuilderMode.LIGHT_CLASSES means we are generating light classes & looking at a nested or inner class
if (!state.getClassBuilderMode().generateBodies && !DescriptorUtils.isTopLevelDeclaration(descriptor)) {
// !ClassBuilderMode.generateBodies 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
@@ -265,7 +263,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
private void writeEnclosingMethod() {
// Do not emit enclosing method in "light-classes mode" since currently we generate local light classes as if they're top level
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) {
if (!state.getClassBuilderMode().generateBodies) {
return;
}
@@ -412,72 +410,78 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
private boolean isGenericToArrayPresent() {
Collection<SimpleFunctionDescriptor> functions =
descriptor.getDefaultType().getMemberScope().getContributedFunctions(Name.identifier("toArray"), NoLookupLocation.FROM_BACKEND);
for (FunctionDescriptor function : functions) {
if (CallResolverUtilKt.isOrOverridesSynthesized(function)) {
continue;
}
private boolean isGenericToArray(@NotNull FunctionDescriptor function) {
if (function.getValueParameters().size() != 1 || function.getTypeParameters().size() != 1) {
return false;
}
if (function.getValueParameters().size() != 1 || function.getTypeParameters().size() != 1) {
continue;
}
KotlinType returnType = function.getReturnType();
assert returnType != null : function.toString();
KotlinType paramType = function.getValueParameters().get(0).getType();
if (KotlinBuiltIns.isArray(returnType) && KotlinBuiltIns.isArray(paramType)) {
KotlinType elementType = function.getTypeParameters().get(0).getDefaultType();
if (KotlinTypeChecker.DEFAULT.equalTypes(elementType, DescriptorUtilsKt.getBuiltIns(descriptor).getArrayElementType(returnType))
&& KotlinTypeChecker.DEFAULT.equalTypes(elementType, DescriptorUtilsKt
.getBuiltIns(descriptor).getArrayElementType(paramType))) {
return true;
}
KotlinType returnType = function.getReturnType();
assert returnType != null : function.toString();
KotlinType paramType = function.getValueParameters().get(0).getType();
if (KotlinBuiltIns.isArray(returnType) && KotlinBuiltIns.isArray(paramType)) {
KotlinType elementType = function.getTypeParameters().get(0).getDefaultType();
KotlinBuiltIns builtIns = DescriptorUtilsKt.getBuiltIns(descriptor);
if (KotlinTypeChecker.DEFAULT.equalTypes(elementType, builtIns.getArrayElementType(returnType))
&& KotlinTypeChecker.DEFAULT.equalTypes(elementType, builtIns.getArrayElementType(paramType))) {
return true;
}
}
return false;
return false;
}
private static boolean isNonGenericToArray(@NotNull FunctionDescriptor function) {
if (!function.getValueParameters().isEmpty() || !function.getTypeParameters().isEmpty()) {
return false;
}
KotlinType returnType = function.getReturnType();
return returnType != null && KotlinBuiltIns.isArray(returnType);
}
private void generateToArray() {
if (descriptor.getKind() == ClassKind.INTERFACE) return;
KotlinBuiltIns builtIns = DescriptorUtilsKt.getBuiltIns(descriptor);
if (!isSubclass(descriptor, builtIns.getCollection())) return;
int access = descriptor.getKind() == ClassKind.INTERFACE ?
ACC_PUBLIC | ACC_ABSTRACT :
ACC_PUBLIC;
if (CodegenUtil.getDeclaredFunctionByRawSignature(descriptor, Name.identifier("toArray"), builtIns.getArray()) == null) {
MethodVisitor mv = v.newMethod(NO_ORIGIN, access, "toArray", "()[Ljava/lang/Object;", null, null);
if (descriptor.getKind() != ClassKind.INTERFACE) {
InstructionAdapter iv = new InstructionAdapter(mv);
mv.visitCode();
iv.load(0, classAsmType);
iv.invokestatic("kotlin/jvm/internal/CollectionToArray", "toArray", "(Ljava/util/Collection;)[Ljava/lang/Object;", false);
iv.areturn(Type.getType("[Ljava/lang/Object;"));
FunctionCodegen.endVisit(mv, "toArray", myClass);
}
Collection<SimpleFunctionDescriptor> functions = descriptor.getDefaultType().getMemberScope().getContributedFunctions(
Name.identifier("toArray"), NoLookupLocation.FROM_BACKEND
);
boolean hasGenericToArray = false;
boolean hasNonGenericToArray = false;
for (FunctionDescriptor function : functions) {
hasGenericToArray |= isGenericToArray(function);
hasNonGenericToArray |= isNonGenericToArray(function);
}
if (!isGenericToArrayPresent()) {
MethodVisitor mv = v.newMethod(NO_ORIGIN, access, "toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;", null, null);
if (!hasNonGenericToArray) {
MethodVisitor mv = v.newMethod(NO_ORIGIN, ACC_PUBLIC, "toArray", "()[Ljava/lang/Object;", null, null);
if (descriptor.getKind() != ClassKind.INTERFACE) {
InstructionAdapter iv = new InstructionAdapter(mv);
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);
mv.visitCode();
iv.load(0, classAsmType);
iv.load(1, Type.getType("[Ljava/lang/Object;"));
iv.load(0, classAsmType);
iv.invokestatic("kotlin/jvm/internal/CollectionToArray", "toArray", "(Ljava/util/Collection;)[Ljava/lang/Object;", false);
iv.areturn(Type.getType("[Ljava/lang/Object;"));
iv.invokestatic("kotlin/jvm/internal/CollectionToArray", "toArray",
"(Ljava/util/Collection;[Ljava/lang/Object;)[Ljava/lang/Object;", false);
iv.areturn(Type.getType("[Ljava/lang/Object;"));
FunctionCodegen.endVisit(mv, "toArray", myClass);
}
FunctionCodegen.endVisit(mv, "toArray", myClass);
}
if (!hasGenericToArray) {
MethodVisitor mv = v.newMethod(NO_ORIGIN, ACC_PUBLIC, "toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;", null, null);
InstructionAdapter iv = new InstructionAdapter(mv);
mv.visitCode();
iv.load(0, classAsmType);
iv.load(1, Type.getType("[Ljava/lang/Object;"));
iv.invokestatic("kotlin/jvm/internal/CollectionToArray", "toArray",
"(Ljava/util/Collection;[Ljava/lang/Object;)[Ljava/lang/Object;", false);
iv.areturn(Type.getType("[Ljava/lang/Object;"));
FunctionCodegen.endVisit(mv, "toArray", myClass);
}
}
@@ -496,7 +500,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
@Override
public void generateEqualsMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties) {
public void generateEqualsMethod(@NotNull FunctionDescriptor function, @NotNull List<? extends PropertyDescriptor> properties) {
MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function);
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null);
InstructionAdapter iv = new InstructionAdapter(mv);
@@ -553,7 +557,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
@Override
public void generateHashCodeMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties) {
public void generateHashCodeMethod(@NotNull FunctionDescriptor function, @NotNull List<? extends PropertyDescriptor> properties) {
MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function);
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "hashCode", "()I", null, null);
InstructionAdapter iv = new InstructionAdapter(mv);
@@ -602,7 +606,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
@Override
public void generateToStringMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties) {
public void generateToStringMethod(@NotNull FunctionDescriptor function, @NotNull List<? extends PropertyDescriptor> properties) {
MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function);
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null);
InstructionAdapter iv = new InstructionAdapter(mv);
@@ -654,7 +658,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
Type type = typeMapper.mapType(propertyDescriptor.getType());
String fieldName = ((FieldOwnerContext) context.getParentContext()).getFieldName(propertyDescriptor, false);
iv.getfield(classAsmType.getInternalName(), fieldName, type.getDescriptor());
return type.getReturnType();
return type;
}
else {
//noinspection ConstantConditions
@@ -692,7 +696,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
@Override
public void generateCopyFunction(@NotNull final FunctionDescriptor function, @NotNull List<KtParameter> constructorParameters) {
public void generateCopyFunction(
@NotNull final FunctionDescriptor function,
@NotNull List<? extends KtParameter> constructorParameters
) {
final Type thisDescriptorType = typeMapper.mapType(descriptor);
functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(myClass, function), function, new FunctionGenerationStrategy() {
@@ -801,7 +808,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
JvmDeclarationOriginKt.OtherOrigin(myClass, valuesFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUES.asString(),
"()" + type.getDescriptor(), null, null
);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
if (!state.getClassBuilderMode().generateBodies) return;
mv.visitCode();
mv.visitFieldInsn(GETSTATIC, classAsmType.getInternalName(), ENUM_VALUES_FIELD_NAME, type.getDescriptor());
@@ -821,7 +828,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
});
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(myClass, valueOfFunction), ACC_PUBLIC | ACC_STATIC, ENUM_VALUE_OF.asString(),
"(Ljava/lang/String;)" + classAsmType.getDescriptor(), null, null);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
if (!state.getClassBuilderMode().generateBodies) return;
mv.visitCode();
mv.visitLdcInsn(classAsmType);
@@ -841,7 +848,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
ACC_PUBLIC | ACC_STATIC | ACC_FINAL,
field.name, field.type.getDescriptor(), null, null);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
if (!state.getClassBuilderMode().generateBodies) return;
// Invoke the object constructor but ignore the result because INSTANCE will be initialized in the first line of <init>
InstructionAdapter v = createOrGetClInitCodegen().v;
markLineNumberForElement(element, v);
@@ -881,7 +888,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
//This field are always static and final so if it has constant initializer don't do anything in clinit,
//field would be initialized via default value in v.newField(...) - see JVM SPEC Ch.4
// TODO: test this code
if (state.getClassBuilderMode() == ClassBuilderMode.FULL && info.defaultValue == null) {
if (state.getClassBuilderMode().generateBodies && info.defaultValue == null) {
ExpressionCodegen codegen = createOrGetClInitCodegen();
int companionObjectIndex = putCompanionObjectInLocalVar(codegen);
StackValue.local(companionObjectIndex, OBJECT_TYPE).put(OBJECT_TYPE, codegen.v);
@@ -1171,7 +1178,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
KotlinType expressionType = expression != null ? bindingContext.getType(expression) : null;
Type asmType =
expressionType != null ? typeMapper.mapType(expressionType) : typeMapper.mapType(getSuperClass(specifier));
result.addField((KtDelegatedSuperTypeEntry) specifier, asmType, "$delegate_" + n);
result.addField((KtDelegatedSuperTypeEntry) specifier, asmType, JvmAbi.DELEGATE_SUPER_FIELD_PREFIX + n);
}
n++;
}
@@ -1200,7 +1207,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
private void lookupConstructorExpressionsInClosureIfPresent() {
if (state.getClassBuilderMode() != ClassBuilderMode.FULL || descriptor.getConstructors().isEmpty()) return;
if (!state.getClassBuilderMode().generateBodies || descriptor.getConstructors().isEmpty()) return;
KtVisitorVoid visitor = new KtVisitorVoid() {
@Override
@@ -1267,6 +1274,11 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
}
@Override
public void visitSuperExpression(@NotNull KtSuperExpression expression) {
lookupInContext(ExpressionCodegen.getSuperCallLabelTarget(context, expression));
}
};
for (KtDeclaration declaration : myClass.getDeclarations()) {
@@ -1293,21 +1305,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
assert delegateExpression != null;
delegateExpression.accept(visitor);
}
}
ClassDescriptor superClass = DescriptorUtilsKt.getSuperClassNotAny(descriptor);
if (superClass != null) {
if (superClass.isInner()) {
context.lookupInContext(superClass.getContainingDeclaration(), StackValue.LOCAL_0, state, true);
}
ConstructorDescriptor primaryConstructor = descriptor.getUnsubstitutedPrimaryConstructor();
if (primaryConstructor != null && !isAnonymousObject(descriptor)) {
ResolvedCall<ConstructorDescriptor> delegationCall = getDelegationConstructorCall(bindingContext, primaryConstructor);
KtValueArgumentList argumentList = delegationCall != null ? delegationCall.getCall().getValueArgumentList() : null;
if (argumentList != null) {
argumentList.accept(visitor);
}
else if (specifier instanceof KtSuperTypeCallEntry) {
specifier.accept(visitor);
}
}
}
@@ -1565,7 +1564,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
private void initializeEnumConstants(@NotNull List<KtEnumEntry> enumEntries) {
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
if (!state.getClassBuilderMode().generateBodies) return;
ExpressionCodegen codegen = createOrGetClInitCodegen();
InstructionAdapter iv = codegen.v;
@@ -1640,8 +1639,9 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
fieldInfo.name, fieldInfo.type.getDescriptor(), /*TODO*/null, null);
}
protected void generateDelegates(ClassDescriptor toTrait, KotlinType delegateExpressionType, DelegationFieldsInfo.Field field) {
for (Map.Entry<CallableMemberDescriptor, CallableDescriptor> entry : CodegenUtilKt.getDelegates(descriptor, toTrait, delegateExpressionType).entrySet()) {
private void generateDelegates(ClassDescriptor toTrait, KotlinType delegateExpressionType, DelegationFieldsInfo.Field field) {
for (Map.Entry<CallableMemberDescriptor, CallableDescriptor> entry :
CodegenUtil.getDelegates(descriptor, toTrait, delegateExpressionType).entrySet()) {
CallableMemberDescriptor callableMemberDescriptor = entry.getKey();
CallableDescriptor delegateTo = entry.getValue();
if (callableMemberDescriptor instanceof PropertyDescriptor) {

View File

@@ -146,8 +146,27 @@ public class JvmCodegenUtil {
return false;
}
// Only properties of the same class can be directly accessed, except when we are evaluating expressions in the debugger
if (!isCallInsideSameClassAsDeclared(property, context) && !isDebuggerContext(context)) return false;
if (!isCallInsideSameClassAsDeclared(property, context)) {
if (!isDebuggerContext(context)) {
// Unless we are evaluating expression in debugger context, only properties of the same class can be directly accessed
return false;
}
else {
// In debugger we want to access through accessors if they are generated
// Non default accessors must always be generated
for (PropertyAccessorDescriptor accessorDescriptor : property.getAccessors()) {
if (!accessorDescriptor.isDefault()) {
if (forGetter == accessorDescriptor instanceof PropertyGetterDescriptor) {
return false;
}
}
}
// If property overrides something, accessors must be generated too
if (!property.getOverriddenDescriptors().isEmpty()) return false;
}
}
// Delegated and extension properties have no backing fields
if (isDelegated || property.getExtensionReceiverParameter() != null) return false;

View File

@@ -109,9 +109,9 @@ public class JvmRuntimeTypes {
}
@NotNull
public KotlinType getSupertypeForPropertyReference(@NotNull PropertyDescriptor descriptor) {
public KotlinType getSupertypeForPropertyReference(@NotNull PropertyDescriptor descriptor, boolean isMutable) {
int arity = (descriptor.getExtensionReceiverParameter() != null ? 1 : 0) +
(descriptor.getDispatchReceiverParameter() != null ? 1 : 0);
return (descriptor.isVar() ? mutablePropertyReferences : propertyReferences).get(arity).getDefaultType();
return (isMutable ? mutablePropertyReferences : propertyReferences).get(arity).getDefaultType();
}
}

View File

@@ -82,12 +82,13 @@ class JvmStaticGenerator(
}
companion object {
@JvmStatic fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
@JvmStatic
fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
val memberDescriptor = if (descriptor is PropertyAccessorDescriptor) descriptor.correspondingProperty else descriptor
val copies = CodegenUtil.copyFunctions(
memberDescriptor,
memberDescriptor,
descriptor.containingDeclaration.containingDeclaration,
descriptor.containingDeclaration.containingDeclaration!!,
descriptor.modality,
descriptor.visibility,
CallableMemberDescriptor.Kind.SYNTHESIZED,

View File

@@ -82,7 +82,7 @@ public class KotlinCodegenFacade {
}
private static void doCheckCancelled(GenerationState state) {
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateBodies) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
}
}

View File

@@ -119,7 +119,7 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
generateSyntheticParts();
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateMetadata) {
generateKotlinMetadataAnnotation();
}
@@ -233,7 +233,7 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
}
private static void badDescriptor(ClassDescriptor descriptor, ClassBuilderMode mode) {
if (mode != ClassBuilderMode.LIGHT_CLASSES) {
if (mode.generateBodies) {
throw new IllegalStateException("Generating bad descriptor in ClassBuilderMode = " + mode + ": " + descriptor);
}
}
@@ -408,10 +408,11 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
KtExpression initializer = property.getInitializer();
ConstantValue<?> initializerValue = computeInitializerValue(property, propertyDescriptor, initializer);
ConstantValue<?> initializerValue =
initializer != null ? ExpressionCodegen.getCompileTimeConstant(initializer, bindingContext) : null;
// we must write constant values for fields in light classes,
// because Java's completion for annotation arguments uses this information
if (initializerValue == null) return state.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES;
if (initializerValue == null) return state.getClassBuilderMode().generateBodies;
//TODO: OPTIMIZATION: don't initialize static final fields
KotlinType jetType = getPropertyOrDelegateType(property, propertyDescriptor);
@@ -419,19 +420,6 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
return !skipDefaultValue(propertyDescriptor, initializerValue.getValue(), type);
}
@Nullable
private ConstantValue<?> computeInitializerValue(
@NotNull KtProperty property,
@NotNull PropertyDescriptor propertyDescriptor,
@Nullable KtExpression initializer
) {
if (property.isVar() && initializer != null) {
BindingTrace tempTrace = TemporaryBindingTrace.create(state.getBindingTrace(), "property initializer");
return constantExpressionEvaluator.evaluateToConstantValue(initializer, tempTrace, propertyDescriptor.getType());
}
return propertyDescriptor.getCompileTimeInitializer();
}
@NotNull
private KotlinType getPropertyOrDelegateType(@NotNull KtProperty property, @NotNull PropertyDescriptor descriptor) {
KtExpression delegateExpression = property.getDelegateExpression();
@@ -495,7 +483,7 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
v.newField(NO_ORIGIN, ACC_PRIVATE | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
"[" + K_PROPERTY_TYPE, null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) return;
if (!state.getClassBuilderMode().generateBodies) return;
InstructionAdapter iv = createOrGetClInitCodegen().v;
iv.iconst(delegatedProperties.size());
@@ -569,7 +557,7 @@ public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclaration
fieldAsmType.getDescriptor(), null, null
);
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateBodies) {
InstructionAdapter iv = createOrGetClInitCodegen().v;
iv.anew(thisAsmType);
iv.dup();

View File

@@ -32,7 +32,8 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.MultifileClassKind.*
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.MultifileClassKind.DELEGATING
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.MultifileClassKind.INHERITING
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
@@ -262,7 +263,7 @@ class MultifileClassCodegen(
if (Visibilities.isPrivate(descriptor.visibility)) return false
if (AsmUtil.getVisibilityAccessFlag(descriptor) == Opcodes.ACC_PRIVATE) return false
if (state.classBuilderMode == ClassBuilderMode.LIGHT_CLASSES) return true
if (!state.classBuilderMode.generateBodies) return true
if (shouldGeneratePartHierarchy) {
if (descriptor !is PropertyDescriptor || !descriptor.isConst) return false
@@ -322,7 +323,7 @@ class MultifileClassCodegen(
}
private fun writeKotlinMultifileFacadeAnnotationIfNeeded() {
if (state.classBuilderMode != ClassBuilderMode.FULL) return
if (!state.classBuilderMode.generateMetadata) return
if (files.any { it.isScript }) return
writeKotlinMetadata(classBuilder, KotlinClassHeader.Kind.MULTIFILE_CLASS) { av ->

View File

@@ -24,7 +24,8 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.MultifileClassKind.*
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.MultifileClassKind.DELEGATING
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.MultifileClassKind.INHERITING
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.KtProperty
@@ -45,7 +46,7 @@ class MultifileClassPartCodegen(
private val packageFragment: PackageFragmentDescriptor,
private val superClassInternalName: String,
private val shouldGeneratePartHierarchy: Boolean,
private val partContext: MultifileClassPartContext,
partContext: MultifileClassPartContext,
state: GenerationState
) : MemberCodegen<KtFile>(state, null, partContext, file, v) {
private val partType = partContext.filePartType
@@ -76,7 +77,7 @@ class MultifileClassPartCodegen(
}
override fun generate() {
if (state.classBuilderMode == ClassBuilderMode.LIGHT_CLASSES) return
if (!state.classBuilderMode.generateBodies) return
super.generate()
@@ -131,7 +132,7 @@ class MultifileClassPartCodegen(
}
}
if (state.classBuilderMode == ClassBuilderMode.FULL) {
if (state.classBuilderMode.generateBodies) {
generateInitializers { createOrGetClInitCodegen() }
}
}

View File

@@ -95,7 +95,7 @@ public class PackagePartCodegen extends MemberCodegen<KtFile> {
}
}
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateBodies) {
generateInitializers(new Function0<ExpressionCodegen>() {
@Override
public ExpressionCodegen invoke() {

View File

@@ -120,7 +120,6 @@ public class PropertyCodegen {
assert kind == OwnerKind.PACKAGE || kind == OwnerKind.IMPLEMENTATION || kind == OwnerKind.DEFAULT_IMPLS
: "Generating property with a wrong kind (" + kind + "): " + descriptor;
assert declaration != null : "Declaration is null: " + descriptor + " (context=" + context + ")";
genBackingFieldAndAnnotations(declaration, descriptor, false);
if (isAccessorNeeded(declaration, descriptor, getter)) {
@@ -131,8 +130,10 @@ public class PropertyCodegen {
}
}
private void genBackingFieldAndAnnotations(@NotNull KtNamedDeclaration declaration, @NotNull PropertyDescriptor descriptor, boolean isParameter) {
boolean hasBackingField = hasBackingField(declaration, descriptor);
private void genBackingFieldAndAnnotations(
@Nullable KtNamedDeclaration declaration, @NotNull PropertyDescriptor descriptor, boolean isParameter
) {
boolean hasBackingField = hasBackingField(descriptor);
boolean hasDelegate = declaration instanceof KtProperty && ((KtProperty) declaration).hasDelegate();
AnnotationSplitter annotationSplitter =
@@ -150,6 +151,7 @@ public class PropertyCodegen {
if (isBackingFieldOwner) {
Annotations fieldAnnotations = annotationSplitter.getAnnotationsForTarget(AnnotationUseSiteTarget.FIELD);
Annotations delegateAnnotations = annotationSplitter.getAnnotationsForTarget(AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD);
assert declaration != null : "Declaration is null: " + descriptor + " (context=" + context + ")";
generateBackingField(declaration, descriptor, fieldAnnotations, delegateAnnotations);
generateSyntheticMethodIfNeeded(descriptor, propertyAnnotations);
}
@@ -228,7 +230,7 @@ public class PropertyCodegen {
KtExpression defaultValue = p.getDefaultValue();
if (defaultValue != null) {
ConstantValue<?> constant = ExpressionCodegen.getCompileTimeConstant(defaultValue, bindingContext, true);
assert state.getClassBuilderMode() != ClassBuilderMode.FULL || constant != null
assert !state.getClassBuilderMode().generateBodies || constant != null
: "Default value for annotation parameter should be compile time value: " + defaultValue.getText();
if (constant != null) {
AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(mv, typeMapper);
@@ -239,7 +241,7 @@ public class PropertyCodegen {
mv.visitEnd();
}
private boolean hasBackingField(@NotNull KtNamedDeclaration p, @NotNull PropertyDescriptor descriptor) {
private boolean hasBackingField(@NotNull PropertyDescriptor descriptor) {
return !isJvmInterface(descriptor.getContainingDeclaration()) &&
kind != OwnerKind.DEFAULT_IMPLS &&
!Boolean.FALSE.equals(bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor));
@@ -348,7 +350,7 @@ public class PropertyCodegen {
FieldVisitor fv = builder.newField(
JvmDeclarationOriginKt.OtherOrigin(element, propertyDescriptor), modifiers, name, type.getDescriptor(),
typeMapper.mapFieldSignature(kotlinType, propertyDescriptor), defaultValue
isDelegate ? null : typeMapper.mapFieldSignature(kotlinType, propertyDescriptor), defaultValue
);
Annotated fieldAnnotated = new AnnotatedWithFakeAnnotations(propertyDescriptor, annotations);

View File

@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.builtins.ReflectionTypes
import org.jetbrains.kotlin.codegen.AsmUtil.method
import org.jetbrains.kotlin.codegen.context.ClassContext
import org.jetbrains.kotlin.codegen.state.GenerationState
@@ -44,6 +45,7 @@ class PropertyReferenceCodegen(
context: ClassContext,
expression: KtElement,
classBuilder: ClassBuilder,
private val localVariableDescriptorForReference: VariableDescriptor,
resolvedCall: ResolvedCall<*>
) : MemberCodegen<KtElement>(state, parentCodegen, context, expression, classBuilder) {
private val classDescriptor = context.contextDescriptor
@@ -136,7 +138,7 @@ class PropertyReferenceCodegen(
value.put(OBJECT_TYPE, this)
}
if (!target.isVar) return
if (!ReflectionTypes.isNumberedKMutablePropertyType(localVariableDescriptorForReference.type)) return
val setterParameters = (getterParameters + arrayOf(OBJECT_TYPE))
generateAccessor(method("set", Type.VOID_TYPE, *setterParameters)) { value ->
@@ -148,7 +150,7 @@ class PropertyReferenceCodegen(
private fun generateMethod(debugString: String, access: Int, method: Method, generate: InstructionAdapter.() -> Unit) {
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, method.name, method.descriptor, null, null)
if (state.classBuilderMode == ClassBuilderMode.FULL) {
if (state.classBuilderMode.generateBodies) {
val iv = InstructionAdapter(mv)
iv.visitCode()
iv.generate()
@@ -174,7 +176,7 @@ class PropertyReferenceCodegen(
initialize(property.type)
}
val method = state.typeMapper.mapAsmMethod(getter)
val method = state.typeMapper.mapAsmMethod(getter.original)
return method.name + method.descriptor
}

View File

@@ -19,14 +19,17 @@ package org.jetbrains.kotlin.codegen;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.builtins.PrimitiveType;
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.FqNameUnsafe;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.types.KotlinType;
import java.util.Arrays;
@@ -68,32 +71,23 @@ public class RangeCodegenUtil {
}
@Nullable
public static BinaryCall getRangeAsBinaryCall(@NotNull KtForExpression forExpression) {
// We are looking for rangeTo() calls
// Other binary operations will succeed too, but will be filtered out later (by examining a resolvedCall)
KtExpression rangeExpression = forExpression.getLoopRange();
assert rangeExpression != null;
KtExpression loopRange = KtPsiUtil.deparenthesize(rangeExpression);
public static ResolvedCall<? extends CallableDescriptor> getLoopRangeResolvedCall(@NotNull KtForExpression forExpression, @NotNull BindingContext bindingContext) {
KtExpression loopRange = KtPsiUtil.deparenthesize(forExpression.getLoopRange());
if (loopRange instanceof KtQualifiedExpression) {
// a.rangeTo(b)
KtQualifiedExpression qualifiedExpression = (KtQualifiedExpression) loopRange;
KtExpression selector = qualifiedExpression.getSelectorExpression();
if (selector instanceof KtCallExpression) {
KtCallExpression callExpression = (KtCallExpression) selector;
List<? extends ValueArgument> arguments = callExpression.getValueArguments();
if (arguments.size() == 1) {
return new BinaryCall(qualifiedExpression.getReceiverExpression(), callExpression.getCalleeExpression(),
arguments.get(0).getArgumentExpression());
}
if (selector instanceof KtCallExpression || selector instanceof KtSimpleNameExpression) {
return CallUtilKt.getResolvedCall(selector, bindingContext);
}
}
else if (loopRange instanceof KtBinaryExpression) {
// a rangeTo b
// a .. b
KtBinaryExpression binaryExpression = (KtBinaryExpression) loopRange;
return new BinaryCall(binaryExpression.getLeft(), binaryExpression.getOperationReference(), binaryExpression.getRight());
else if (loopRange instanceof KtSimpleNameExpression || loopRange instanceof KtCallExpression) {
return CallUtilKt.getResolvedCall(loopRange, bindingContext);
}
else if (loopRange instanceof KtBinaryExpression) {
return CallUtilKt.getResolvedCall(((KtBinaryExpression) loopRange).getOperationReference(), bindingContext);
}
return null;
}
@@ -138,15 +132,47 @@ public class RangeCodegenUtil {
return false;
}
public static class BinaryCall {
public final KtExpression left;
public final KtExpression op;
public final KtExpression right;
public static boolean isOptimizableDownTo(@NotNull CallableDescriptor descriptor) {
if (!isTopLevelInPackage(descriptor, "downTo", "kotlin.ranges")) return false;
private BinaryCall(KtExpression left, KtExpression op, KtExpression right) {
this.left = left;
this.op = op;
this.right = right;
}
ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter();
if (extensionReceiver == null) return false;
ClassifierDescriptor extensionReceiverClassifier = extensionReceiver.getType().getConstructor().getDeclarationDescriptor();
if (!isPrimitiveNumberClassDescriptor(extensionReceiverClassifier)) return false;
return true;
}
public static boolean isArrayOrPrimitiveArrayIndices(@NotNull CallableDescriptor descriptor) {
if (!isTopLevelInPackage(descriptor, "indices", "kotlin.collections")) return false;
ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter();
if (extensionReceiver == null) return false;
KotlinType extensionReceiverType = extensionReceiver.getType();
if (!KotlinBuiltIns.isArray(extensionReceiverType) && !KotlinBuiltIns.isPrimitiveArray(extensionReceiverType)) return false;
return true;
}
public static boolean isCollectionIndices(@NotNull CallableDescriptor descriptor) {
if (!isTopLevelInPackage(descriptor, "indices", "kotlin.collections")) return false;
ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter();
if (extensionReceiver == null) return false;
KotlinType extensionReceiverType = extensionReceiver.getType();
if (!KotlinBuiltIns.isCollectionOrNullableCollection(extensionReceiverType)) return false;
return true;
}
private static boolean isTopLevelInPackage(@NotNull CallableDescriptor descriptor, @NotNull String name, @NotNull String packageName) {
if (!name.equals(descriptor.getName().asString())) return false;
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
if (!(containingDeclaration instanceof PackageFragmentDescriptor)) return false;
String packageFqName = ((PackageFragmentDescriptor) containingDeclaration).getFqName().asString();
if (!packageName.equals(packageFqName)) return false;
return true;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,18 +19,16 @@ package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor;
import org.jetbrains.kotlin.load.java.descriptors.SamAdapterDescriptor;
import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor;
public class SamCodegenUtil {
@Nullable
public static FunctionDescriptor getOriginalIfSamAdapter(@NotNull FunctionDescriptor fun) {
if (fun instanceof SamAdapterDescriptor<?>) {
return ((SamAdapterDescriptor<?>) fun).getOriginForSam();
}
if (fun instanceof SamAdapterExtensionFunctionDescriptor) {
return ((SamAdapterExtensionFunctionDescriptor) fun).getSourceFunction();
if (fun instanceof SamAdapterDescriptor<?> || fun instanceof SamAdapterExtensionFunctionDescriptor) {
//noinspection unchecked
return ((SyntheticMemberDescriptor<FunctionDescriptor>) fun).getBaseDescriptorForSynthetic();
}
return null;

View File

@@ -130,7 +130,7 @@ public class SamWrapperCodegen {
MethodVisitor mv = cv.newMethod(JvmDeclarationOriginKt.OtherOrigin(samType.getJavaClassDescriptor()),
visibility, "<init>", Type.getMethodDescriptor(Type.VOID_TYPE, functionType), null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateBodies) {
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);

View File

@@ -132,7 +132,7 @@ public class ScriptCodegen extends MemberCodegen<KtScript> {
ACC_PUBLIC, jvmSignature.getAsmMethod().getName(), jvmSignature.getAsmMethod().getDescriptor(),
null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
if (state.getClassBuilderMode().generateBodies) {
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);

View File

@@ -394,9 +394,10 @@ public abstract class StackValue {
}
}
else if (fromType.getSort() == Type.OBJECT) {
if (fromType.equals(getType(Boolean.class)) || fromType.equals(getType(Character.class))) {
unbox(unboxType(fromType), v);
coerce(unboxType(fromType), toType, v);
Type unboxedType = unboxPrimitiveTypeOrNull(fromType);
if (unboxedType != null) {
unbox(unboxedType, v);
coerce(unboxedType, toType, v);
}
else {
if (toType.getSort() == Type.BOOLEAN || toType.getSort() == Type.CHAR) {
@@ -709,12 +710,13 @@ public abstract class StackValue {
}
}
public static class Constant extends StackValue {
private static class Constant extends StackValue {
@Nullable
private final Object value;
public Constant(@Nullable Object value, Type type) {
super(type, false);
assert !Type.BOOLEAN_TYPE.equals(type) : "Boolean constants should be created via 'StackValue.constant'";
this.value = value;
}
@@ -723,6 +725,9 @@ public abstract class StackValue {
if (value instanceof Integer || value instanceof Byte || value instanceof Short) {
v.iconst(((Number) value).intValue());
}
else if (value instanceof Character) {
v.iconst(((Character) value).charValue());
}
else if (value instanceof Long) {
v.lconst((Long) value);
}
@@ -1146,7 +1151,7 @@ public abstract class StackValue {
value = ((Double) value).floatValue();
}
new Constant(value, this.type).putSelector(type, v);
StackValue.constant(value, this.type).putSelector(type, v);
return true;
}
@@ -1417,7 +1422,7 @@ public abstract class StackValue {
if (descriptor instanceof PropertyDescriptor &&
// hackaround: boxing changes behaviour of T.javaClass intrinsic
!(state.getIntrinsics().getIntrinsic((PropertyDescriptor) descriptor) instanceof JavaClassProperty)
state.getIntrinsics().getIntrinsic((PropertyDescriptor) descriptor) != JavaClassProperty.INSTANCE
) {
ReceiverParameterDescriptor receiverCandidate = descriptor.getExtensionReceiverParameter();
assert receiverCandidate != null;

View File

@@ -59,7 +59,7 @@ class StackValueWithLeaveTask(
}
}
open class OperationStackValue(val resultType: Type, val lambda: (v: InstructionAdapter) -> Unit) : StackValue(resultType) {
open class OperationStackValue(resultType: Type, val lambda: (v: InstructionAdapter) -> Unit) : StackValue(resultType) {
override fun putSelector(type: Type, v: InstructionAdapter) {
lambda(v)

View File

@@ -30,7 +30,7 @@ class AnnotatedWithFakeAnnotations(override val originalAnnotated: Annotated, pr
override fun getAnnotations() = actual
}
class AnnotatedWithOnlyTargetedAnnotations(private val original: Annotated) : Annotated {
class AnnotatedWithOnlyTargetedAnnotations(original: Annotated) : Annotated {
private val annotations: Annotations = UseSiteTargetedAnnotations(original.annotations)
override fun getAnnotations() = annotations

View File

@@ -23,6 +23,7 @@ import com.intellij.util.containers.Stack;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.ReflectionTypes;
import org.jetbrains.kotlin.cfg.WhenChecker;
import org.jetbrains.kotlin.codegen.*;
import org.jetbrains.kotlin.codegen.state.GenerationState;
@@ -46,7 +47,6 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.resolve.constants.EnumValue;
import org.jetbrains.kotlin.resolve.constants.NullValue;
import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.org.objectweb.asm.Type;
@@ -295,7 +295,11 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
callableDescriptor = bindingContext.get(VARIABLE, expression);
if (callableDescriptor == null) return;
supertypes = Collections.singleton(runtimeTypes.getSupertypeForPropertyReference((PropertyDescriptor) target));
//noinspection ConstantConditions
supertypes = Collections.singleton(runtimeTypes.getSupertypeForPropertyReference(
(PropertyDescriptor) target,
ReflectionTypes.Companion.isNumberedKMutablePropertyType(callableDescriptor.getReturnType())
));
}
else {
return;
@@ -335,7 +339,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
if (delegate != null && descriptor instanceof PropertyDescriptor) {
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
String name = inventAnonymousClassName();
KotlinType supertype = runtimeTypes.getSupertypeForPropertyReference(propertyDescriptor);
KotlinType supertype = runtimeTypes.getSupertypeForPropertyReference(propertyDescriptor, propertyDescriptor.isVar());
ClassDescriptor classDescriptor = recordClassForCallable(delegate, propertyDescriptor, Collections.singleton(supertype), name);
recordClosure(classDescriptor, name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -149,7 +149,6 @@ public class CodegenBinding {
closure.setCaptureThis();
}
assert PsiCodegenPredictor.checkPredictedNameFromPsi(classDescriptor, asmType, fileClassesManager);
trace.record(ASM_TYPE, classDescriptor, asmType);
trace.record(CLOSURE, classDescriptor, closure);

View File

@@ -1,126 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen.binding;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.AsmUtil;
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
import org.jetbrains.kotlin.fileClasses.FileClasses;
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.org.objectweb.asm.Type;
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
public final class PsiCodegenPredictor {
private PsiCodegenPredictor() {
}
public static boolean checkPredictedNameFromPsi(
@NotNull DeclarationDescriptor descriptor,
@Nullable Type nameFromDescriptors,
@NotNull JvmFileClassesProvider fileClassesManager
) {
PsiElement element = descriptorToDeclaration(descriptor);
if (element instanceof KtDeclaration) {
String classNameFromPsi = getPredefinedJvmInternalName((KtDeclaration) element, fileClassesManager);
assert classNameFromPsi == null || Type.getObjectType(classNameFromPsi).equals(nameFromDescriptors) :
String.format("Invalid algorithm for getting qualified name from psi! Predicted: %s, actual %s\n" +
"Element: %s", classNameFromPsi, nameFromDescriptors, element.getText());
}
return true;
}
/**
* @return null if no prediction can be done.
*/
@Nullable
public static String getPredefinedJvmInternalName(
@NotNull KtDeclaration declaration,
@NotNull JvmFileClassesProvider fileClassesProvider
) {
// TODO: Method won't work for declarations inside companion objects
// TODO: Method won't give correct class name for traits implementations
if (declaration instanceof KtPropertyAccessor) {
return getPredefinedJvmInternalName(((KtPropertyAccessor) declaration).getProperty(), fileClassesProvider);
}
KtDeclaration parentDeclaration = KtStubbedPsiUtil.getContainingDeclaration(declaration);
String parentInternalName;
if (parentDeclaration != null) {
parentInternalName = getPredefinedJvmInternalName(parentDeclaration, fileClassesProvider);
if (parentInternalName == null) {
return null;
}
}
else {
KtFile containingFile = declaration.getContainingKtFile();
if (declaration instanceof KtNamedFunction || declaration instanceof KtProperty) {
Name name = ((KtNamedDeclaration) declaration).getNameAsName();
return name == null ? null : FileClasses.getFileClassInternalName(fileClassesProvider, containingFile) + "$" + name.asString();
}
parentInternalName = AsmUtil.internalNameByFqNameWithoutInnerClasses(containingFile.getPackageFqName());
}
if (!PsiTreeUtil.instanceOf(declaration, KtClass.class, KtObjectDeclaration.class, KtNamedFunction.class, KtProperty.class) ||
isEnumEntryWithoutBody(declaration)) {
// Other subclasses are not valid for class name prediction.
// For example JetFunctionLiteral
return null;
}
Name name = ((KtNamedDeclaration) declaration).getNameAsName();
if (name == null) {
return null;
}
if (declaration instanceof KtNamedFunction) {
if (!(parentDeclaration instanceof KtClass || parentDeclaration instanceof KtObjectDeclaration)) {
// Can't generate predefined name for internal functions
return null;
}
}
// NOTE: looks like a bug - for class in getter of top level property class name will be $propertyName$ClassName but not
// PackageClassName$propertyName$ClassName
if (declaration instanceof KtProperty) {
return parentInternalName + "$" + name.asString();
}
if (parentInternalName.isEmpty()) {
return name.asString();
}
return parentInternalName + (parentDeclaration == null ? "/" : "$") + name.asString();
}
private static boolean isEnumEntryWithoutBody(KtDeclaration declaration) {
if (!(declaration instanceof KtEnumEntry)) {
return false;
}
KtClassBody body = ((KtEnumEntry) declaration).getBody();
return body == null || body.getDeclarations().size() == 0;
}
}

Some files were not shown because too many files have changed in this diff Show More