Compare commits

...

2111 Commits

Author SHA1 Message Date
Dmitry Jemerov
3674663d30 use Kotlin call hierarchy provider only for Kotlin elements, to ensure that it does not interfere with standard Java features of IntelliJ IDEA
(cherry picked from commit 7004917)
2015-11-26 11:34:34 +01:00
Natalia Ukhorskaya
e74282753a Fix compatibility with AS 2.0
#KT-10153 Fixed
2015-11-24 19:06:47 +03:00
Dmitry Jemerov
bbb92ead5b ensure that the short name of the Kotlin unused import inspection does not clash with Java (KT-10046)
(cherry picked from commit 30084df)
2015-11-20 14:07:12 +01:00
Michael Nedzelsky
08e9ff602f fix KT-10068 JsLibraryStdDetectionUtil does not use caching through JarUserDataManager
#KT-10068 Fixed
(cherry picked from commit ea4470a)
2015-11-19 18:54:44 +01:00
Nikolay Krasko
73596f7464 Enable bootstrapping for the branch 2015-11-19 16:14:54 +03:00
Alexander Udalov
0dcf34bb55 Fix deadlock on static initializers of KProperty implementations
#KT-10041 Fixed
2015-11-19 02:58:00 +03:00
Mikhail Glukhikh
0bcdfce84b Diagnostics corrected for smart cast impossible (cherry picked from commit 03287d5) 2015-11-18 20:13:28 +03:00
Yan Zhulanow
e8be0962c2 Android extensions: get descriptors using reflection (temporary change)
(cherry picked from commit f228c04)
2015-11-17 20:29:53 +03:00
Yan Zhulanow
8afd6421bb Revert "do not package kotlin-runtime and kotlin-reflect into Kotlin Android extensions zip"
This reverts commit 83bf5daf7f.
(cherry picked from commit a1dcede)
2015-11-17 20:29:45 +03:00
Dmitry Jemerov
a946126dca do not package kotlin-runtime and kotlin-reflect into Kotlin Android extensions zip
(cherry picked from commit 83bf5da)
2015-11-17 13:15:24 +01:00
Ilya Gorbunov
47895c0cc2 Correct deprecation replacement for Progression constructors.
Update testdata for LoadBuiltinsTest
2015-11-13 21:57:27 +03:00
Ilya Chernikov
bb6677620a Additional fix to the previous one: Disabling parallel builds without daemon again and undoing apprpriate fix to broken tests problem, since it effectively cancelled fix for parallel building itself and was causing exceptions on heavy builds 2015-11-12 19:14:00 +01:00
Ilya Chernikov
06104521f2 Disabling parallel builds without daemon again and undoing apprpriate fix to broken tests problem, since it effectively cancelled fix for parallel building itself and was causing exceptions on heavy builds 2015-11-12 17:13:26 +01:00
Valentin Kipyatkov
63fc7110a7 KT-9981 Code cleanup replace usages of !in incorrectly
#KT-9981 Fixed
2015-11-12 15:11:07 +03:00
Michael Bogdanov
f5bab93fd1 Additional diagnostic for KT-9980: KotlinFrontEndException: Exception while analyzing expression 2015-11-12 15:11:29 +03:00
Ilya Gorbunov
8f2c05668e Make MutableMap.set return Unit
#KT-7853 Fixed
2015-11-11 19:15:52 +03:00
Ilya Gorbunov
737763cc67 Restore correct sorting order (after cleanup in 17fc1d95) 2015-11-11 19:15:51 +03:00
Ilya Gorbunov
2bd44799f8 Simplify message expression from lambda argument when converting assert to if. 2015-11-11 19:15:50 +03:00
Ilya Gorbunov
e13fb0e7bc Deprecated with ERROR preconditions with eager message. 2015-11-11 19:15:49 +03:00
Ilya Gorbunov
16df7a9d92 Replace getStackTrace usages in j2k and testData. 2015-11-11 19:15:48 +03:00
Ilya Gorbunov
d5d803963f Replace Regex.match and matchAll usages 2015-11-11 19:15:47 +03:00
Ilya Gorbunov
20a15dc175 Refactor intention test files enumerating, do not use deprecated filter method, which would get another behavior after dropping deprecated one. 2015-11-11 19:15:46 +03:00
Ilya Gorbunov
26bd8600cf Drop deprecations and tighten up left ones. 2015-11-11 19:15:45 +03:00
Nikolay Krasko
abb116ef9a Fix locator syntax 2015-11-11 19:06:57 +03:00
Ilya Gorbunov
a336888858 Make emptyMap upperbound to be Any? rather than Any.
#KT-9963
2015-11-11 17:17:42 +03:00
Ilya Gorbunov
19501aac59 Do not override default AbstractList iterator() implementation for primitiveArray.asList wrappers.
#KT-9927 Fixed
2015-11-11 17:17:41 +03:00
Nikolay Krasko
f9ac5ae737 Enable auto-increment in beta2 branch 2015-11-11 17:13:27 +03:00
Dmitry Jemerov
9cb5defc43 don't analyze class repeatedly if we already found an annotated member there
#KT-8557 Fixed
(cherry picked from commit 6f2fb3f)
2015-11-11 15:10:12 +01:00
Valentin Kipyatkov
4782077357 KT-9928 Replacement not offered for a usage of symbol deprecated with DeprecationLevel.ERROR
#KT-9928 Fixed
(cherry picked from commit de11d57)
2015-11-11 17:08:58 +03:00
Ilya Gorbunov
f105329fb4 Fix test dependent on exact documentation wording in stdlib. 2015-11-11 04:05:07 +03:00
Ilya Gorbunov
0fb8419bd1 Update testdata for LoadBuiltinsTest 2015-11-11 03:53:54 +03:00
Ilya Gorbunov
0786027271 Deprecate Range<T> in generated code.
Provide hidden overloads of downTo and until with byte and short parameters for binary compatibility.
2015-11-11 03:53:52 +03:00
Ilya Gorbunov
af9020a010 Update Range and Progression built-in implementations in js library.
No need to define special method mapping for js ranges/progressions.
Support progression companion objects' function fromClosedRange as intrinsic
2015-11-11 03:53:51 +03:00
Ilya Gorbunov
55d4d17dc3 Fix dropped DoubleRange and FloatRange usages in tests 2015-11-11 03:53:49 +03:00
Ilya Gorbunov
6bac3e1986 Drop Ranges, Progressions, ProgressionIterators for Double and Float.
Undeprecate generic Comparable.rangeTo, but return private implementation instead.
Undeprecate contains and coerceIn for generic ranges.
2015-11-11 03:53:47 +03:00
Ilya Gorbunov
4d2f9b82da reversed() behavior changed for progressions. Stepped progression behavior changes: 'end' property is now deprecated, use 'last' instead. 2015-11-11 03:53:45 +03:00
Ilya Gorbunov
ead333531c Update resolve test, since IntRange inherits iterator() from IntProgression and doesn't reimplement it itself. 2015-11-11 03:53:43 +03:00
Ilya Gorbunov
5f675c55ed Fix deprecated ranges and range member usages in tests. 2015-11-11 03:53:42 +03:00
Ilya Gorbunov
5ebb3d20e8 Change internal implementation of progression: use first, last instead of start, end
Keep the end value as it was passed to progression constructor.
Deprecate primary progression constructor and introduce factory method in companion object.
2015-11-11 03:53:40 +03:00
Ilya Gorbunov
2887338f01 Rename InclusiveRange to ClosedRange 2015-11-11 03:53:38 +03:00
Ilya Gorbunov
25da037868 Update range iteration tests and regenerate test data. 2015-11-11 03:53:37 +03:00
Ilya Gorbunov
8a6821d53a Throw correct exception for zero increment.
Deprecate public functions in progression utils.
2015-11-11 03:53:35 +03:00
Ilya Gorbunov
ffa8faab80 Make progression iterators internal. 2015-11-11 03:53:32 +03:00
Ilya Gorbunov
5e6d16103e Remove deprecated ranges from tests and take into account that Byte and Short rangeTo now returns IntRange. 2015-11-11 03:53:31 +03:00
Ilya Gorbunov
854d376988 Eliminate byte and short ranges and progressions from range construction functions' return type. 2015-11-11 03:53:29 +03:00
Ilya Gorbunov
9eb5ba910c Do not reimplement Iterable until Progression is dropped. 2015-11-11 03:53:28 +03:00
Ilya Gorbunov
6ac0ac01b3 Deprecate Byte and Short ranges and progressions.
Inherit TRange from TProgression.
Remove InclusiveRangeProgression and leave generic Progression deprecated.
2015-11-11 03:53:26 +03:00
Ilya Gorbunov
e699ce9e95 Introduce InclusiveRange and InclusiveRangeProgression and deprecate Range and Progression interfaces. 2015-11-11 03:53:25 +03:00
Ilya Gorbunov
cea27dd716 Disable check for "Access to tree elements not allowed in tests" in completion tests. 2015-11-11 03:53:23 +03:00
Ilya Gorbunov
84492fd311 Apply hack to restore mapping between PsiFiles and VirtualFiles, otherwise built-ins psi elements will become invalid in next test. 2015-11-11 03:53:21 +03:00
Ilya Gorbunov
16d56355c3 Special crafting of ClassId when implClassName is nested DefaultImpls 2015-11-11 03:53:20 +03:00
Ilya Gorbunov
2a7a6688d0 Remove obsolete condition from isKotlinJvmCompiledFile() 2015-11-11 03:53:18 +03:00
Ilya Gorbunov
8bdd1e3246 Sorting optimizations: do not make excessive copies, introduce methods to sort the whole array.
#KT-9904 Fixed
2015-11-11 03:29:40 +03:00
Ilya Gorbunov
3e81cdfc5d Deprecate mapIndexedTo for Maps. 2015-11-11 03:12:19 +03:00
Ilya Gorbunov
9323f61eaf Introduce T.addTo(MutableCollection<T>), mapNotNull and mapIndexedNotNull extensions.
#KT-4410 Fixed
2015-11-11 03:12:17 +03:00
Ilya Gorbunov
008a8059cf Introduce filterIndexed
#KT-9502 Fixed
2015-11-11 02:42:52 +03:00
Ilya Gorbunov
ee759c10c8 Minor: regenerate docs. 2015-11-11 02:42:50 +03:00
Valentin Kipyatkov
d829f585f7 Changes on code review 2015-11-11 01:26:20 +03:00
Valentin Kipyatkov
4f9866f62f Created quickfix for KT-9805 2015-11-11 01:26:20 +03:00
Valentin Kipyatkov
80a788cf53 Code transformation 2015-11-11 01:26:20 +03:00
Stanislav Erokhin
a3b11f4214 Created warning for KT-9805
#KT-9805 In Progress
2015-11-11 01:26:20 +03:00
Valentin Kipyatkov
8664d778ad Merged 2 files 2015-11-10 22:24:46 +03:00
Valentin Kipyatkov
f391d194de Presentation for extension property to include receiver type 2015-11-10 22:24:46 +03:00
Valentin Kipyatkov
6a52cc76d0 Code simplifications 2015-11-10 22:24:46 +03:00
Valentin Kipyatkov
6006969ab9 Converted to Kotlin 2015-11-10 22:24:46 +03:00
Nikolay Krasko
774b3269d6 Remove paragraph char - it ruins builds sometimes 2015-11-10 20:46:17 +03:00
Nikolay Krasko
2dd2a8dd65 Forgotten rename for in *.flex files after jet->kt rename 2015-11-10 20:46:17 +03:00
Mikhail Glukhikh
0d35033106 Introduction of CastedClassReceiver and its handling in codegen #KT-6744 Fixed
ClassReceiver converted to Kotlin
Also #KT-7617 Fixed
2015-11-10 20:20:51 +03:00
Natalia Ukhorskaya
e1134b278c Minor: minimize number of parameters 2015-11-10 18:38:21 +03:00
Natalia Ukhorskaya
ea50d8af02 Debugger: initial support for member extension functions in evaluate expression 2015-11-10 18:38:19 +03:00
Natalia Ukhorskaya
ba9e06d25b Make parameter MultiMap 2015-11-10 18:38:15 +03:00
Natalia Ukhorskaya
12c05fc602 Minor: extract functions to separate file 2015-11-10 18:38:13 +03:00
Natalia Ukhorskaya
5fcd5396b6 Add option to extract function for wrapping member extension function with with { } 2015-11-10 18:38:11 +03:00
Natalia Ukhorskaya
1e0b70247b Add debug log for evaluate expression 2015-11-10 18:38:08 +03:00
Natalia Ukhorskaya
6c61d437f1 Insert imports in codeFragment correctly. Add test 2015-11-10 18:37:56 +03:00
Valentin Kipyatkov
fd1ff51233 Minor changes on code review 2015-11-10 17:26:20 +03:00
Valentin Kipyatkov
8942780640 KtCodeFragement to implement getImportDirectives() correctly 2015-11-10 17:26:19 +03:00
Valentin Kipyatkov
afc968fe83 Minor 2015-11-10 17:23:11 +03:00
Valentin Kipyatkov
bba960f1a5 Moved enum to top level 2015-11-10 17:23:11 +03:00
Valentin Kipyatkov
fe7f79428d Intention to import members with '*' 2015-11-10 17:23:11 +03:00
Valentin Kipyatkov
d3f04c6310 Fixed for companion object members 2015-11-10 17:23:11 +03:00
Valentin Kipyatkov
d599b77ece Works also for top level fun - why not? 2015-11-10 17:23:11 +03:00
Valentin Kipyatkov
870fc9284b KT-4945 Intention "Introduce static import" (for single symbol)
#KT-4945 Fixed
2015-11-10 17:23:10 +03:00
Valentin Kipyatkov
394b4f7cd4 Removed todo 2015-11-10 17:20:01 +03:00
Valentin Kipyatkov
8946e5f353 Code completion for string templates after simple name + dot 2015-11-10 17:20:01 +03:00
Alexey Sedunov
8389b8e8da Introduce Property: Fix rename of primary occurrence
#KT-9404 Fixed
2015-11-10 16:47:52 +03:00
Alexey Sedunov
29b1c169d5 Refactoring: Get rid of "Jet" in the names of refactoring/quick fixes-related classes 2015-11-10 16:47:50 +03:00
Alexey Sedunov
6ff955b66c Change Signature: Implement improved call processing algorithm
#KT-8953 Fixed
 #KT-9525 Fixed
2015-11-10 16:47:48 +03:00
Alexey Sedunov
b334f92748 J2K: JetFunctionCallUsage 2015-11-10 16:47:46 +03:00
Alexey Sedunov
ff86042f58 J2K: Rename JetFunctionCallUsage (.java to .kt) 2015-11-10 16:47:45 +03:00
Alexey Sedunov
a7e4f73c82 J2K: JetCallableDefinitionUsage 2015-11-10 16:47:44 +03:00
Alexey Sedunov
b1ec5c0672 J2K: Rename JetCallableDefinitionUsage (.java to .kt) 2015-11-10 16:47:43 +03:00
Alexey Sedunov
2476393754 Change Signature: Do not move lambda out of parentheses if it neither wasn't out
before nor corresponds to the last parameter after the refactoring
 #KT-9763 Fixed
2015-11-10 16:47:42 +03:00
Alexey Sedunov
f5e9d3e58f Refactoring: Simplify JetChangeSignature test 2015-11-10 16:47:41 +03:00
Alexey Sedunov
e28a70235a Refactoring: Simplify JetChangeSignature test 2015-11-10 16:47:39 +03:00
Alexey Sedunov
f8b8f9e9f9 J2K: JetChangeSignatureTest 2015-11-10 16:47:38 +03:00
Alexey Sedunov
26f81002d0 J2K: Rename JetChangeSignatureTest (.kt to .java) 2015-11-10 16:47:37 +03:00
Alexey Sedunov
cae7fc7cf4 Change Signature: Fix file comparison in tests 2015-11-10 16:47:35 +03:00
Dmitry Jemerov
de24e70389 update KotlinCoverageExtension according to removal of package facades 2015-11-10 14:45:30 +01:00
Dmitry Jemerov
bb5f47fe95 fixed coverage: correctly apply extensions to run command line
#KT-9464 Fixed
2015-11-10 14:45:30 +01:00
Dmitry Jemerov
ffccef753d one more place where we missed the search scope when highlighting usages
#KT-8904 Fixed
2015-11-10 14:45:29 +01:00
Dmitry Jemerov
1c05750a48 rename JetBundle references in UI Designer forms to KotlinBundle 2015-11-10 14:45:28 +01:00
Dmitry Jemerov
6ced597a73 scope all notifications to a specific project
#KT-9680 Fixed
2015-11-10 14:45:28 +01:00
Dmitry Jemerov
e3f5045343 AddModifierFix is not available when the element is in library code
#KT-9647 Fixed
2015-11-10 14:45:27 +01:00
Dmitry Jemerov
3e3c457326 remove checking for class that no longer exists 2015-11-10 14:45:27 +01:00
Dmitry Jemerov
1d01565262 fix duplicate plugin update notifications: don't queue the next plugin update while the network request from the previous update is still running 2015-11-10 14:45:26 +01:00
Michael Bogdanov
a5771c6c1c Fix for KT-9939: java.lang.VerifyError: Bad type on operand stack for Boolean convenience accessor
#KT-9939 Fixed
2015-11-10 16:17:52 +03:00
Pavel V. Talanov
de4ea45f20 Do not compute stubs when building DefaultImpls light classes
Do not build stubs when computing inner classes of a light class
This should implicitly fix a deadlock reported in KT-9907 and KT-9811
2015-11-10 14:31:14 +03:00
Pavel V. Talanov
bff7ff0c5d Improve heuristic to decide whether we will generate DefaultImpls for interface
This is not accurate, there are some cases when we will generate DefaultImpls class that are not covered:
- Inherited default implementations
- Annotated members

In these cases IDE will report an error when in fact code compiles
What is critical though is to be able to decide whether to build DefaultImpls light classes solely based on psi without triggering stubs calculation
2015-11-10 14:31:11 +03:00
Pavel V. Talanov
ad87ec12cd Fast implementation for KtLightClassForExplicitDeclaration#getContainingClass()
Prevent computing stubs for light classes for nested/inner classes when calling completion from java
2015-11-10 14:31:08 +03:00
Pavel V. Talanov
73cb94a3b2 FakeFileForLightClass: implement API correctly 2015-11-10 14:30:59 +03:00
Pavel V. Talanov
39dacbf3c8 Minor: better toString() 2015-11-10 14:30:58 +03:00
Pavel V. Talanov
1dd7e0edba Minor: do not pass psiManager redundantly 2015-11-10 14:30:57 +03:00
Pavel V. Talanov
6dbe8e8a1b Minor: KtLightClassForFacade remove old todos and fix toString 2015-11-10 14:30:55 +03:00
Pavel V. Talanov
2596197fd9 Test data: add package statements to some of the files in KotlinSourceInJavaCompletionTest test data
Since having package statement trigger additional checks that could potentially lead to stub computation
Tests FakeFileForLightClass
2015-11-10 14:30:54 +03:00
Pavel V. Talanov
085d95a5b8 Tests: Introduce LightClassComputationControl to track when stubs for light classes are built
Use it to track when light classes are built in KotlinSourceInJavaCompletionTest
2015-11-10 14:30:53 +03:00
Pavel V. Talanov
ec48b54032 Rename KotlinJavaFileStubProvider and remove StubGenerationStrategy class 2015-11-10 14:30:51 +03:00
Pavel V. Talanov
f5c4f82971 Fix exception from backend in light classes mode for null passed as annotation argument 2015-11-10 14:30:50 +03:00
Pavel V. Talanov
7e091d0df4 J2K KotlinJavaFileStubProvider: refactor code 2015-11-10 14:30:48 +03:00
Pavel V. Talanov
75b8985468 J2K KotlinJavaFileStubProvider: autoconvert and minor changes 2015-11-10 14:26:29 +03:00
Pavel V. Talanov
6f02c0593b J2K KotlinJavaFileStubProvider: rename file 2015-11-10 14:25:19 +03:00
Nikolay Krasko
23e35ab112 Teach index working with source roots with package prefix
#KT-9167 Fixed
2015-11-10 01:50:09 +03:00
Nikolay Krasko
c0739ef53c Add prefix information for Java source root (KT-9167 in progress)
#KT-9167 In Progress
2015-11-10 01:50:08 +03:00
Alexander Udalov
77138ecdb7 Add intrinsic functions to check availability of classes at runtime
Will be used whenever we add a new class to the runtime and use it in the
generated code: we'll now generate a call to one of these functions in <clinit>
of each class file which references the newly added class
2015-11-09 22:24:42 +03:00
Alexander Udalov
596a74d288 Code cleanup in reflection.jvm, generator scripts 2015-11-09 22:24:41 +03:00
Alexander Udalov
75bb15a9fc Do not wrap callable references when a special option is enabled 2015-11-09 22:24:41 +03:00
Alexander Udalov
1576160390 Improve implementation of callable reference superclasses
Previously to use reflection on them, you had to wrap an already created object
with a "Reflection.function" or "Reflection.propertyN" call, which the JVM
back-end was doing. This was not optimal in several senses and current solution
fixes that
2015-11-09 22:24:40 +03:00
Alexander Udalov
7d32524754 Do not fail with type cast when not needed in reflection.jvm 2015-11-09 22:24:40 +03:00
Alexander Udalov
1c889c4e67 Support equals, hashCode, toString for ::-references without reflection 2015-11-09 22:24:39 +03:00
Alexander Udalov
baa28de865 Add factory methods to create class references with internal names
Will be used in future versions to support references to mapped mutable
collections
2015-11-09 22:24:39 +03:00
Dmitry Jemerov
e64a270d1a more renames to get rid of "Jet" in class and method names 2015-11-09 19:07:11 +01:00
Michael Nedzelsky
a3241637ce #fix KT-9881 Incorrect error re: internal visibility
#KT-9881 Fixed
2015-11-09 17:41:00 +03:00
Mikhail Glukhikh
b468d5b0c6 No smart casts to Nothing? 2015-11-09 16:36:37 +03:00
Mikhail Glukhikh
2d9fbf5696 Always null detection 2015-11-09 16:36:34 +03:00
Dmitry Jemerov
ed1c94d0f9 remove incorrect and unnecessary TextConsoleBuilder initialization 2015-11-09 14:16:31 +01:00
Michael Bogdanov
7147c84396 Fix for KT-9897: Cannot pop operand off an empty stack" with -= on ArrayList element
#KT-9897 Fixed
2015-11-09 16:17:24 +03:00
Valentin Kipyatkov
4943a9fb35 Minor changes on code review 2015-11-09 15:45:38 +03:00
Valentin Kipyatkov
9968345845 Renames 2015-11-09 15:37:48 +03:00
Valentin Kipyatkov
d44b1eeb7e KT-9884 Completion in Evaluate Expression crashes
#KT-9884 Fixed
2015-11-09 15:37:48 +03:00
Valentin Kipyatkov
ac4cf540a4 Removed wrong TODO 2015-11-09 15:37:48 +03:00
Valentin Kipyatkov
80a1d94515 Non-imported top-level functions completion does not require second press 2015-11-09 15:37:48 +03:00
Valentin Kipyatkov
4c5d5ed18f Do not show "assertFailsWith" in any smart completion 2015-11-09 15:37:47 +03:00
Valentin Kipyatkov
63b5966212 Top-level callables are added one by one 2015-11-09 15:37:47 +03:00
Valentin Kipyatkov
5d56339aba More efficient getting of top-level callables 2015-11-09 15:37:47 +03:00
Valentin Kipyatkov
ae9482a36c Add static members into the list one by one 2015-11-09 15:37:47 +03:00
Valentin Kipyatkov
c38039144f Added checkCanceled 2015-11-09 15:37:47 +03:00
Valentin Kipyatkov
10e8455279 More safe 2015-11-09 15:37:46 +03:00
Valentin Kipyatkov
4da6a3cd50 No members from anonymous objects etc 2015-11-09 15:37:46 +03:00
Valentin Kipyatkov
97ca5f0389 Refactored 2015-11-09 15:37:46 +03:00
Valentin Kipyatkov
0ac60701fc Reused code 2015-11-09 15:37:46 +03:00
Valentin Kipyatkov
0c93ff5f1d Moved method 2015-11-09 15:37:46 +03:00
Valentin Kipyatkov
55612757cf More correct API 2015-11-09 15:37:46 +03:00
Valentin Kipyatkov
3cda866af0 Static members completion works in smart completion + fixed incorrect finding of java method descriptor that caused duplicated items 2015-11-09 15:37:45 +03:00
Valentin Kipyatkov
1283f5f4e1 Refactoring in smart completion 2015-11-09 15:37:45 +03:00
Valentin Kipyatkov
576b79de0a Removed unused parameter 2015-11-09 15:37:45 +03:00
Valentin Kipyatkov
4a182ac6e2 Fixing class names after rebase 2015-11-09 15:37:45 +03:00
Valentin Kipyatkov
7198b897ab Ordering of static members in completion 2015-11-09 15:37:45 +03:00
Valentin Kipyatkov
3bd508ca84 Static members completion includes SAM-adapters 2015-11-09 15:37:44 +03:00
Valentin Kipyatkov
ea804ed76e Makes no sense to return method names from PsiShortNamesCache if methods by name are not returned 2015-11-09 15:37:44 +03:00
Valentin Kipyatkov
06812aed11 Better completion for static members: special behavior in case of imports from same class exist 2015-11-09 15:37:44 +03:00
Valentin Kipyatkov
ca437e51c4 Initial implementation of KT-8209 Support static member completion without writing the class name 2015-11-09 15:37:44 +03:00
Nikolay Krasko
7be9699263 Make it possible to generate getTestsRoot() method with the test directory
Method can be used in setUp()
2015-11-07 01:27:35 +03:00
Nikolay Krasko
178aba54dd Test it's safe to call PsiElement methods on Kotlin light elements 2015-11-07 01:27:34 +03:00
Alexey Tsvetkov
7c752c1463 Minor: generate tests 2015-11-06 20:29:31 +03:00
Alexey Tsvetkov
8f43714c49 Fix minor issues after review 2015-11-06 16:46:40 +03:00
Alexey Tsvetkov
7d104d02dd Generate tests 2015-11-06 16:44:52 +03:00
Alexey Tsvetkov
ce7d1eb8e2 Add incremental compilation tests with lookup cache enabled 2015-11-06 16:44:52 +03:00
Alexey Tsvetkov
a3aa91551c Extract LookupStorage from LookupTrackerImpl 2015-11-06 16:44:52 +03:00
Alexey Tsvetkov
8b4d0ea077 Minor: rename file LookupTrackerImpl.kt -> LookupStorage.kt 2015-11-06 16:44:52 +03:00
Alexey Tsvetkov
322815c7de Fix minor naming/formatting issues after review 2015-11-06 16:44:51 +03:00
Alexey Tsvetkov
67878fe13a Use new lookup tracker only when experimental incremental compilation is enabled 2015-11-06 16:44:51 +03:00
Alexey Tsvetkov
7ebc58c690 Hash files without collisions 2015-11-06 16:44:51 +03:00
Alexey Tsvetkov
7572fb47d3 Remove entries when files are removed 2015-11-06 16:44:51 +03:00
Alexey Tsvetkov
87d836cd67 Hash file names 2015-11-06 16:44:51 +03:00
Alexey Tsvetkov
2160948980 Move BasicMapsOwner 2015-11-06 16:44:51 +03:00
Alexey Tsvetkov
dae5b8e39e Move all incremental cache value/externalizing types to corresponding files 2015-11-06 16:44:51 +03:00
Alexey Tsvetkov
9564a7a828 Extract BasicMapsOwner 2015-11-06 16:44:34 +03:00
Alexey Tsvetkov
f6f300d903 Move LookupMap 2015-11-06 16:43:32 +03:00
Alexey Tsvetkov
c9663340c9 Save lookups to incremental cache 2015-11-06 16:43:32 +03:00
Mikhail Glukhikh
873550b0bb lateinit setter now must have the same visibility as its property visibility 2015-11-06 13:34:00 +03:00
Michael Bogdanov
9d3fa7da80 Test for obsolete KT-8189: java.lang.UnsupportedOperationException: Don't know how to generate
#KT-8189 Obsolete
2015-11-06 12:17:07 +03:00
Michael Bogdanov
0619ef47ac Fix for KT-9877: CompilationError: Cannot pop operand of empty stack
#KT-9877 Fixed
2015-11-06 11:46:13 +03:00
Michael Bogdanov
4d77181692 Fix for KT-9855: java.lang.IllegalAccessError when using private package level operator method
#KT-9855 Fixed
2015-11-06 11:46:12 +03:00
Michael Bogdanov
bd2b01ac1c Fix for KT-5150: Accessors for private methods are not generated for get/set conventions
#KT-5150 Fixed
2015-11-06 11:46:12 +03:00
Michael Bogdanov
0fcaaa80df Fix for KT-9140: Default parameters are passed as nulls when using indexing [ ] invocation
#KT-9140 Fixed
2015-11-06 11:46:11 +03:00
Mikhail Glukhikh
b556037915 Smart casts to nothing after comparison with null 2015-11-06 10:57:06 +03:00
Michael Nedzelsky
981d471ebe fix KT-9843 Bug in incremental compilation: module is not recompiled when optional parameter added
and KT-8434 Removing parameter with default value from function in different module breaks incremental compilation

#KT-9843 Fixed

#KT-8434 Fixed
2015-11-06 07:45:46 +03:00
Michael Nedzelsky
3dbb117598 fix KT-7042 Providing return type for property setter is not reported as error
#KT-7042 Fixed
2015-11-06 06:32:20 +03:00
Michael Nedzelsky
e6a2bd05d4 fix KT-9652 Warning to specify expected type as Any? when it is already Any?
#KT-9652 Fixed
2015-11-06 06:32:07 +03:00
Michael Nedzelsky
c318a13e6c Error on using extension function type as an upper bound 2015-11-06 06:31:52 +03:00
Ilya Gorbunov
ee46ec1126 Drop deprecated threading extensions. 2015-11-06 01:12:11 +03:00
Ilya Gorbunov
850c1518c8 Fix Delegates.lazy usages in testData 2015-11-06 01:12:09 +03:00
Ilya Gorbunov
70fdc379ef Drop deprecated Delegates.lazy and blockingLazy and ObservableProperty constructor-like function 2015-11-06 01:12:07 +03:00
Ilya Gorbunov
219e69be22 Drop deprecated join function.
#KT-6909 Fixed
2015-11-06 01:12:05 +03:00
Ilya Gorbunov
de77ee6d63 Replace deprecated join with joinToString in idl2k 2015-11-06 01:12:04 +03:00
Ilya Gorbunov
62b532ec66 Replace deprecated join with joinToString in testData 2015-11-06 01:12:02 +03:00
Ilya Gorbunov
f3ff2e2e76 Replace deprecated join with joinToString 2015-11-06 01:12:00 +03:00
Ilya Gorbunov
183523cf24 Refactoring: move engine related classes to subdirectory. 2015-11-06 00:48:13 +03:00
Ilya Gorbunov
f9bfeb0f32 Doc templating: name things properly 2015-11-06 00:46:05 +03:00
Ilya Gorbunov
cb79aadb9d Accept out-projections of arrays for unzip. 2015-11-06 00:37:01 +03:00
Stanislav Erokhin
55157df3eb Removed MemberScope.ownerDescriptor 2015-11-06 00:01:35 +03:00
Stanislav Erokhin
22f78b148c Removed usages of MemberScope.ownerDescriptor property. 2015-11-06 00:01:34 +03:00
Stanislav Erokhin
b8e828e040 Minor. Changed signature of SamConversionResolver.resolveSamConstructor 2015-11-06 00:01:33 +03:00
Stanislav Erokhin
c73d091c52 Minor. Fix compilation(KT-9898 Impossible implement kotlin interface in java) 2015-11-06 00:01:31 +03:00
Stanislav Erokhin
b3e69a5f5d Created common supertype for HierarchicalScope and MemberScope-- ResolutionScope 2015-11-06 00:01:30 +03:00
Stanislav Erokhin
c4582d0e0c Replace function MemberScope.getContainingDeclaration() to property ownerDescriptor 2015-11-06 00:01:30 +03:00
Valentin Kipyatkov
52dc23012f Changed parsing of object and enum entries to drop "KtObjectDeclarationName" 2015-11-05 23:21:22 +03:00
Natalia Ukhorskaya
03cda7f4d1 Access javaTask.classpath property only in doFirst because otherwise it doesn't contain classes added after apply of kotlin plugin
#KT-7277 Fixed
 #KT-9899 Fixed
2015-11-05 19:19:15 +03:00
Natalia Ukhorskaya
b54afdf144 Minor: rename methods 2015-11-05 19:19:15 +03:00
Natalia Ukhorskaya
05dbb875a9 Minor: fix warnings 2015-11-05 19:19:14 +03:00
Valentin Kipyatkov
cacc50dc32 Minor 2015-11-05 17:47:56 +03:00
Valentin Kipyatkov
25be00d9d9 Added TODOs 2015-11-05 17:47:56 +03:00
Valentin Kipyatkov
58fc0b6ec8 Fixed special item after "super." not working for fake override super 2015-11-05 17:47:55 +03:00
Valentin Kipyatkov
bec6c29cb4 Fixing class names after rebase 2015-11-05 17:47:55 +03:00
Valentin Kipyatkov
e33e1ef8d7 KT-8968 Special completion after "super."
#KT-8968 Fixed
2015-11-05 17:47:55 +03:00
Valentin Kipyatkov
99b35257c6 Preference of right member after "super." and not only 2015-11-05 17:47:55 +03:00
Valentin Kipyatkov
731f19ee36 Changed behavior 2015-11-05 17:47:54 +03:00
Valentin Kipyatkov
b73c574d19 Correct completion after "super."
#KT-8406 Fixed
2015-11-05 17:47:54 +03:00
Valentin Kipyatkov
218c0cfff7 KT-9875 False unused import in kotlinSpacingRules.kt
#KT-9875 Fixed
2015-11-05 17:47:54 +03:00
Mikhail Glukhikh
5e9aa38950 More precise type handling for equality #KT-2311 Fixed 2015-11-05 17:29:34 +03:00
Sergey Mashkov
137a20e0ed JS: better diagnostics for missing test files 2015-11-05 14:41:30 +01:00
Sergey Mashkov
703367c5c7 Update tests due to removed DOM utilities 2015-11-05 14:41:30 +01:00
Sergey Mashkov
20aff28266 JS: update webdemo canvas examples 2015-11-05 14:41:29 +01:00
Sergey Mashkov
3b68aaa84c JS: fix rhino 64k issue 2015-11-05 14:41:29 +01:00
Sergey Mashkov
29973d714e Remove DOM utilities, put temporary to JS to keep compatibility 2015-11-05 14:41:28 +01:00
Sergey Mashkov
e9fbebaea2 JS: drop deprecated declarations 2015-11-05 14:41:28 +01:00
Sergey Mashkov
77d3db635b Remove browser.document 2015-11-05 14:17:44 +01:00
Alexander Udalov
dce64c974f Don't output error for "kotlinc -version"
#KT-9676 Fixed
2015-11-05 15:13:19 +03:00
Alexander Udalov
5335a81f7d Minor, add JvmField to a constant 2015-11-05 15:11:33 +03:00
Stanislav Erokhin
2c3f58eeb7 Renamed methods in MemberScope from getSmth to getContributedSmth 2015-11-05 14:34:00 +03:00
Stanislav Erokhin
6f9d9759ce Renamed KtScope to MemberScope 2015-11-05 14:34:00 +03:00
Alexander Udalov
748c0e7149 Don't assert that annotation class has constructor in AnnotationDeserializer
#KT-9758 Fixed
2015-11-05 13:42:31 +03:00
Ilya Gorbunov
1a0c2e2cf6 In-place sorting.
#KT-9034
2015-11-05 09:04:31 +03:00
Ilya Gorbunov
5e9b7b9e60 Collections.sort without comparator now uses natural order.
#KT-9771 Fixed
2015-11-05 09:03:30 +03:00
Ilya Gorbunov
d5edbfd005 Refactoring: do not use own classes for nullsFirst and nullsLast wrappers of natural order. 2015-11-05 09:03:29 +03:00
Ilya Gorbunov
fa261a7697 Add override for default method of Comparator from JDK8 2015-11-05 09:03:07 +03:00
Ilya Gorbunov
2b676e08bc Introduce naturalOrder<T> and reverseOrder<T> comparators. 2015-11-05 09:03:05 +03:00
Ilya Gorbunov
83fef68876 Add more cases to array in-place reversing test.
Add array of objects case to all reversing tests.
2015-11-05 09:03:03 +03:00
Ilya Gorbunov
4fc54a12b8 In-place reversing.
#KT-9034
2015-11-05 09:02:58 +03:00
Ilya Gorbunov
1400bdc09a Do not allow removeSurrounding remove overlapping prefix and suffix. 2015-11-04 22:19:59 +03:00
Ilya Gorbunov
05fd2b012a Provide overloads both for Strings and CharSequences of filter, filterNot, reversed and partition 2015-11-04 22:19:57 +03:00
Ilya Gorbunov
62d6bcaa6d Provide overloads both for Strings and CharSequences of removePrefix, removeSuffix, removeSurronding, trim* and pad*, replaceRange & removeRange 2015-11-04 22:19:55 +03:00
Ilya Gorbunov
2ed611e2c5 Docs corrections. 2015-11-04 22:19:52 +03:00
Ilya Gorbunov
0dd7e398c7 Use reverse indexed iteration in last and lastOrNull with predicate for CharSequences and Strings. 2015-11-04 22:19:50 +03:00
Ilya Gorbunov
8c16fad8b1 Make more string tests cross-platform. 2015-11-04 22:19:48 +03:00
Ilya Gorbunov
5373c380ac Remove obsolete extensions conflicting with stdlib 2015-11-04 22:19:46 +03:00
Ilya Gorbunov
f20bfa7fb8 Fix test expectation failures caused by changed signatures. 2015-11-04 22:19:45 +03:00
Ilya Gorbunov
d021a324aa Test CharSequence extension methods both for String and StringBuilder 2015-11-04 22:19:43 +03:00
Ilya Gorbunov
64338e896d Use CharSequence in split, splitToSequence, lines 2015-11-04 22:19:41 +03:00
Ilya Gorbunov
8c5ac26613 Use CharSequence in repeat and joinToString. 2015-11-04 22:19:39 +03:00
Ilya Gorbunov
b4b84a38d5 Use templating in the docs for generated code to name things properly. 2015-11-04 22:19:37 +03:00
Ilya Gorbunov
5b055ac663 Preserve type of subsequence in drop* and take* operations.
Validate argument of drop (required in JS, more meaningful exception in JVM)
2015-11-04 22:19:35 +03:00
Daniel Rothmaler
67229401c6 Add set operator to make the work with StringBuilder more list-like.
Make StringBuilder.set jvm-only.
Move jvm-specific test.
2015-11-04 22:19:33 +03:00
Ilya Gorbunov
e155e426c2 Implement CharSequence.regionMatches and generalize depending String extensions to take CharSequence.
Add hidden declarations for replaced overloads with String receiver in hand-written code.
2015-11-04 22:19:31 +03:00
Ilya Gorbunov
47560d3db1 Add hidden declarations for replaced overloads with String receiver in hand-written code. 2015-11-04 22:19:29 +03:00
Ilya Gorbunov
59b67b32c4 Add hidden declarations for replaced overloads with String receiver in generated code. 2015-11-04 22:19:27 +03:00
Ilya Gorbunov
935e606b64 Generalize String extensions to take CharSequence as receiver and parameters where applicable: generated code.
Exclude Strings family from default families.
2015-11-04 22:19:26 +03:00
Ilya Gorbunov
4a621cbb5f Generalize String extensions to take CharSequence as receiver and parameters where applicable. 2015-11-04 22:19:24 +03:00
Ilya Gorbunov
05615dd48b Introduce String.toByte()
#KT-8833 Fixed
2015-11-04 22:19:22 +03:00
Ilya Gorbunov
9bbe0d67ff Do not treat directory with copied test sources for js library as source root, as it confuses debugger under certain circumstances.
Remove duplicated test.
2015-11-04 22:19:20 +03:00
Zalim Bashorov
c456ab0f74 Minor: refactoring ExpressionTypingUtils#checkVariableShadowing -- inline the search older descriptor 2015-11-04 22:15:39 +03:00
Zalim Bashorov
1eb9bf2592 Minor: remove accidentally forgotten Deprecated annotation 2015-11-04 22:15:37 +03:00
Zalim Bashorov
04fed203e4 Add tests for lookups to enum static scope and to companion object scope 2015-11-04 22:15:37 +03:00
Zalim Bashorov
1e51e333ab Minor: add comments to LazyJavaStaticClassScope, LazyJavaPackageScope and StaticScopeForKotlinClass 2015-11-04 22:11:34 +03:00
Zalim Bashorov
a6855116b8 Track lookups for nested/inner Java classes 2015-11-04 22:09:55 +03:00
Stanislav Erokhin
87f32ef07b Minor. fix testdata 2015-11-04 14:28:29 +03:00
Stanislav Erokhin
a90ca14033 Removed KtScope.Empty and created util function emptyScope 2015-11-04 14:28:28 +03:00
Stanislav Erokhin
4e891a3f98 Minor. moved util method to Companion of LexicalScope 2015-11-04 14:28:27 +03:00
Stanislav Erokhin
2c7746cafd Minor. Simplified code. 2015-11-04 14:28:27 +03:00
Stanislav Erokhin
b02da0dc2f Created custom LexicalScope wrapper for resolving callable reference. 2015-11-04 14:28:26 +03:00
Stanislav Erokhin
f7629b0c84 Removed getAllDescriptors() and getOwnDeclaredDescriptors() from KtScope 2015-11-04 14:28:25 +03:00
Stanislav Erokhin
0b5de434fa Removed usages KtScope.getAllDescriptors 2015-11-04 12:41:34 +03:00
Stanislav Erokhin
21fdd2ffc3 Created common supertype for LexicalScope & ImportingScope -- HierarchicalScope 2015-11-04 12:41:33 +03:00
Stanislav Erokhin
4c36e20242 Moved FilteringScope to frontend module 2015-11-04 12:41:32 +03:00
Stanislav Erokhin
6412df2e0b Change return type of KtScope.getProperties() 2015-11-04 12:41:32 +03:00
Stanislav Erokhin
7cd667c0e3 Removed unused methods from KtScope. 2015-11-04 12:41:31 +03:00
Stanislav Erokhin
cc56cf6292 Removed several hacks from ScopeUtils.kt 2015-11-04 12:41:30 +03:00
Stanislav Erokhin
711daa459a Minor. Removed util method LexicalScope.asKtScope() 2015-11-04 12:41:30 +03:00
Stanislav Erokhin
40146a0df8 Minor. Make WritableScopeStorage abstract class 2015-11-04 12:41:29 +03:00
Stanislav Erokhin
5c6134af81 Minor. Removed WritableScopeImpl. 2015-11-04 12:41:28 +03:00
Stanislav Erokhin
a5c9f4d353 Minor. removed usage WritableScopeImpl from tests 2015-11-04 12:41:27 +03:00
Stanislav Erokhin
c8d9cfcd7b Minor. removed usage WritableScopeImpl from JetTypeCheckerTest 2015-11-04 12:41:27 +03:00
Stanislav Erokhin
6ad23f23c5 Minor. removed useless call 2015-11-04 12:41:26 +03:00
Stanislav Erokhin
e0bacb2680 Minor. remove usage of WritableScopeImpl 2015-11-04 12:41:25 +03:00
Stanislav Erokhin
c1fa973324 Minor. remove usage of WritableScope 2015-11-04 12:41:25 +03:00
Stanislav Erokhin
71620d2ed1 Minor. Move LockLevel to LexicalWritableScope 2015-11-04 12:41:24 +03:00
Stanislav Erokhin
fe61f41a94 Minor. remove unused import 2015-11-04 12:41:23 +03:00
Nikolay Krasko
a614dfd90c Fix build 2015-11-04 11:50:25 +03:00
Nikolay Krasko
e10f7fb464 Don't report missing getValue/setValue method error when it's was impossible to finish resolve
#KT-9803 Fixed
2015-11-04 02:31:15 +03:00
Nikolay Krasko
f518f5fb9f Extension operator function should be automatically imported for java function with the same name (KT-9406)
There's no need to import extension for Java operators anymore. Import for Kotlin functions.

 #KT-9406 Fixed
2015-11-04 02:31:12 +03:00
Nikolay Krasko
4ce87665c3 Don't store diagnostics in actions as they might contain descriptors and this will prevent them from GC 2015-11-04 02:31:10 +03:00
Ilya Gorbunov
05c2edf60c Drop deprecated merge functions. 2015-11-04 00:05:47 +03:00
Ilya Gorbunov
65a98d6968 Temporary drop mapNotNull and mapNotNullTo.
Disable mapNotNull tests

#KT-4410
2015-11-04 00:05:45 +03:00
Ilya Chernikov
b71fec985f Adding possibility to skip params inheritance on daemon jvm options creation, refactoring appropriate api, using it to fix tests 2015-11-03 21:56:31 +01:00
Ilya Gorbunov
3a82225201 Deprecate toGenerator and toLinkedList extensions. 2015-11-03 22:41:06 +03:00
Dmitry Jemerov
0997f78764 fix CodeConformanceTest redux 2015-11-03 18:32:06 +01:00
Dmitry Jemerov
fd2c75f03b fix CodeConformanceTest 2015-11-03 17:34:56 +01:00
Ilya Chernikov
10036d7ef3 Enabling parallel builds in JPS without daemon, enabling application environment disposing in tests, introducing keepalive property constant 2015-11-03 14:18:22 +01:00
Ilya Chernikov
63e1fa4cc0 Simplifying cleanup in gradle plugin after introducing ZipHandle.clearFileAccessorCache method in the platform, minor refactoring 2015-11-03 14:18:21 +01:00
Ilya Chernikov
90bb8b2be9 Generalizing daemon process shutdown mechanism 2015-11-03 14:18:21 +01:00
Ilya Chernikov
6a1c82d101 hiding compiler digest management inside the compiler service, implement simple lazy checking mechanism, using it from clients 2015-11-03 14:18:20 +01:00
Ilya Chernikov
2fa7b53d2c Implementing utilities to detect OS type and apprpriate location of runtime data files, using it to determine daemon run dir. Fixes KT-9696 2015-11-03 14:18:19 +01:00
Ilya Chernikov
bf16efb8cc Adding test for parallel compilation with daemon 2015-11-03 14:18:18 +01:00
Ilya Chernikov
2dfca72f38 Passing port through daemon client API to allow port reusing for client-side components, introducing operations tracer interface for testing purposes 2015-11-03 14:18:17 +01:00
Dmitry Jemerov
3f46a13a56 regenerate tests 2015-11-03 14:08:59 +01:00
Dmitry Jemerov
19af88738b remove Jet from names of classes in tests: phase 2 2015-11-03 14:06:04 +01:00
Dmitry Jemerov
c604f98a1c remove Jet from names of classes in tests: phase 1 2015-11-03 14:06:03 +01:00
Michael Bogdanov
86f8845c00 Fix for KT-8928: NoSuchMethodError on private property setter in companion object
#KT-8928 Fixed
2015-11-03 15:41:22 +03:00
Michael Bogdanov
559b85caa8 Test for obsolete KT-6382: Incorrect bridge method calls are generated for member extension functions with default parameters
#KT-6382 Obsolete
2015-11-03 15:40:16 +03:00
Michael Bogdanov
9daa44566b Fix for KT-5589: VerifyError when default value for parameter of local function is obtained from closure
#KT-5589 Fixed
2015-11-03 15:40:16 +03:00
Anton Sukhonosenko
141ffa27dc val / var are now forbidden on a loop multi declaration parameter #KT-6274 Fixed
VAL_OR_VAR_ON_LOOP_MULTI_PARAMETER error added
KtValVarKeywordOwner interface added for PSIs that have getValOrVarKeyword method
2015-11-03 15:30:50 +03:00
Zalim Bashorov
54cb575819 Minor: fix generating LookupTracker tests 2015-11-03 14:01:47 +03:00
Valentin Kipyatkov
7a47e53398 Added a test 2015-11-03 13:43:28 +03:00
Mikhail Glukhikh
41ebfd025e More precise diagnostics of smart cast impossible #KT-7240 Fixed 2015-11-03 13:38:51 +03:00
Dmitry Jemerov
16a8e8f6f0 test fixed 2015-11-03 11:18:14 +01:00
Mikhail Glukhikh
03aaddd379 More correct handling of possible type set during assignment #KT-8229 Fixed 2015-11-03 12:49:21 +03:00
Valentin Kipyatkov
bbea70a005 Minor changes on code review 2015-11-03 11:46:19 +03:00
Valentin Kipyatkov
c11bf32594 More correct shadowed declarations filtering in completion 2015-11-03 11:46:19 +03:00
Valentin Kipyatkov
67cf9f9510 More correct & quick check of descriptor being from library 2015-11-03 11:46:19 +03:00
Valentin Kipyatkov
b05d490eeb Performance optimization in completion: search context variables of functional types later 2015-11-03 11:46:18 +03:00
Mikhail Glukhikh
0a5a5a2e36 More precise diagnostics is added for smart cast impossible #KT-8810 Fixed 2015-11-03 11:15:58 +03:00
Michael Bogdanov
15eaa15b65 Fix for KT-7421: Unable to inherit from inner class
Fix for KT-6708: Compiler Error when extending open inner class: "java.lang.RuntimeException: Error generating primary constructor of class InnerB with kind IMPLEMENTATION"

  #KT-7421 Fixed
  #KT-6708 Fixed
2015-11-03 10:14:57 +03:00
Michael Bogdanov
65b85711e3 Fix for KT-3335: Creating imported super class' inner class fails in codegen
#KT-3335 Fixed
2015-11-03 10:14:56 +03:00
Dmitry Jemerov
3bd7f87d2b rename "Jet" from names of IDE classes; consistently use Kt prefix for PSI elements and classes directly related to specific PSI elements 2015-11-02 18:49:35 +01:00
Pavel V. Talanov
fff404780c Add capabilities to moduleDescriptor as a way to put user data into module
Add OriginCapability to ide modules
2015-11-02 20:38:10 +03:00
Dmitry Jemerov
736b496f6a drop deprecated @platformName and @platformStatic annotations 2015-11-02 17:00:44 +01:00
Pavel V. Talanov
15370244dc Minor in JavaAgainstKotlinCheckerTest: improve test data for EnumAutoGeneratedMethods case 2015-11-02 18:39:03 +03:00
Pavel V. Talanov
ce4a950697 AbstractSearcherTest: check member kind in test data not the psi implementation class
It is not what should be tested in this test
2015-11-02 18:39:01 +03:00
Pavel V. Talanov
78bb44850d Minor: KotlinAnnotationLightMethod -> KotlinLightAnnotationMethod 2015-11-02 18:39:00 +03:00
Pavel V. Talanov
9f5c0741bd KotlinLightField: create KotlinLightEnumConstant based on delegate psi, not whether could find original declaration
This was not true for decompiled classes and led to enum entries from kotlin compiled files being unresolved in java
2015-11-02 18:38:58 +03:00
Pavel V. Talanov
226c2e3b5c Implement getParent for KotlinLightClassForDecompiledDeclaration
Fixes a bug where java resolve would be unable to resolve return types of CompiledKotlinEnum.values()/valueOf() methods
Tested by EnumAutoGeneratedMethods java against kotlin checker test
2015-11-02 18:38:56 +03:00
Pavel V. Talanov
8c4db9bd35 Fix test data so that it can be compiled 2015-11-02 18:38:55 +03:00
Pavel V. Talanov
f6e6ead907 Add java checker test to test loading inner/nested classes 2015-11-02 18:38:53 +03:00
Pavel V. Talanov
e5f075c7f6 Refactor light fields: move all implementation into one file and prettify code 2015-11-02 18:38:52 +03:00
Pavel V. Talanov
e6b498f943 J2K KotlinLightField: convert and fix compilation 2015-11-02 18:38:50 +03:00
Pavel V. Talanov
d7519225a0 J2K KotlinLightField: rename file 2015-11-02 18:38:49 +03:00
Pavel V. Talanov
f8efdacefd Refactor light methods: drop KotlinLightMethodForTraitFake and KotlinNoOriginLightMethod
Move two remaining meaningful implementation into one place
Move code that choose which implementation to use out of KotlinWrappingLightClass
2015-11-02 18:38:47 +03:00
Pavel V. Talanov
bca516bac3 KtClassBody: get parent by stub is possible 2015-11-02 18:38:43 +03:00
Pavel V. Talanov
be668fc4f5 Introduce JavaAgainstKotlinBinariesTest 2015-11-02 18:38:42 +03:00
Pavel V. Talanov
506b5509f3 KotlinAndJavaCheckerTest -> JavaAgainstKotlinSourceTest and make it generated 2015-11-02 18:38:38 +03:00
Pavel V. Talanov
6b391d6ed2 Make sure constant values for primary constructor parameters default values are written to trace when building light classes for annotation classes 2015-11-02 18:38:37 +03:00
Pavel V. Talanov
03d57e91ec J2K ValueParameterDescriptorImpl: convert and prettify 2015-11-02 18:38:33 +03:00
Pavel V. Talanov
bbd047f932 J2K ValueParameterDescriptorImpl: rename file 2015-11-02 18:38:32 +03:00
Pavel V. Talanov
dc1fbe89ec J2K ValueParameterDescriptor inteface in one go 2015-11-02 18:38:30 +03:00
Pavel V. Talanov
4a3632f70e Backend: generate default values for annotation parameters in light classes mode 2015-11-02 18:38:26 +03:00
Pavel V. Talanov
0b11dc1d7f KotlinAndJavaCheckerTest: Add test for annotating java code with kotlin annotations 2015-11-02 18:38:25 +03:00
Pavel V. Talanov
6a7ecbfd02 Add completion test for annotation parameter 2015-11-02 18:38:23 +03:00
Pavel V. Talanov
5f4bb4e941 Add test for annotation parameter reference 2015-11-02 18:38:22 +03:00
Pavel V. Talanov
69b3e5e21e Add light class test for annotation class 2015-11-02 18:38:20 +03:00
Pavel V. Talanov
37c17ba71e Light classes: correct wrappers for annotation methods 2015-11-02 18:38:19 +03:00
Nikolay Krasko
cde6388e26 getValue and setValue are now operators 2015-11-02 18:23:42 +03:00
Zalim Bashorov
5d72629b0b Add test for lookups in generic constraints; Add cases with lookup to companion and nested object; 2015-11-02 18:18:37 +03:00
Zalim Bashorov
1cf0ca9287 Minor: add new entries to NoLookupLocation and remove UNSORTED 2015-11-02 18:18:36 +03:00
Zalim Bashorov
d5bccd8cdc Minor: remove the no longer needed function KtScope::getClassifier(Name) 2015-11-02 18:18:36 +03:00
Zalim Bashorov
16d585e204 Don't track lookups:
* when find local variables
  we don't need them for incremental compilation;
* when check overrides
  we going to track inheritance separatly;
* when get companion object descriptor;
* when find Descriptor by fqname
  isn't interesting now because used from light-classes and and java-loder;
* when create qualifier
  we already looked up names in this context before.
2015-11-02 18:18:35 +03:00
Zalim Bashorov
2741215ed2 Don't track lookups from deserializer & java loader 2015-11-02 18:18:35 +03:00
Zalim Bashorov
d78d96a856 Don't track lookups to EnumEntryScope and when check names in constraints 2015-11-02 18:18:34 +03:00
Zalim Bashorov
5a6bcea826 Introduce location in SamConversionResolver::resolveSamConstructor and provide right location in usages 2015-11-02 18:18:33 +03:00
Zalim Bashorov
4cb5398c04 Add tests for lookups to declarations form Java 2015-11-02 18:18:32 +03:00
Zalim Bashorov
519172f182 Add tests for lookups to deserialized and java scopes 2015-11-02 18:18:32 +03:00
Zalim Bashorov
3484c43c8c Minor: fix testdata 2015-11-02 18:18:31 +03:00
Zalim Bashorov
24037c8bf4 Added "touch" command to incremental tests and implemented; Implemented more accurate checking lookups after modifications 2015-11-02 18:18:31 +03:00
Zalim Bashorov
c6aa94d30a Track lookups in LazyJavaScope ans LazyJavaPackageScope 2015-11-02 18:18:30 +03:00
Zalim Bashorov
47f1975879 Track lookups in DeserializedMemberScope 2015-11-02 18:18:29 +03:00
Zalim Bashorov
a5d8b47083 Refactoring: introduced val location: LocationInfo? in LookupLocation and use it in LookupTracker::record 2015-11-02 18:18:29 +03:00
Zalim Bashorov
81a288b42c Add LookupTracker to DeserializationComponents 2015-11-02 18:18:28 +03:00
Zalim Bashorov
f1638bf6fd Minor: simplify code 2015-11-02 18:18:27 +03:00
Alexey Sedunov
520e90acf1 Minor: Use kotlin.lazy instead of kotlin.Delegates.lazy in KtPsiFactory.CallableBuilder 2015-11-02 15:15:44 +03:00
Alexey Sedunov
5e223927ea Change Signature: Match calls of different overloads generated due to @JvmOverloads annotation
#KT-9020 Fixed
2015-11-02 15:15:43 +03:00
Alexey Sedunov
6b346d9e77 Change Signature: Drop light method filtering as old-style package facades are not supported anymore 2015-11-02 15:15:41 +03:00
Alexey Sedunov
7ce6f58c27 Change Signature: Constraint indices of parameters generated for overloaded versions of function with @JvmOverloads annotation
#KT-9762 Fixed
2015-11-02 15:15:40 +03:00
Alexey Sedunov
6a72b51677 Change Signature: Run tests with Kotlin stdlib 2015-11-02 15:15:39 +03:00
Alexey Sedunov
4f09bdfe70 Change Signature: Placed kotlin processor after the java one. Fix processUsage() to pass non-Kotlin usages to further processors (if any)
#KT-9219 Fixed
2015-11-02 15:15:38 +03:00
Alexey Sedunov
307778ba79 J2K: JetChangeSignatureUsageProcessor 2015-11-02 15:15:36 +03:00
Alexey Sedunov
dc3a799acb J2K: Rename JetChangeSignatureUsageProcessor.java to .kt 2015-11-02 15:15:35 +03:00
Alexey Sedunov
1de3faf3f5 Codegen: Fix origin of overloaded methods generated for constructors with @JvmOverloads
Find Usages: Add tests for declarations annotated with @JvmOverloads
 #KT-8534 Fixed
2015-11-02 15:15:34 +03:00
Alexey Sedunov
b9ed3b91be Change Signature: Fix descriptor comparison when receiver type is changed
#KT-9201 Fixed
2015-11-02 15:15:33 +03:00
Alexey Sedunov
937b8725c6 Change Signature/Rename: Fix processing of named arguments when renaming parameter of extension function
#KT-8605 Fixed
2015-11-02 15:15:32 +03:00
Alexey Sedunov
18ed3055ee Introduce Variable: Allow introduction of variables with 'dynamic' type
#KT-8483 Fixed
2015-11-02 15:15:31 +03:00
Alexey Sedunov
6dd58ad197 Inline: Fix inlining of if-expressions into qualified expressions
#KT-8008 Fixed
2015-11-02 15:15:29 +03:00
Alexey Sedunov
89132b3f66 Generate Secondary Constructor: Forbid inside of class with explicit primary constructor 2015-11-02 15:15:28 +03:00
Alexey Sedunov
22393d4cd2 Formatter: Use formatter to automatically insert semicolons after the last enum entry when needed 2015-11-02 15:15:26 +03:00
Dmitry Petrov
d060687775 Package vs class conflict in qualifier resolution:
- add test for unresolved 'a.a' after 'import a.a';
- added TODO in copy-paste test for 'a.a'
2015-11-02 10:22:50 +03:00
Dmitry Petrov
e1cb13bd90 Qualifier no longer defers "(nested) class vs package" resolution.
Consider FQN 'a.b.c'.
If 'a' is a classifier in the current scope,
    resolve rest in the corresponding class scope.
Otherwise (if 'a' is a package),
    find the maximum possible prefix 'a.b' resolving to a package,
    resolve rest in the corresponding package scope.
2015-11-02 10:22:50 +03:00
Alexander Udalov
a950f36fd7 Minor, fix test data 2015-10-31 13:52:04 +03:00
Stanislav Erokhin
25a168d2a4 Minor. Fix potential deadlock 2015-10-31 10:01:08 +03:00
Stanislav Erokhin
77411b2181 Allowed call value with extension function type as simple function type. 2015-10-31 10:01:07 +03:00
Denis Zharkov
b6f724cf58 Disconnect loops between upper bounds of type parameters
#KT-9759 Fixed
2015-10-31 09:33:46 +03:00
Denis Zharkov
9b4ad1466a Minor. Extract 'getAllUpperBounds' 2015-10-31 09:33:46 +03:00
Denis Zharkov
18097c0ab7 Introduce 'SupertypeLoopsResolver' and inject it's impls 2015-10-31 09:33:46 +03:00
Denis Zharkov
0bc5043c75 Extract and convert 'findLoopsInSupertypesAndDisconnect' 2015-10-31 09:33:45 +03:00
Denis Zharkov
8ba2dc5530 Simplify detecting loops in classes supertypes 2015-10-31 09:33:45 +03:00
Yan Zhulanow
33d67a3bf4 Fix JvmField applicability test data
(Annotation is not applied both to field & getter now)
2015-10-31 04:30:24 +03:00
Alexander Udalov
b5f89100f6 Remove obsolete SCRIPT markers 2015-10-30 23:41:32 +03:00
Alexander Udalov
c75d96b82c Add testcase for fixed issue
#KT-9850 Fixed
2015-10-30 23:41:10 +03:00
Michael Nedzelsky
48929f3edf Test for obsolete KT-9277
#KT-9277 Obsolete
2015-10-30 18:57:48 +03:00
Michael Nedzelsky
dbc00baa48 Test for obsolete KT-5508
#KT-5508 Obsolete
2015-10-30 18:57:45 +03:00
Michael Nedzelsky
947b4d4ce8 Test for obsolete KT-3343
#KT-3343 Obsolete
2015-10-30 18:57:42 +03:00
Valentin Kipyatkov
d38b3146db More correct completion of overrides in constructor parameters - '$' character confuses parser 2015-10-30 17:43:28 +03:00
Valentin Kipyatkov
c2cf95bcd4 KT-9787 Auto-popup parameter info on typing '['
#KT-9787 Fixed
2015-10-30 17:43:28 +03:00
Valentin Kipyatkov
def0e01e8d KT-9684 Add kotlinx.android.synthetic package to default imports with '*'
#KT-9684 Fixed
2015-10-30 17:43:27 +03:00
Valentin Kipyatkov
ebe3efe710 Minor 2015-10-30 17:43:26 +03:00
Valentin Kipyatkov
7e2b37bb0f KT-9813 Parameter name&type completion gets in the way of typing
#KT-9813 Fixed
2015-10-30 17:43:26 +03:00
Valentin Kipyatkov
752cdd5f83 KT-9815 Import insertion (on Alt-Enter) does not work in Evaluate Expression
#KT-9815 Fixed
2015-10-30 17:43:25 +03:00
Valentin Kipyatkov
61fc3e7705 Added test for auto-import fix in code fragment 2015-10-30 17:37:24 +03:00
Valentin Kipyatkov
ce50a27af0 KT-9729 Invert If Condition intention should run Simplify Negated Expression when applicable
#KT-9729 Fixed
2015-10-30 17:25:36 +03:00
Valentin Kipyatkov
87f68f3332 KT-9688 Completion of methods to override: prefer those that need to be implemented
#KT-9688 Fixed
2015-10-30 17:25:36 +03:00
Valentin Kipyatkov
acc451bc54 KT-9723 Completion of override property in constructor produces bad formatting
#KT-9723 Fixed
2015-10-30 17:25:36 +03:00
Valentin Kipyatkov
c643eb14a1 No i18n 2015-10-30 17:25:36 +03:00
Valentin Kipyatkov
3c1538997e Fixed "Make class open" in case of primary constructor
#KT-9767 Fixed
2015-10-30 17:25:36 +03:00
Valentin Kipyatkov
fc924d1c9f Not operator 2015-10-30 17:25:35 +03:00
Valentin Kipyatkov
d289ebd874 Cannot make any object 'abstract' 2015-10-30 17:25:35 +03:00
Valentin Kipyatkov
2b97a1034f Converted to Kotlin 2015-10-30 17:25:35 +03:00
Valentin Kipyatkov
2b3694a77e Do not drop use of SAM-constructor when it's required for labeled return 2015-10-30 17:25:35 +03:00
Valentin Kipyatkov
34298190b3 Use unaryPlus() and unaryMinus() instead of plus() and minus() + no identityEquals() 2015-10-30 17:25:35 +03:00
Valentin Kipyatkov
c5e13ebc68 Minor corrections on code review 2015-10-30 17:25:34 +03:00
Michael Bogdanov
7ee42ab18d Fix for KT-9828: DX error on MutableMap.MutableEntry<String, Int> deconstruction: attempt to set or access a value of type java.lang.Object using a local variable of type int.
#KT-9828 Fixed
2015-10-30 16:47:21 +03:00
Michael Nedzelsky
9a8b73c5a5 fix texts in error messages for Fintite Bound Restriction & Non-Expansive Inheritance Restriction 2015-10-30 16:39:19 +03:00
Mikhail Glukhikh
182cde1e02 Standard data flow analysis results are taken into account during condition analysis #KT-7933 Fixed 2015-10-30 16:14:34 +03:00
Mikhail Glukhikh
dd1196ae6b Condition analysis: left part of and (true condition) / or (false condition) is used for right part analysis #KT-8780 Fixed 2015-10-30 16:14:33 +03:00
Mikhail Glukhikh
12103d19d2 Smart casts inside property chains like a?.b?.c.foo(a, b) are now handled correctly #KT-7290 Fixed 2015-10-30 16:14:32 +03:00
Natalia Ukhorskaya
8be9be336f Fix NPE on stepping
#KT-9821 Fixed
2015-10-30 14:53:06 +03:00
Natalia Ukhorskaya
e1e845cef1 Fix conditional breakpoints 2015-10-30 14:53:06 +03:00
Michael Nedzelsky
3c855547e5 improve tests for access from tests to internal for maven and gradle (add override for internal function) 2015-10-30 14:42:44 +03:00
Michael Nedzelsky
6ebe0c30ec fix KT-9299 In a project with circular dependencies between modules, IDE reports error on use of internal class from another module, but the corresponding code still compiles and runs.
#KT-9299 Fixed
2015-10-30 14:40:46 +03:00
Mikhail Glukhikh
17b275af23 Preliminary declaration visitor: create for top-most declaration which is not class 2015-10-30 13:44:33 +03:00
Mikhail Glukhikh
932985f0c1 Preliminary declaration visitor: do not create if already exists 2015-10-30 13:34:01 +03:00
Valentin Kipyatkov
44e56c4b93 Correct scope declarations in completion for code fragments 2015-10-30 12:03:53 +03:00
Valentin Kipyatkov
5a69a17ab0 Minor 2015-10-30 12:03:53 +03:00
Valentin Kipyatkov
40d3f71e1a Temporary fix for completion of Android synthetic extensions 2015-10-30 12:03:53 +03:00
Valentin Kipyatkov
129f6f8532 Big refactoring of BasicCompletionSession 2015-10-30 12:03:53 +03:00
Valentin Kipyatkov
8b38d8d7b9 No top-level packages after "::" 2015-10-30 12:03:53 +03:00
Valentin Kipyatkov
46b9879c47 Added test 2015-10-30 12:03:53 +03:00
Valentin Kipyatkov
f44bbc375c Code refactoring + put named arguments completion into more reasonable order 2015-10-30 12:03:52 +03:00
Valentin Kipyatkov
4c6f6c2a2e Minor refactoring: excludeNonInitializedVariable() moved into ReferenceVariantsHelper 2015-10-30 12:03:52 +03:00
Valentin Kipyatkov
2e80a7194c Minor performance optimization 2015-10-30 12:03:52 +03:00
Valentin Kipyatkov
4ab2019da4 Competion in debugger for runtime receiver type should not show members grayed 2015-10-30 12:03:52 +03:00
Valentin Kipyatkov
af441d32b1 Minor corrections to "compareDescriptors" but still lot of question to its implementation and semantics 2015-10-30 12:03:52 +03:00
Valentin Kipyatkov
582443ea7b More efficient filtering of runtime receiver type variants in debugger 2015-10-30 12:03:51 +03:00
Valentin Kipyatkov
3e3d86aebb A little bit more correct filtering 2015-10-30 12:03:51 +03:00
Valentin Kipyatkov
0ee2b512ff Completion of non-imported extensions in debugger for runtime receiver type 2015-10-30 12:03:51 +03:00
Valentin Kipyatkov
c9048266c8 Fixed extensions completion for runtime receiver type in debugger (broken by previos changes in extensions completion) 2015-10-30 12:03:51 +03:00
Valentin Kipyatkov
a26f6da12d Do not filter out synthetic extensions (if they will ever exist in future) 2015-10-30 12:03:51 +03:00
Valentin Kipyatkov
9feed9c3ef Fixed filtering of shadowed declarations after changes in extensions treatment 2015-10-30 12:03:50 +03:00
Valentin Kipyatkov
be5569d31a Performance optimization in completion: do not analyze all extensions available from imports - use index 2015-10-30 12:03:50 +03:00
Michael Bogdanov
9f9217b9c3 Test for obsolete KT-9642
#KT-9642 Obsolete
2015-10-30 09:39:11 +03:00
Michael Bogdanov
f3092bf390 Fix for KT-9637: Runtime crash when using class literal in inline functions with reified type parameters
#KT-9637 Fixed
2015-10-30 09:39:10 +03:00
Michael Bogdanov
34fccc6dae Fix for KT-6990: inline reified doesn't inline call in some cases
#KT-6990 Fixed
2015-10-30 09:39:09 +03:00
Michael Bogdanov
33bf314518 Fix for KT-6552 IllegalAccessError in inline function with "when" over enum across modules
#KT-6552 Fixed
2015-10-30 09:39:09 +03:00
Michael Bogdanov
9e5af43ce1 Fix for KT-9788: AssertionError from back-end when we read field from inline function
#KT-9788 Fixed
2015-10-30 09:39:08 +03:00
Alexander Udalov
7046f63511 Move/inline stuff from TypeUtils to other modules 2015-10-29 21:16:07 +03:00
Alexander Udalov
5677ff60e7 Move/inline stuff from DescriptorUtils to other modules 2015-10-29 21:16:06 +03:00
Alexander Udalov
2c64848826 Don't swallow exception in KotlinBuiltIns, assert instead
See 16b6bcc

 #KT-9820 Open
2015-10-29 21:16:05 +03:00
Alexander Udalov
4d909d9012 Move LexicalScope to frontend 2015-10-29 21:16:05 +03:00
Alexander Udalov
09a36acee4 Minor, remove HTML from kdoc 2015-10-29 21:16:04 +03:00
Denis Zharkov
9b29181878 Minor. Add Kotlin overrides to test
#KT-6733 Obsolete
2015-10-29 21:05:52 +03:00
Denis Zharkov
7eed041a7a Use original descriptor when obtaining source 2015-10-29 21:05:52 +03:00
Denis Zharkov
5755af6b27 Remove wrong condition part: there could be irrelevant overrides from Kotlin 2015-10-29 21:05:52 +03:00
Denis Zharkov
291f0e57d1 Introduce FunctionDescriptor.initialSignatureDescriptor
Mostly it's needed for backend to extract descriptor with initial signature

For example:
class A implements CharSequence {
        char charAt(int index) {}
}

We see `charAt` this method as `fun get(index: Int): Char`, but in backend it
matters what signature had this descriptor before.
2015-10-29 21:05:51 +03:00
Denis Zharkov
95d12260c1 Fix project sources after latter changes
ResolveSession is inherited from two interfaces:
1. The one written in Java with 'getModuleDescriptor'
2. And the second one in Kotlin with property 'moduleDescriptor'

Now we treat such declarations from supertypes like they are just plain
property accessor overrides, and 'getModuleDescripton' and it's friends
becomes invisible via ResolveSession
2015-10-29 21:05:51 +03:00
Denis Zharkov
94803ce1c4 Collect overrides of special builtin members in super types
#KT-9695 Fixed
2015-10-29 21:05:26 +03:00
Denis Zharkov
060178e53f Minor. Convert extension to common function 2015-10-29 18:41:51 +03:00
Denis Zharkov
50125f612e Unify creation of special builtin functions
Create all of them --- both renamed and with de-erased signature ---
within 'computeNonDeclaredFunctions'.

This helps to get rid of open 'resolveMethodToFunctionDescriptor'
and guarantees that method inside 'isVisibleAsFunction'
is always without any magic.
2015-10-29 18:41:51 +03:00
Denis Zharkov
c855d3fad9 Minor. Extract searchMethodsByNameWithoutBuiltinMagic and weaken return types 2015-10-29 18:41:51 +03:00
Denis Zharkov
80bf7316c7 Add 'preserveSource' parameter to methods making substitution copies 2015-10-29 18:41:51 +03:00
Denis Zharkov
dd46056784 Introduce SimpleFunctionDescriptor.createCopyWithNewValueParameters 2015-10-29 18:41:51 +03:00
Denis Zharkov
4e7731f41f Refactor 'isVisibleAsFunction' to make it work with SimpleFunctionDescriptor
Also inline 'resolveMethodToFunctionDescriptorWithName'
2015-10-29 18:41:50 +03:00
Denis Zharkov
ce34550c42 Introduce and implement SimpleFunctionDescriptor.createRenamedCopy 2015-10-29 18:41:50 +03:00
Stanislav Erokhin
69038063a6 Mark callable reference candidate as error when there is error type. 2015-10-29 15:30:32 +03:00
Stanislav Erokhin
d019445493 Minor. Add tracing strategy to MutableResolvedCall 2015-10-29 15:30:32 +03:00
Stanislav Erokhin
97f6213873 Minor. Introduce public constructor ResolvedCallImpl for future use 2015-10-29 15:30:32 +03:00
Stanislav Erokhin
5e6a86fa70 Minor. Make public util function stripCallArguments in CallTransformer 2015-10-29 15:30:31 +03:00
Stanislav Erokhin
cccc4fccd1 Minor. change several signatures 2015-10-29 15:30:31 +03:00
Stanislav Erokhin
1737c7251a Minor. Extract createLookupLocation for call 2015-10-29 15:30:30 +03:00
Stanislav Erokhin
0120139f9c Fix for EA-74904. 2015-10-29 15:30:30 +03:00
Stanislav Erokhin
98379d64e8 Minor. Workaround for KT-9788 AssertionError from backand when we read field from inline function 2015-10-29 15:30:29 +03:00
Nikolay Krasko
41cbc12d7f Don't propose to make objects abstract (KT-9795)
#KT-9795 Fixed
2015-10-29 14:37:15 +03:00
Nikolay Krasko
8bef335b71 Don't propose to generate Any methods in interface to avoid METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE error (KT-9796)
#KT-9796 Fixed
2015-10-29 14:37:14 +03:00
Nikolay Krasko
625907e49d Refactoring: move check for Any member into builtins 2015-10-29 14:37:13 +03:00
Alexander Udalov
925b0e567e Minor, delete leftovers from package part refactorings 2015-10-28 21:51:19 +03:00
Alexander Udalov
c5ec3b0f6f Minor, drop HTML and improve language in ConstraintSystem kdoc 2015-10-28 21:45:51 +03:00
Alexander Udalov
5fc14e0224 Move constraint system, type intersection, common supertypes to compiler 2015-10-28 19:17:58 +03:00
Alexander Udalov
302cd3ca2f Minor, move some utilities closer to their usages 2015-10-28 19:17:56 +03:00
Alexander Udalov
d6e87c50ab Don't use TypeIntersector when loading generic Java constructors
This is not entirely type-safe but this case is so rare that hardly anyone will
be able to spot the change
2015-10-28 19:17:56 +03:00
Alexander Udalov
86bc21da30 Make getUpperBoundsAsType an utility, remove from TypeParameterDescriptor 2015-10-28 19:17:53 +03:00
Alexander Udalov
12d6b6e7e4 Use "Any?" as out-type for type parameters instead of intersection of bounds
Also refactor checkSubtypeForTheSameConstructor to compute everything in the
best order
2015-10-28 19:12:26 +03:00
Alexander Udalov
bed75e8af2 Remove some unjustified usages of TypeParameterDescriptor#getUpperBoundsAsType 2015-10-28 19:12:24 +03:00
Alexander Udalov
426bddb54e Move OverridingUtil#getUpperBound to OverloadUtil, add tests on overloads 2015-10-28 19:12:05 +03:00
Alexander Udalov
477823b093 Change override rules when type parameters have multiple bounds
Instead of constructing the magic intersection type, compare sets of upper
bounds instead as javac does, modulo the substitution
2015-10-28 19:12:02 +03:00
Alexander Udalov
a59ca2ea9f Simplify obsolete code in OverridingUtil 2015-10-28 19:12:00 +03:00
Alexander Udalov
996c14d071 Use representative upper bound in JetTypeMapper instead of just the first 2015-10-28 19:11:59 +03:00
Alexander Udalov
3918005364 Minor, improve compileJavaAgainstKotlin test
Render human-readable output when there are errors
2015-10-28 19:11:58 +03:00
Alexander Udalov
d29757d927 Make upper bounds of type parameter a list instead of a set
The same for lower bounds, also refactor type parameter implementations
2015-10-28 19:11:56 +03:00
Alexander Udalov
1ce5f8458c Extract ClassMapperLite, add enlightening comment 2015-10-28 19:11:55 +03:00
Alexander Udalov
0302b9504f Minor, inline some other FQ name methods 2015-10-28 19:11:54 +03:00
Alexander Udalov
05f9f5a661 Drop path() from FQ names, remove weird code from FqNameUnsafe 2015-10-28 19:11:53 +03:00
Alexander Udalov
8a89662ea5 Remove FqNameBase, simplify FqName and FqNameUnsafe 2015-10-28 19:11:53 +03:00
Alexander Udalov
894a97a549 Rename field for property metadata cache to prevent problems in inline 2015-10-28 19:11:51 +03:00
Mikhail Glukhikh
6e3eef2d6f JetTypeInfo renamed to KotlinTypeInfo 2015-10-28 17:36:34 +03:00
Dmitry Petrov
4eb7458143 box test for KT-9712: tests were generated in different order. 2015-10-28 17:15:05 +03:00
Michael Nedzelsky
c123af75fd issue warning instead of error in case of finite bound or non-expansive inheritance violation in java code 2015-10-28 17:02:02 +03:00
Mikhail Glukhikh
d2c65a5336 Iterative call chain handling to get rid of JetTypeInfoInsideCallChain and other nasty things #KT-9754 Fixed 2015-10-28 16:00:30 +03:00
Sergey Mashkov
16b6bccd1e Eliminate IllegalArgumentException caused by possible negative sized ArrayList creation 2015-10-28 15:45:25 +03:00
Michael Bogdanov
63f7f90521 Test for obsolete KT-8047
#KT-8047 Obsolete
2015-10-28 14:43:05 +03:00
Mikhail Glukhikh
f8a70302ac Cleanup: get rid of effective visibility warnings 2015-10-28 14:31:51 +03:00
Natalia Ukhorskaya
932542891b Stepping for inline functions: add test for last statement in for 2015-10-28 14:23:52 +03:00
Natalia Ukhorskaya
de5c3733e9 Do not use visitor for counting lambda ordinal for debugger 2015-10-28 14:23:52 +03:00
Natalia Ukhorskaya
eac6fdbaa0 Fix linenumbers in tests 2015-10-28 14:23:51 +03:00
Natalia Ukhorskaya
a8008dfa26 Do not use resove in catPutAt for breakpoints 2015-10-28 14:23:50 +03:00
Natalia Ukhorskaya
67e66f74bc Minor: fix warnings 2015-10-28 14:23:49 +03:00
Natalia Ukhorskaya
e534636f03 Support multiple breakpoints at one line (especially for lambdas) 2015-10-28 14:23:49 +03:00
Natalia Ukhorskaya
c071bf5c63 Fix lines for FieldBreakpoints in tests 2015-10-28 14:23:48 +03:00
Natalia Ukhorskaya
17a564495d Stepping for inline function: filter out inline function body lines from step over
#KT-9665 Fixed
2015-10-28 14:23:47 +03:00
Natalia Ukhorskaya
b8e649e843 Minor: rename test 2015-10-28 14:23:46 +03:00
Natalia Ukhorskaya
66a5351cd0 Do not show fake local variables for inline function/argument in Variables View for Debugger 2015-10-28 14:23:45 +03:00
Natalia Ukhorskaya
cdcafb8199 Fix stepping for inline function inside while statement 2015-10-28 14:23:45 +03:00
Natalia Ukhorskaya
258790cc2f Minor: refactor tests 2015-10-28 14:23:44 +03:00
Natalia Ukhorskaya
e2411f8e46 Debugger tests: catch exceptions correctly 2015-10-28 14:23:43 +03:00
Natalia Ukhorskaya
4f1af224d1 Rewrite CheckLocalVariableTableTest using assertEqualsToFile 2015-10-28 14:23:43 +03:00
Natalia Ukhorskaya
dd30462fd1 Support smart step into for inline function arguments 2015-10-28 14:23:42 +03:00
Natalia Ukhorskaya
c98ebffbcf Debugger: evaluate Ref$element to element value 2015-10-28 14:23:41 +03:00
Natalia Ukhorskaya
77f1a3a7f3 Minor: change test directives 2015-10-28 14:23:40 +03:00
Natalia Ukhorskaya
e68700190d Use fake local variable for inline argument in debugger 2015-10-28 14:23:39 +03:00
Natalia Ukhorskaya
dfbafc7173 Extract isInlineArgument for debugger 2015-10-28 14:23:39 +03:00
Michael Bogdanov
7c7cff3d6e Updated diagnostic message for INVISIBLE_MEMBER_FROM_INLINE
#KT-7323 Fixed
2015-10-28 14:10:27 +03:00
Nikolay Krasko
0fcb51f0a2 KT-1478 Quick fix for using nullable collection in "for in" expression
#KT-1478 Fixed
2015-10-28 13:39:49 +03:00
Nikolay Krasko
911432c99c Use default render to check are all errors mentioned in tests. It's far more easier to read. 2015-10-28 13:39:46 +03:00
Nikolay Krasko
b8c72ec4e9 Suggest to add !! as a quick-fix for type mistmach 2015-10-28 13:39:44 +03:00
Michael Bogdanov
f3e6fab68e Fix for KT-4250: IllegalAccessError when using protected java member from lambda function
#KT-4250 Fixed
2015-10-28 11:57:21 +03:00
Michael Bogdanov
0a70c80af3 Substitute superClassExpression with superCallClass in synthetic accessors 2015-10-28 11:57:20 +03:00
Dmitry Petrov
21d927b7a4 Test for KT-9712 (fixed along with KT-9717)
#KT-9712 Fixed
2015-10-28 10:39:03 +03:00
Michael Nedzelsky
190bab099c fix KT-9441 Unable to Access Internal Classes from Test Code within Same Module
#KT-9441 Fixed
2015-10-28 01:58:54 +03:00
Alexander Udalov
395c0f12b1 Fix confusing behavior in test when assertion fails 2015-10-27 23:31:29 +03:00
Ilya Gorbunov
e2c9267305 Fix compiler tests with incompatible types in assertEquals arguments. 2015-10-27 21:48:29 +03:00
Ilya Gorbunov
579ce8091c Cleanup tests, specify type where it's ambiguous. 2015-10-27 21:48:27 +03:00
Ilya Gorbunov
0b74698c16 @OnlyInputTypes for assertEquals and expect 2015-10-27 21:48:24 +03:00
Ilya Gorbunov
551e0181dc Require explicit type parameter specification for filterIsInstance. 2015-10-27 21:47:50 +03:00
Zalim Bashorov
a5708c9c0d Track lookups in JavaSyntheticPropertiesScope 2015-10-27 19:38:32 +03:00
Zalim Bashorov
412e078a6b Allow to fail on initial build in incremental tests if testdata contains "init-build.log" file 2015-10-27 19:37:10 +03:00
Zalim Bashorov
cc3c76ae67 Add the support checking lookups after modifications 2015-10-27 19:37:09 +03:00
Zalim Bashorov
2d859d6191 Minor: print "<root>" for root package instead empty string in Lookup tests.
Additionally fixed warnings.
2015-10-27 19:37:09 +03:00
Pavel V. Talanov
289b1a5883 LibraryModificationTracker: check whether project is already disposed 2015-10-27 18:51:50 +03:00
Mikhail Glukhikh
55c1addb93 Workaround for a part of KT-9700: top-level Java classes with private visibility are considered package private 2015-10-27 18:27:41 +03:00
Valentin Kipyatkov
78f0de3de5 Removed hack for Repl 2015-10-27 18:24:56 +03:00
Valentin Kipyatkov
91ff27f78c Rename 2015-10-27 18:24:56 +03:00
Valentin Kipyatkov
79825fc1e6 More efficient LexicalScope.addImportScopes 2015-10-27 18:24:56 +03:00
Valentin Kipyatkov
55c2b71829 Removed asLexicalScope from ScopeUtils.kt 2015-10-27 18:24:55 +03:00
Valentin Kipyatkov
74d14d30b0 No use of "by ..Scope.Empty" 2015-10-27 18:24:55 +03:00
Valentin Kipyatkov
3aa2a60dc1 Repl injects scope via own FileScopeProvider implementation instead of AdditionalScopes 2015-10-27 18:24:55 +03:00
Valentin Kipyatkov
47f938d7fc Minor 2015-10-27 18:24:55 +03:00
Valentin Kipyatkov
67a0cc3c49 Dropped searching synthetic extensions in imports 2015-10-27 18:24:55 +03:00
Valentin Kipyatkov
59fa639ab4 Refactored ReferenceVariantsHelper to not require KtSimpleNameExpression 2015-10-27 18:24:55 +03:00
Pavel V. Talanov
dc791941d7 JvmAnalyzerFacade: Do not fail when java resolve api behaves in an unexpected way
Fixes a problem when java type from a library can be resolved to a class in source root
2015-10-27 18:07:17 +03:00
Pavel V. Talanov
4c70700943 Introduce api to get nullable ResolverForModule by ModuleInfo 2015-10-27 18:07:16 +03:00
Stanislav Erokhin
ff00bde607 Removed dispatch receiver parameter for SyntheticFieldDescriptor 2015-10-27 15:36:38 +03:00
Stanislav Erokhin
553834fa9e KT-9371 Callable reference resolve should not prefer one of the overloads by some magic reasons
#KT-9371 Fixed
2015-10-27 15:36:37 +03:00
Valentin Kipyatkov
891e033d5b KT-9664 Add quickfix to convert a piece of code to pretty look SAM-style
#KT-9664 Fixed
2015-10-27 15:07:59 +03:00
Dmitry Petrov
ad030a2c03 KT-9721:
- Scripts should be included in files with callables.
2015-10-27 15:06:32 +03:00
Michael Bogdanov
b0efcec392 Fix for KT-9711: Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE
#KT-9711 Fixed
2015-10-27 13:22:07 +03:00
Dmitry Petrov
882827bf04 KT-9717, KT-9603:
pass getter/setter-related flags to AccessorForPropertyDescriptor
2015-10-27 12:02:27 +03:00
Natalia Ukhorskaya
e83315f5bc Gradle plugin: do not store generated folder for android into sourceSets, because they are reused for different buildTypes and flavors
#KT-8202 Fixed #KT-9715 Fixed
2015-10-27 11:41:24 +03:00
Yan Zhulanow
10eed8f7cd Fix incremental test (DefaultImpls are not generated for an empty interface) 2015-10-27 02:46:57 +03:00
Michael Nedzelsky
63f84fc60e fix KT-9733 No error shown for 2 "main" functions in the same file
#KT-9733 Fixed
2015-10-26 21:30:24 +03:00
Dmitry Jemerov
31bff24c55 fix senseless action visibility checks 2015-10-26 19:27:01 +01:00
Pavel V. Talanov
55006872a1 LibraryModificationTracker
Do not track external annotations
Make use of BulkFileListener to avoid processing extra files
Defer library classes check for newly created files: fixes a problem of indices not being updated at the time
Correctly check if the file is a jar file root of a library
Ther latter 2 changes fix a problem where resolve caches were not recomputed in case of deleting and readding jar files of a library
2015-10-26 21:14:44 +03:00
Alexander Udalov
b8b98b4eaa Support get/set on KProperty objects for delegated properties 2015-10-26 21:02:35 +03:00
Alexander Udalov
f2a37b4150 Minor, move KProperty for property references to separate file 2015-10-26 21:02:35 +03:00
Alexander Udalov
a97567ea0c Optimize KProperty objects for delegated properties
Don't generate anonymous classes with a lot of methods because this hurts
Android. Add special classes to the runtime instead (also add
FunctionReferenceImpl, to be used later) and just create their instances in the
static initializer of each class
2015-10-26 21:02:34 +03:00
Yan Zhulanow
2d1a7163a3 Minor: changes on review 2015-10-26 20:38:41 +03:00
Yan Zhulanow
3475b4796f Do not generate DefaultImpls if empty 2015-10-26 20:37:31 +03:00
Yan Zhulanow
2a28baa154 Remove ACC_STATIC from DefaultImpls 2015-10-26 20:37:29 +03:00
Pavel V. Talanov
bf6464ddcd Repl: clearer separation of ide and console logic
Fix a bug with redundant new lines printed in console mode
2015-10-26 20:17:45 +03:00
Pavel V. Talanov
d0097c85d3 Repl: enhance test framework to wait for commands to be processed, not some text to appear 2015-10-26 20:17:45 +03:00
Pavel V. Talanov
03c3fd2c2b Repl: correctly handle readLine() 2015-10-26 20:17:44 +03:00
Pavel V. Talanov
6237e516d4 Repl: fix a problem where handling an incomplete message led to xml parsing exception 2015-10-26 20:17:43 +03:00
Pavel V. Talanov
e20bcbde53 Repl: keep track of command entries which were already processed
Fixes race condition
2015-10-26 20:17:43 +03:00
Pavel V. Talanov
0fe3ef7cf4 Repl: refactor ide code
More accurate class names
Move all shared state to KotlinConsoleRunner class
2015-10-26 20:17:42 +03:00
Pavel V. Talanov
e10df1a05d Repl: notify about successfully executing lines 2015-10-26 20:17:41 +03:00
Pavel V. Talanov
b5dfbcdde8 Repl, minor: extract function 2015-10-26 20:17:40 +03:00
Pavel V. Talanov
b07fb88a22 Repl, minor: more meaningful method names 2015-10-26 20:17:40 +03:00
Pavel V. Talanov
e08ce5545e Repl test: increase waiting time
Hoping to prevent failing on slow teamcity agents
2015-10-26 20:17:39 +03:00
Alexander Udalov
d021821db5 Minor, add constructors with messages and causes to KotlinReflectionNotSupportedError 2015-10-26 19:40:04 +03:00
Dmitry Petrov
09f0b3fe87 KT-9721:
- Kotlin/JS still uses package facades.
Handle them properly in StubClassBuilder parentStack.
- Generate backend-related diagnostics in IDE
using light class generation for file facades.
- Drop PackageFacadeStubCache.
2015-10-26 19:37:52 +03:00
Valentin Kipyatkov
4fcd35a5a9 Introduced LexicalScope for file top-level to obtain ownerDescriptor 2015-10-26 19:30:05 +03:00
Valentin Kipyatkov
7a33a16481 Removed one more usage of asKtScope() 2015-10-26 19:30:05 +03:00
Valentin Kipyatkov
c239e84aa0 Removed hack for package directive completion 2015-10-26 19:30:05 +03:00
Valentin Kipyatkov
a5982281af Temporary fix for problem with ownerDescriptor in ImportingScope 2015-10-26 19:30:05 +03:00
Valentin Kipyatkov
03f18e1ac1 Extraction refactorings tests: do not generate conflict files in case of any exception from code 2015-10-26 19:30:05 +03:00
Valentin Kipyatkov
c44dc41431 Fixed getting ownerDescriptor from ImportingScope 2015-10-26 19:30:04 +03:00
Valentin Kipyatkov
95a0372b43 Using PsiElement.getResolutionScope instead of LEXICAL_SCOPE from BindingContext 2015-10-26 19:30:04 +03:00
Valentin Kipyatkov
6af71caaa9 Moved PsiElement.getResolutionScope utliity into ide-common 2015-10-26 19:30:04 +03:00
Valentin Kipyatkov
a6165f4690 Got rid of two getContributedDescriptors calling each other 2015-10-26 19:30:04 +03:00
Valentin Kipyatkov
ed6f845377 Added utility functions for synthetic extensions in scope 2015-10-26 19:30:04 +03:00
Valentin Kipyatkov
c09cf63424 Added utility functions for functions and variables in scope 2015-10-26 19:30:03 +03:00
Valentin Kipyatkov
5f06f53bfd Renames 2015-10-26 19:30:03 +03:00
Valentin Kipyatkov
e1b8b21abb Minor 2015-10-26 19:30:03 +03:00
Valentin Kipyatkov
6b85bf24a0 One usage of asLexicalScope removed 2015-10-26 19:30:03 +03:00
Valentin Kipyatkov
b4dbb666fc More usages of asKtScope() removed 2015-10-26 19:30:03 +03:00
Valentin Kipyatkov
9a99559b12 No getFileKtScope 2015-10-26 19:30:02 +03:00
Valentin Kipyatkov
2ddaa15036 Removed more usages of asKtScope() 2015-10-26 19:30:02 +03:00
Valentin Kipyatkov
2b325327f4 Dropped one usage of asKtScope() 2015-10-26 19:30:02 +03:00
Valentin Kipyatkov
0b34fecf94 Fixed test data but template macro "kotlinSuggestVariableName()" must be completely rewritten 2015-10-26 19:30:02 +03:00
Valentin Kipyatkov
470e9ba776 Fixed 2015-10-26 19:30:01 +03:00
Valentin Kipyatkov
6ca6718271 Dropped BindingContext.RESOLUTION_SCOPE 2015-10-26 19:30:01 +03:00
Valentin Kipyatkov
44415cf321 Less use of RESOLUTUON_SCOPE from BindingContext 2015-10-26 19:30:01 +03:00
Valentin Kipyatkov
961ffee8ee Converted to Kotlin 2015-10-26 19:30:01 +03:00
Valentin Kipyatkov
3eb1cff36a Less use of KtScope 2015-10-26 19:30:00 +03:00
Valentin Kipyatkov
c93de93332 FileScopeProvider.AdditionalScopes return ImportingScope's 2015-10-26 19:30:00 +03:00
Valentin Kipyatkov
99aeb305db Less conversion between KtScope and ImportingScope 2015-10-26 19:30:00 +03:00
Valentin Kipyatkov
3471667aa0 Minor refactoring 2015-10-26 19:30:00 +03:00
Valentin Kipyatkov
6252fb04c4 Fixing replaceFileScope and other stuff 2015-10-26 19:29:59 +03:00
Valentin Kipyatkov
9eeb051bd4 Refactoring FileScope into a chain of ImportingScope's (all compiler tests pass) 2015-10-26 19:29:59 +03:00
Valentin Kipyatkov
712e294eac Renamed FileScope to ImportingScope and it now may have parent. But all implementations currently have parent == null 2015-10-26 19:29:59 +03:00
Alexey Tsvetkov
294559a94f Overridable val should not be treated as constant
#KT-9443 fixed
2015-10-26 19:23:09 +03:00
Alexey Tsvetkov
0a69cca066 Box primitive types in position of generic receiver
#KT-9469 fixed
2015-10-26 18:36:59 +03:00
Alexey Tsvetkov
7c54024a22 Fix private setter visibility for generic class
#KT-8888 fixed
2015-10-26 18:36:59 +03:00
Ilya Chernikov
7dbb0dff2c Placing forced shutdown timeout into daemon options, setting default to 10s, removing appropriate property as obsolete 2015-10-26 15:59:11 +01:00
Ilya Chernikov
80fb9b8473 Removing try/catch in the lock file acquiring algo, to avoid hanging like in case described here - https://devnet.jetbrains.com/message/5561306
it should now fail and fallback to in-process compilation
2015-10-26 15:59:10 +01:00
Ilya Chernikov
2fa0988c85 Increasing socket backlog size in attempt to solve problems like EA-74493 (connection refused) 2015-10-26 15:59:09 +01:00
Denis Zharkov
881fe640e7 Create non-default getter for Enum.values property
#KT-9687 Fixed
2015-10-26 17:32:15 +03:00
Nikolay Krasko
234360a471 Fix compilation in KotlinFrameExtractVariablesProvider
(cherry picked from commit ed06e05)
2015-10-26 17:16:52 +03:00
Natalia Ukhorskaya
15531d0bb7 Update since for plugin due to compilation error in KotlinFrameExtractVariablesProvider 2015-10-26 17:16:51 +03:00
Natalia Ukhorskaya
4f64661db0 Update to IDEA 143.379.11 2015-10-26 17:16:50 +03:00
Mikhail Glukhikh
4b6cb3ebce A new kind of synthetic accessors for backing fields, if accessed inside lambda / object literal / local class #KT-9657 Fixed
A set of tests provided
Also #KT-4867 Fixed
Also #KT-8750 Fixed
Slight codegen refactoring
2015-10-26 16:37:32 +03:00
Dmitry Petrov
ccad435850 KT-9644: override default behavior for non-local return in FixStackAnalyzer 2015-10-26 15:56:57 +03:00
Nikolay Krasko
5d1bcbf2be Try to cancel jar processing if some thread do it already 2015-10-26 15:08:54 +03:00
Mikhail Glukhikh
d0e01153ec Effective visibility: java package-private is now considered as equivalent to Kotlin internal #KT-9755 Fixed 2015-10-26 15:00:14 +03:00
Mikhail Glukhikh
994feafd6e Lookup fixed to search for SyntheticFieldDescriptor inside MethodContext 2015-10-26 13:36:34 +03:00
Mikhail Glukhikh
98e0771ffa Abstract var setter visibilities: now only private setters are forbidden 2015-10-26 11:55:34 +03:00
Mikhail Glukhikh
5ebbdd9f58 Cleanup: implicit nothing return type is now an error 2015-10-26 11:55:30 +03:00
Alexander Udalov
9d7cc25228 Fix code style settings after language was renamed to Kotlin 2015-10-25 15:52:04 +03:00
Alexey Sedunov
3ba55914c1 Create Test: Postpone J2K conversion until smart mode (matters if the user decides to add library in the Create Test dialog) 2015-10-24 19:50:57 +03:00
Alexey Sedunov
b6c01c0f94 Minor: Move DumpService-related functions to dumbUtils.kt 2015-10-24 19:50:56 +03:00
Alexey Sedunov
8d3296e08d Change Signature: Search & process as-property usages of Java methods (This ixes some muted tests on Change Signature for properties).
Improve test data
2015-10-24 19:50:55 +03:00
Alexey Sedunov
ad0c12935b Find Usages: Include super declarations when highliting usages in the current file 2015-10-24 19:50:54 +03:00
Alexey Sedunov
9c360ef05a Find Usages: Look for as-property usages of Java methods 2015-10-24 19:50:53 +03:00
Alexey Sedunov
7e9222f70a Extraction Engine: Set default visibility to 'public' 2015-10-24 19:50:52 +03:00
Alexey Sedunov
3fd6864461 Extraction Engine: When extracting to enum class body, place new declaration after the last entry
#KT-9629 Fixed
2015-10-24 19:50:52 +03:00
Alexey Sedunov
40f2a983cc Formatter: Spacing before after semicolon in enum classes 2015-10-24 19:50:51 +03:00
Alexey Sedunov
98b3919824 J2K: KtClassBody 2015-10-24 19:50:50 +03:00
Alexey Sedunov
d8864544d2 J2K: Rename KtClassBody (.java -> .kt) 2015-10-24 19:50:49 +03:00
Alexey Sedunov
ca87e7933f Move: Drop Java on-demand static imports of facade class members when original facade is eliminated due to Move refactoring
#KT-9624 Fixed
2015-10-24 19:50:48 +03:00
Alexey Sedunov
5dc0e7f2d5 Extraction Engine: Use original topmost descriptors when validating extracted code (fixes 'mutablyFlexibleType' test which failed after migration to generic contains/remove/etc. members in collections) 2015-10-24 19:50:48 +03:00
Alexey Sedunov
07259fa090 Generate Secondary Constructor: Fix test data loading. Add test with non-generic Java superclass 2015-10-24 19:50:47 +03:00
Nikolay Krasko
3c07bc3df7 Import all components and delegates accessors if possible 2015-10-23 22:07:52 +03:00
Alexander Udalov
1517a099d0 Search for JvmName also among use-site targeted annotations
#KT-9699 Fixed
2015-10-23 19:03:50 +03:00
Alexander Udalov
ae4c7b5a61 Minor, rename codegen tests on platformName and platformStatic 2015-10-23 19:03:49 +03:00
Michael Bogdanov
18f3eb87e4 INSTANCE field deprecated in companion object
Fix for KT-9692: Deadlock between <clinit> of a class (KtSimpleNameExpressionImpl) and <clinit> of its companion object

 #KT-9692 Fixed
2015-10-23 17:39:27 +03:00
Nikolay Krasko
7927185cc7 More fixes in version regexp and move override-version call to the place where compiler is downloaded 2015-10-23 13:17:08 +03:00
Svetlana Isakova
c167a77c8a Filter annotations while substituting compound type 2015-10-22 21:55:17 +03:00
Svetlana Isakova
f00af72e0f Fixed 'OnlyInputTypes' working with platform types 2015-10-22 21:55:16 +03:00
Svetlana Isakova
b24cb2a326 Fixed 'OnlyInputTypes' working with number types 2015-10-22 21:55:14 +03:00
Svetlana Isakova
9877fe1a26 Fixed the call completer
to update the type of the argument expression correctly
2015-10-22 21:55:13 +03:00
Svetlana Isakova
06e90cf6a1 Annotated the return type of 'elvis' function with @Exact
fun <T> ELVIS(T?, T): @Exact T
2015-10-22 21:55:12 +03:00
Svetlana Isakova
7150be7c67 Minor: fixed error message 2015-10-22 19:09:46 +03:00
Valentin Kipyatkov
27ef6fab21 Accessor completion uses code style settings 2015-10-22 18:48:19 +03:00
Valentin Kipyatkov
74f2d60e19 No duplicate property accessor should be allowed 2015-10-22 18:48:19 +03:00
Valentin Kipyatkov
6eba45febd KT-9661 Code completion of "get" and "set" in property accessors
#KT-9661 Fixed
2015-10-22 18:48:19 +03:00
Valentin Kipyatkov
798223b0e4 Better presentation for use site targets in completion 2015-10-22 18:48:18 +03:00
Valentin Kipyatkov
b7809ed94a Functions to properties 2015-10-22 18:48:18 +03:00
Valentin Kipyatkov
6cfb30bb81 KT-9388 Code completion inserts use-site annotation target with superfluous chars
#KT-9388 Fixed
2015-10-22 18:48:18 +03:00
Valentin Kipyatkov
fabf3e5e84 More correct keyword completion after "@" 2015-10-22 18:48:18 +03:00
Valentin Kipyatkov
235399f784 KT-8036 Completion does not suggest file after @ in file header
#KT-8036 Fixed
2015-10-22 18:48:18 +03:00
Valentin Kipyatkov
33a0673f49 Minor 2015-10-22 18:48:17 +03:00
Valentin Kipyatkov
5d3145c3c3 Fixed KT-7431 org.jetbrains.kotlin.idea.quickfix.AutoImportFix memory leak
#KT-7341 Fixed
2015-10-22 18:48:17 +03:00
Valentin Kipyatkov
b26a590614 KT-7844 Completion for top level classes should propose the file name
#KT-7844 Fixed
2015-10-22 18:48:17 +03:00
Valentin Kipyatkov
eb8fb80325 ScrollType.CENTER for create from usage 2015-10-22 18:48:17 +03:00
Valentin Kipyatkov
0a520f8bdd More creation by pattern instead of text 2015-10-22 18:48:17 +03:00
Valentin Kipyatkov
612f9b1041 Comments and formatting preseving added 2015-10-22 18:48:17 +03:00
Valentin Kipyatkov
7c8967ea4e Refactored to use creation of expression by pattern instead of plain text 2015-10-22 18:48:16 +03:00
Valentin Kipyatkov
311bd5f25d One more test added 2015-10-22 18:48:16 +03:00
Valentin Kipyatkov
a3d9085ddd Disabled "Convert to get/set call" intention where it did not work correctly anyway 2015-10-22 18:48:16 +03:00
Valentin Kipyatkov
c6978d6b69 KT-9450 «Replace overloaded operator with function call» breaks code for index access result saved to variable
#KT-9450 Fixed
2015-10-22 18:48:16 +03:00
Valentin Kipyatkov
6baef687ef Minor 2015-10-22 18:48:16 +03:00
Valentin Kipyatkov
ab04ae4956 KT-9365 Code completion does not suggest annotation names at type usage
#KT-9365 Fixed
2015-10-22 18:48:15 +03:00
Valentin Kipyatkov
197218a512 KT-9389 Code completion inserts annotation FQN into annotation list
#KT-9389 Fixed
2015-10-22 18:48:15 +03:00
Valentin Kipyatkov
66310806ca KT-9628 Intention&inspection to replace use of "set" operator function with []
#KT-9628 Fixed
2015-10-22 18:48:15 +03:00
Valentin Kipyatkov
852579e7f3 Renamed class 2015-10-22 18:48:15 +03:00
Valentin Kipyatkov
255373162d KT-9666 Inner classes do not appear in type completion
#KT-9666
2015-10-22 18:48:15 +03:00
Valentin Kipyatkov
375ecb4026 Refactored CompletionKind removing duplication with CallType 2015-10-22 18:48:14 +03:00
Valentin Kipyatkov
b4501a6b98 Fixed filtering of annotation classes in annotation completion broken recently 2015-10-22 18:48:14 +03:00
Michael Bogdanov
d5126213d3 Fix for KT-9364: M13 Wrong compiler error for "unable to inline function"
#KT-9364 Fixed
2015-10-22 17:20:57 +03:00
Michael Bogdanov
a7b3c70d21 Fix for KT-7017: Reified type referenced in object literal crashes at runtime
#KT-7017 Fixed
2015-10-22 16:06:13 +03:00
Michael Bogdanov
3e19514099 Test for obsolete KT-6988: java.lang.VerifyError: Bad return caused by inline reified
#KT-6988 Obsolete
2015-10-22 16:06:10 +03:00
Dmitry Petrov
1a58636ea9 KT-6165, KT-9547: fix testData for JPS plugin.
Test contains effectively single module (with circular dependencies),
and should not have conflicting declarations.
Rename the package in a library used in this test.

 #KT-9547 Fixed
2015-10-22 11:37:01 +03:00
Dmitry Petrov
829fc6938a KT-9547: private package member can conflict only with the members
declared in the same file.
Cleanup OverloadUtil stuff.
Update testData.
2015-10-22 10:45:49 +03:00
Dmitry Petrov
5170341624 OverloadResolver:
fix redeclaration diagnostics issue in incremental compilation (KT-6165)
J2K: OverloadUtil.kt
2015-10-22 10:45:49 +03:00
Dmitry Petrov
f3cc6fc170 J2K: rename OverloadUtil.java --> OverloadUtil.kt 2015-10-22 10:45:49 +03:00
Denis Zharkov
8c62e80d2b Minor. Use property instead of deprecated function in Operations map 2015-10-21 17:51:44 +03:00
Denis Zharkov
8db206e7ff Take into account irrelevant implementation of special builtins 2015-10-21 17:51:43 +03:00
Denis Zharkov
d674aa1427 Refine signature mapping for special overrrides from Java
They have special JVM descriptor only when they are not inherited from
Kotlin super class
2015-10-21 17:51:43 +03:00
Denis Zharkov
f3a652de2f Minor. Add assertion about same modality of accessors 2015-10-21 17:51:43 +03:00
Denis Zharkov
c46b766fea Load special property from Java in cases of J-K-J hierarchy 2015-10-21 17:51:43 +03:00
Denis Zharkov
e31f751830 Minor. Move hasRealKotlinSuperClassWithOverrideOf to descriptor.loader.java 2015-10-21 17:51:43 +03:00
Denis Zharkov
0b3118554b Extract hasRealKotlinSuperClassWithOverrideOf and simplify needGenerateSpecialBridge
Temporary don't mind that some element `reachableDeclarations` is
final in Java because it's anyway follows that function descriptor itself is final.
2015-10-21 17:51:43 +03:00
Michael Bogdanov
4dcf940756 Test for obsolete KT-4860
#KT-4860 Obsolete
2015-10-21 17:12:18 +03:00
Michael Bogdanov
55d2300860 Fix for KT-6722
#KT-6722 Fixed
2015-10-21 17:12:17 +03:00
Michael Bogdanov
f4d3ecf8e6 Generate public constructor for anonymous objects if it inside inline fun
#KT-9331 Fixed
2015-10-21 17:12:17 +03:00
Mikhail Glukhikh
3d56012184 Backing field access highlighting dropped 2015-10-21 16:37:12 +03:00
Mikhail Glukhikh
99943e3185 Backing field: three relevant quick-fixes dropped 2015-10-21 16:37:09 +03:00
Mikhail Glukhikh
03d944d2b3 Backing field: four more errors dropped 2015-10-21 16:37:06 +03:00
Mikhail Glukhikh
e8a5df364b Refactoring (JetFlowInformationProvider) 2015-10-21 16:37:04 +03:00
Mikhail Glukhikh
d6988ad69e Get rid of FIELD_IDENTIFIER at syntax level, two errors dropped, a set of tests fixed / deleted #KT-9539 Fixed 2015-10-21 16:36:55 +03:00
Mikhail Glukhikh
8ea0501a30 Get rid of FIELD_IDENTIFIER: stubs with '$' removed 2015-10-21 16:36:49 +03:00
Mikhail Glukhikh
ef23343844 Test regenerated 2015-10-21 16:36:46 +03:00
Nikolay Krasko
eb2feeeb16 Fixes after review in imports for additional expressions 2015-10-21 14:06:05 +03:00
Nikolay Krasko
2f26480e6b Auto-imports for index functions, += like operators, invoke, delegates and components
#KT-9482 Fixed
 #KT-9397 Fixed
 #KT-8060 Fixed
2015-10-21 14:06:04 +03:00
Nikolay Krasko
0f85d770dd Refactoring: continue extracting base class for auto-import fix 2015-10-21 14:06:03 +03:00
Nikolay Krasko
c84995f8dd Refactoring: prepare AutoImportFix for subclassing: count suggestions in virtual method. 2015-10-21 14:06:03 +03:00
Nikolay Krasko
a7519853cb Fixes after review in creating single action for fixing several problems 2015-10-21 14:06:02 +03:00
Nikolay Krasko
4bae99e8bd Allow to create single quickfix for several same-type diagnostics
This going to be used for multiple auto-import for components functions and get/set pair for delegated properties
2015-10-21 14:06:02 +03:00
Nikolay Krasko
43ae8bb1f3 Revert "Add script to do padding for teamcity version"
There is no need in verison padding now.

This reverts commit 8fce102212.
2015-10-21 14:06:01 +03:00
Nikolay Krasko
da2d3701f0 Updated test for new version format 2015-10-21 14:06:01 +03:00
Valentin Kipyatkov
36ea9cfbfc J2K: fixed conversion of Throwable.getMessage(), Throwable.getCause(), Map.Entry.getKey() and Map.Entry.getValue() 2015-10-21 13:46:57 +03:00
Alexander Udalov
8dde7497e0 Minor, drop outdated constructor from FunctionReference 2015-10-21 13:40:49 +03:00
Alexander Udalov
c204e8fc67 Add more intrinsic methods to be maybe used in the future 2015-10-21 13:40:48 +03:00
Alexander Udalov
a24ac86e1c Support exception messages for reified inline markers 2015-10-21 13:40:47 +03:00
Alexander Udalov
1f1b3660f7 Provide additional overloads of TypeIntrinsics methods for future use 2015-10-21 13:40:47 +03:00
Alexander Udalov
8f6f6f7807 Minor, simplify code in TypeIntrinsics 2015-10-21 13:40:46 +03:00
Alexander Udalov
121807654a Add generalized methods to InlineMarker
To be able to use them in the future compiler without breaking binary
compatibility
2015-10-21 13:40:45 +03:00
Alexander Udalov
3f9806d758 Add constructors with messages and causes to runtime exceptions 2015-10-21 13:40:44 +03:00
Alexander Udalov
1e9624901a Add NonVolatileRef to runtime 2015-10-21 13:40:02 +03:00
Michael Nedzelsky
f987feed6f fix compilation (KtType -> KotlinType) 2015-10-20 20:46:11 +03:00
Michael Nedzelsky
1c36090b6d check for violation of Finite Bound Restriction and Non-Expansive Inheritance Restriction 2015-10-20 20:06:07 +03:00
Denis Zharkov
1413cab1e6 Mixin kotlin.Number methods into j.l.Number member scope
#KT-9672 Fixed
2015-10-20 19:41:58 +03:00
Alexey Sedunov
b774373dbc Minor: Restore ant.xml deleted in a previous commit 2015-10-20 19:41:06 +03:00
Michael Bogdanov
926e3fd350 Test for obsolete KT-9560
#KT-9560 Obsolete
2015-10-20 19:19:43 +03:00
Michael Bogdanov
1d84103cce Test for obsolete KT-6453
#KT-6453 Obsolete
2015-10-20 19:19:43 +03:00
Michael Bogdanov
378233e1f5 Test for obsolete KT-8095
#KT-8095 Obsolete
2015-10-20 19:19:42 +03:00
Michael Bogdanov
32d51af5dd Test for obsolete KT-8094
#KT-8094 Obsolete
2015-10-20 19:19:42 +03:00
Michael Bogdanov
98b818203f Test data fixed 2015-10-20 19:19:41 +03:00
Michael Bogdanov
d977d29ec4 Support access to companion private members from nested classes
#KT-5363 Fixed
  #KT-6804 Fixed
2015-10-20 19:19:41 +03:00
Alexey Sedunov
3d88df73e0 Minor: Fix spelling of intention text
#KT-9639 Fixed
2015-10-20 18:39:48 +03:00
Alexey Sedunov
929d06c86f Create from Usage: Implement 'Create property as constructor parameter' quick-fix
#KT-8426 Fixed
2015-10-20 18:39:47 +03:00
Alexey Sedunov
bdd495460b Extraction Engine: Properly retrieve declaration for overriden/delegated Java synthetic properties
#KT-9554 Fixed
2015-10-20 18:39:43 +03:00
Alexey Sedunov
84aa4e7664 Create from Usage: Fix rendering of receiver type reference
#KT-9559 Fixed
2015-10-20 18:39:40 +03:00
Alexey Sedunov
c2c8eccc77 Pull Up: Do not suggest indirect superinterfaces in the Pull Up dialog. Prefer superclass over superinterface as pull-up target
#KT-9543 Fixed
2015-10-20 18:39:39 +03:00
Alexey Sedunov
93ab055d17 Change Signature: Do not fail on unresolved PsiMethod
#KT-9535 Fixed
2015-10-20 18:39:38 +03:00
Alexey Sedunov
21d27d9340 Change Signature: Show conflict dialog in silent mode 2015-10-20 18:39:36 +03:00
Ilya Gorbunov
9e8600e52f Cleanup in stdlib generators 2015-10-20 18:10:20 +03:00
Ilya Gorbunov
d3d239bc1b Add deprecated xxxValue() extensions to Number for migration. 2015-10-20 18:10:18 +03:00
Mikhail Glukhikh
c9d8a15965 Generate Tests target fixed (file facades) 2015-10-20 17:44:25 +03:00
Dmitry Jemerov
d6a3870101 rename Kt to Kotlin in KtType, KtIcons 2015-10-20 16:23:31 +02:00
Andrey Breslav
9d7a8e7696 Create empty sources JAR for kotlin-osgi-bundle 2015-10-20 16:32:42 +03:00
Ilya Gorbunov
a439cce7d1 Correct deprecation message for StringBuilder { }. 2015-10-20 16:31:32 +03:00
Michael Bogdanov
d054c6bf6a Stable element order in redeclaration diagnostic 2015-10-20 13:25:27 +03:00
Mikhail Glukhikh
4501836b33 Java 8 tests fixed (txt only) 2015-10-20 11:18:38 +03:00
Mikhail Glukhikh
3151d4ca9d Check of type parameter bounds consistency #KT-9438 Fixed 2015-10-20 11:02:19 +03:00
Valentin Kipyatkov
73176fae17 Property with all accessors deprecated considered as deprecated 2015-10-20 10:12:34 +03:00
Valentin Kipyatkov
8e6b0a26bb Synthetic extensions to take all annotations from original declarations
#KT-9387 Fixed
2015-10-20 10:12:34 +03:00
Ilya Gorbunov
a0ccd36377 Fix legacy package facade name usage. 2015-10-20 04:37:19 +03:00
Ilya Gorbunov
8635eaae69 Alter regex in verify script for versions like 1.0.0-beta+1005 2015-10-20 04:37:05 +03:00
Nikolay Krasko
07f7f95fed Update pattern for bootstrap download 2015-10-20 04:14:57 +03:00
Nikolay Krasko
f3b5c7f36c Escape version pattern 2015-10-20 03:06:51 +03:00
Ilya Gorbunov
059bddf31c ReplaceWith for File.recurse 2015-10-20 02:32:08 +03:00
Ilya Gorbunov
6ac28facf1 Fix deprecations in tests 2015-10-20 02:31:51 +03:00
Ilya Gorbunov
fc7c008672 Provide deprecated unconstrained contains, indexOf, lastIndexOf methods for migration. 2015-10-20 02:31:18 +03:00
Ilya Gorbunov
95aac7ade6 Generate contains, indexOf, lastIndexOf with @NoInfer 2015-10-20 02:30:54 +03:00
Dmitry Jemerov
69a924a3ab fix main class name for builtin serializer 2015-10-20 00:49:03 +02:00
Ilya Gorbunov
100cba7d4f Fix legacy package facade names in maven plugin tests. 2015-10-19 23:04:02 +03:00
Ilya Gorbunov
59cd1cd14a Restore referential equality for AnnotatedClassDescriptor and AnnotatedConstructorDescriptor. 2015-10-19 23:03:59 +03:00
Svetlana Isakova
abf4030ef9 Don't exclude internal type annotations from decompiler renderers 2015-10-19 23:02:03 +03:00
Svetlana Isakova
667f6269e4 Filter internal annotations for resolve in type substitutor
to avoid having List<@NoInfer Int> as a result type
of function invocation (the function returns List<@NoInfer T>)
2015-10-19 23:02:03 +03:00
Andrey Breslav
fe057f781c Compilation fixed 2015-10-19 22:56:41 +03:00
Andrey Breslav
18524ea8ec Proper semantics for former data classes 2015-10-19 22:42:33 +03:00
Dmitry Jemerov
49033e0002 rename Jet* classes to Kt* 2015-10-19 21:35:30 +02:00
Dmitry Jemerov
660972b12d Merge remote-tracking branch 'origin/master' 2015-10-19 21:34:53 +02:00
Alexander Udalov
1c280c96b6 Set binary version to 1.0.0 2015-10-19 22:12:39 +03:00
Dmitry Jemerov
0dcd45daf0 Merge remote-tracking branch 'origin/master' 2015-10-19 21:01:38 +02:00
Svetlana Isakova
452637a946 Changed retention to 'binary' for annotations
used in resolve
2015-10-19 21:35:58 +03:00
Svetlana Isakova
6ced795db6 Fixed the problem with 'OnlyInputTypes' annotation 2015-10-19 21:35:57 +03:00
Alexey Tsvetkov
3476bed18a Drop @native from stdlib 2015-10-19 21:32:24 +03:00
Max Kammerer
715893446c Incremental compilation test data update after making package property backing field private 2015-10-19 21:21:02 +03:00
Nikolay Krasko
4c8384240b Check version in new format 2015-10-19 20:57:03 +03:00
Nikolay Krasko
8fce102212 Add script to do padding for teamcity version 2015-10-19 20:57:02 +03:00
Nikolay Krasko
4a9cd95d1d Update to 143.249.6 2015-10-19 20:57:01 +03:00
Alexey Tsvetkov
a1d4d099ba Increment jvm abi and stub versions 2015-10-19 20:45:03 +03:00
Alexey Tsvetkov
e9e42b0251 Code cleanup 2015-10-19 20:45:03 +03:00
Alexey Tsvetkov
6f96484e1f Fix tests 2015-10-19 20:45:03 +03:00
Alexey Tsvetkov
5c23820605 Fix load builtins test 2015-10-19 20:45:02 +03:00
Alexey Tsvetkov
3cd85a25e4 Generate ACC_NATIVE for external 2015-10-19 20:45:02 +03:00
Alexey Tsvetkov
5e90bafe18 Build stubs for modifiers 2015-10-19 20:45:02 +03:00
Alexey Tsvetkov
c459e78a7d Prohibit inline modifier on property, getter or setter 2015-10-19 20:45:02 +03:00
Alexey Tsvetkov
7a1b6ed13f Fix supressing no body errors for external functions 2015-10-19 20:45:02 +03:00
Alexey Tsvetkov
1e2256207c Update test data 2015-10-19 20:45:02 +03:00
Alexey Tsvetkov
d86121863a Render external, inline, tailrec, crossinline, noinline modifiers 2015-10-19 20:45:02 +03:00
Alexey Tsvetkov
d87ce33458 Drop @inline from tests and incremental compilation 2015-10-19 20:45:01 +03:00
Alexey Tsvetkov
df8066b1e4 Drop annotations from stdlib and compiler 2015-10-19 20:45:01 +03:00
Alexey Tsvetkov
c50aab6a75 Add modifier flags to descriptors 2015-10-19 20:45:01 +03:00
Alexey Tsvetkov
ea40f8af92 Serialize flags 2015-10-19 20:45:01 +03:00
Alexey Tsvetkov
8d22aabd9f Add flags 2015-10-19 20:45:01 +03:00
Alexey Tsvetkov
dc27363452 Remove @annotation from test data 2015-10-19 20:45:01 +03:00
Alexey Tsvetkov
ae17c06f7a Render ANNOTATION_CLASS kind correctly 2015-10-19 20:45:00 +03:00
Alexey Tsvetkov
f2c69e56d2 Remove @annotation from stdlib and compiler 2015-10-19 20:45:00 +03:00
Alexey Tsvetkov
28ca2e8b84 Build stubs for data modifier 2015-10-19 20:45:00 +03:00
Alexey Tsvetkov
1973573a89 Remove @data from test data 2015-10-19 20:45:00 +03:00
Alexey Tsvetkov
106e2667d4 Render data modifier 2015-10-19 20:45:00 +03:00
Alexey Tsvetkov
ec57d3f144 Remove @data from stdlib and compiler 2015-10-19 20:45:00 +03:00
Alexey Tsvetkov
264bd5235b Add isData() to ClassDescriptor 2015-10-19 20:45:00 +03:00
Alexey Tsvetkov
1414fe1699 Add IS_DATA flag 2015-10-19 20:44:59 +03:00
Dmitry Jemerov
ac55c9134c don't abort refactoring in case of exceptions in AutomaticVariableRenamer 2015-10-19 18:57:14 +02:00
Valentin Kipyatkov
30cbec3fc8 Refactoring 2015-10-19 19:22:26 +03:00
Valentin Kipyatkov
28c950ffbe Better replacement for annotations with parameters in ReplaceWIth pattern but still lot of safety pre-checks to be added 2015-10-19 19:22:26 +03:00
Valentin Kipyatkov
4290601807 VERY rough implementation of annotations with parameters in ReplaceWIth pattern 2015-10-19 19:22:26 +03:00
Michael Bogdanov
c8c3e88c82 Make top-level property backing field private in bytecode 2015-10-19 19:09:30 +03:00
Ilya Chernikov
376c188cf7 Setting property that controls application environment lifetime for daemon builds 2015-10-19 18:01:45 +02:00
Ilya Chernikov
25a128a8c6 Removing environment reuse diagnostics, because it breaks many tests
(cherry picked from commit 857488f)
2015-10-19 18:01:44 +02:00
Dmitry Jemerov
56735b3302 system property to keep application environment alive across multiple compilations
(cherry picked from commit a6b269c)
2015-10-19 18:01:43 +02:00
Natalia Ukhorskaya
f9399f0510 Skip MultiFileFacade classes as synthethic 2015-10-19 18:57:41 +03:00
Natalia Ukhorskaya
556e08b9eb Fix exception during Step Over 2015-10-19 18:57:40 +03:00
Valentin Kipyatkov
3a9beb719f Better test 2015-10-19 18:40:15 +03:00
Valentin Kipyatkov
a8d9c761c8 Correct detection of non-qualified references in ReplaceWith analyzer 2015-10-19 18:40:15 +03:00
Valentin Kipyatkov
7eaf00a34d Additional check to not corrupt PSI tree 2015-10-19 18:40:15 +03:00
Valentin Kipyatkov
66ea544a48 Fixed incorrect handling of this and super expressions in copy/paste processing and optimize imports 2015-10-19 18:40:15 +03:00
Valentin Kipyatkov
33d206ab22 Changed UI layout 2015-10-19 18:40:15 +03:00
Valentin Kipyatkov
872af51c99 Better wording in import settings UI 2015-10-19 18:40:14 +03:00
Valentin Kipyatkov
115d7a2eae Code style setting for importing Java statics and enums with '*'
#KT-9592 Fixed
2015-10-19 18:40:14 +03:00
Valentin Kipyatkov
27228c2fcc KT-9638 Optimize imports: don't create import for static methods from superclasses
#KT-9638 Fixed
2015-10-19 18:40:14 +03:00
Valentin Kipyatkov
edd2d853b1 KT-8961 Optimize Imports adds useless import for static Java method reference
#KT-8961 Fixed
2015-10-19 18:40:14 +03:00
Valentin Kipyatkov
b62260180f Changed semantics of ImportInsertHelper.importDescriptor() - it does not check if we allowed to import it on reference shortening 2015-10-19 18:40:14 +03:00
Valentin Kipyatkov
1730069d5e Corrected implementation of DeclarationDescriptor.canBeReferencedViaImport() to include object members 2015-10-19 18:40:13 +03:00
Nikolay Krasko
4a0eb3836f Diagnostic for EA-70732 (another try) 2015-10-19 18:38:46 +03:00
Valentin Kipyatkov
0cfccdefe4 "enum class" and "annotation class" are completed as single keywords 2015-10-19 18:36:06 +03:00
Valentin Kipyatkov
fa14b18f7f KT-8624 Don't complete "dynamic" keyword when targeting JVM
#KT-8624 Fixed
2015-10-19 18:36:06 +03:00
Valentin Kipyatkov
0a5255ee4e Dropped inspection for functions matching operator convention - only intention left 2015-10-19 18:36:06 +03:00
Mikhail Glukhikh
ff60a13228 libraries/tools fix (data classes migration) 2015-10-19 18:17:22 +03:00
Pavel V. Talanov
85c05b18f5 More compact and meaningful error reporting in ResolverForProject
No more enormous module lists
2015-10-19 18:03:08 +03:00
Pavel V. Talanov
668b36f684 Minor: meaningful message on failure to find nested class data when building cls stubs 2015-10-19 18:02:13 +03:00
Dmitry Petrov
dda508234f Drop package facades:
- update tests
- cleanup JetTyMapper after rebase
2015-10-19 16:03:22 +03:00
Dmitry Petrov
639300a89d Drop package facades: fix testData for IncrementalProjectPathCaseChangedTest 2015-10-19 16:03:21 +03:00
Dmitry Petrov
ac1f0efe7c Drop package facades: fix testData for IncrementalLazyCachesTestGenerated 2015-10-19 16:03:21 +03:00
Dmitry Petrov
621d26aeeb Drop package facades: fix incremental compilation tests & proto comparison tests
(package facades are no longer generated)
2015-10-19 16:03:21 +03:00
Pavel V. Talanov
300aeb83b0 Fix test data for j2k conversion
(cherry picked from commit e3bac5e)
2015-10-19 16:03:21 +03:00
Pavel V. Talanov
4f5f5fc3b9 Fix test data for completion in java of source/compiled kotlin
(cherry picked from commit 83f2625)
2015-10-19 16:03:21 +03:00
Dmitry Petrov
f227908151 Drop package facades:
- update incremental compilation tests
2015-10-19 16:03:21 +03:00
Dmitry Petrov
70c91b2e75 Drop package facades:
- getting rid of package facades in InlineCodegen & related stuff.
Provide binary source element to top-level package members.
2015-10-19 16:03:20 +03:00
Dmitry Petrov
989f761166 Drop package facades:
- fix KotlinJpsBuildTest
2015-10-19 16:03:20 +03:00
Dmitry Petrov
c55106a325 Drop package facades:
- incremental cache impl should not depend on package facades
- fix trivial incremental compilation tests
TODO: inlines DO NOT WORK with incremental compilation
2015-10-19 16:03:20 +03:00
Dmitry Petrov
8c64279419 Drop package facades: fix testData in duplicate JVM signature test
(declaration origins are now ordered alphabetically)
2015-10-19 16:03:20 +03:00
Dmitry Petrov
a76fb328cb Dropping package facades:
- fix testData for 'move' tests
(NB regression in **/onDemandStaticImport.java, see: https://youtrack.jetbrains.com/issue/KT-9624)
2015-10-19 16:03:20 +03:00
Dmitry Petrov
31a85132c6 Dropping package facades:
- use KotlinCodegenFacade to build light classes
(PackageCodegen is not enough to obtain proper diagnostics)
2015-10-19 16:03:19 +03:00
Dmitry Petrov
9de45f4c56 Dropping package facades:
- add @Deprecated kotlin.internal.InternalPackage to runtime
(for compatibility with older Kotlin code)
2015-10-19 16:03:19 +03:00
Dmitry Petrov
8ab55813fe Dropping package facades:
- clashing JVM signature diagnostics should be reported in stable order
- drop tests for clashes vs package facades
- introduce box test for class named as old package facade
- fix some testData
2015-10-19 16:03:19 +03:00
Dmitry Petrov
014bcfeb15 Dropping package facades: JetPositionManager should use file class 2015-10-19 16:03:19 +03:00
Dmitry Petrov
6b2b64e438 Drop package facades: fix evaluation tests 2015-10-19 16:03:19 +03:00
Dmitry Petrov
dc399ac46b Drop package facades: get rid of isPackageClassFqName 2015-10-19 16:03:18 +03:00
Pavel V. Talanov
12d5aca9d6 Fix test data for safe delete test
(cherry picked from commit 25f363d)
2015-10-19 16:03:18 +03:00
Pavel V. Talanov
50ff146865 Fix test data for reference resolve in java test
(cherry picked from commit fcfe51a)
2015-10-19 16:03:18 +03:00
Pavel V. Talanov
ba84214bd0 Fix test data for rename test
(cherry picked from commit aee4f25)
2015-10-19 16:03:18 +03:00
Pavel V. Talanov
e578caaed2 Fix test data for move test
Tests do not pass after this change
(cherry picked from commit d4437d7)
2015-10-19 16:03:18 +03:00
Pavel V. Talanov
2e1967eb84 Fix test data for change signature test
(cherry picked from commit 8d420f1)
2015-10-19 16:03:18 +03:00
Pavel V. Talanov
fd893ba499 Fix test data for reconcile package with directory test
(cherry picked from commit b926e02)
2015-10-19 16:03:17 +03:00
Pavel V. Talanov
abca7107a7 Fix test data for convert function/property to property/function test
(cherry picked from commit e78c26a)
2015-10-19 16:03:17 +03:00
Pavel V. Talanov
c2bc1280d3 Fix test data for call hierarchy test
(cherry picked from commit 0145cc4)
2015-10-19 16:03:17 +03:00
Pavel V. Talanov
5cf1417511 Fix test data for quick doc test
(cherry picked from commit 57589e3)
2015-10-19 16:03:17 +03:00
Pavel V. Talanov
9b7f22d2c7 Fix ClsStubConsistencyTest: it didn't do anything after some previous changes
(cherry picked from commit f5af9fc)
2015-10-19 16:03:17 +03:00
Pavel V. Talanov
bb77890a4e Drop DeprecatedFacadeUsageInspection
(cherry picked from commit f18b95d)
2015-10-19 16:03:17 +03:00
Pavel V. Talanov
93bb010875 Drop decompiledText/clsStub tests for package facades
(cherry picked from commit fbaa81c)
2015-10-19 16:03:16 +03:00
Pavel V. Talanov
3a34dc0efe minor: fixes in test data
(cherry picked from commit 6ea4fbd)
2015-10-19 16:03:16 +03:00
Dmitry Petrov
d19ce49606 Dropping package facades:
- do not depend on package facade in LazyJavaPackageFragment
2015-10-19 16:03:16 +03:00
Dmitry Petrov
149e70aa07 Dropping package facades:
- light classes: do not generate light class for package facade
- drop package facades as multifile classes compilation mode support
- get rid of some additional package facade fqName usages
- update tests for light classes
2015-10-19 16:03:16 +03:00
Dmitry Petrov
e7fb7483c5 Drop package facades: update compiler tests. 2015-10-19 16:03:16 +03:00
Dmitry Petrov
3502c393fc Drop package facades: JVM BE tests passed. 2015-10-19 16:03:16 +03:00
Ilya Gorbunov
a59cb22bc6 Update testdata for LoadBuiltinsTest 2015-10-19 15:37:44 +03:00
Ilya Gorbunov
078d904d41 Deprecated ranges: relax errors to warnings. 2015-10-19 15:37:42 +03:00
Ilya Gorbunov
69dc6701cc Deprecate Double, Float and Comparable range implementations. 2015-10-19 15:37:41 +03:00
Pavel V. Talanov
aeb4abe39d Fix decompiled text for named companion object
Fix stub/ast mismatch for compiled named companion objects
Add tests
2015-10-19 15:27:49 +03:00
Pavel V. Talanov
d74a989d93 Tweak light classes to avoid computing stubs on certain api calls
Should speed up completion from java for certain cases
2015-10-19 15:27:48 +03:00
Mikhail Glukhikh
8d88109c00 Underscore names are now forbidden 2015-10-19 15:24:45 +03:00
Mikhail Glukhikh
f61aa18a05 Code cleanup: get rid of _ (mostly renamed to arg) 2015-10-19 15:24:42 +03:00
Mikhail Glukhikh
059175560c No __ as lambda parameter 2015-10-19 15:24:39 +03:00
Mikhail Glukhikh
14e38ff6d4 data deprecations cleanup: reserved word tests fixed 2015-10-19 15:24:36 +03:00
Mikhail Glukhikh
a4af6a3076 data deprecations (empty constructors, non val/var arguments, vararg, superclasses) are now errors, relevant tests fixed 2015-10-19 15:24:28 +03:00
Mikhail Glukhikh
cae0388a57 Code cleanup: data deprecations and some effective visibility stuff 2015-10-19 15:24:22 +03:00
Alexander Udalov
a501878d60 Workaround circular dependency of KProperty1 and KClassImpl
This appeared after introduction of KProperty in delegated property convention
methods. If a KProperty1 instance is created while constructing a KClassImpl
instance before assigning the 'jClass' field, an NPE is thrown because the
constructor of that KProperty1 instance tries to lookup the declaring class of
the property, which in some case happens to be the exact KClassImpl we're
constructing. No test added because I was not able to reproduce the behavior in
an isolated environment
2015-10-19 15:20:20 +03:00
Valentin Kipyatkov
d0f318d7db Fixed bug in completion with double insertion of "::class.java" 2015-10-19 15:10:21 +03:00
Svetlana Isakova
499ca02615 Changed retention to 'binary' for LowPriorityInOverloadResolution 2015-10-19 14:58:02 +03:00
Ilya Chernikov
ab3cfc3454 Adding property to enforce daemon shutdown, dropping unnecessary inheritance of the CompilerServiceImpl from UnicastRemoteObject, because manual control is used
(cherry picked from commit 182a231)
(cherry picked from commit eecd953)
2015-10-19 13:32:20 +02:00
Ilya Chernikov
16817f47e9 Removing dependency of kotlin plugin from daemon client (kotlinr), it should only depend on rmi-interface
(cherry picked from commit 01309eb)
(cherry picked from commit ed91190)
(cherry picked from commit da54faf)
2015-10-19 13:32:19 +02:00
Svetlana Isakova
514a1dea57 Changed test for 'LowPriorityInOverloadResolution' annotation 2015-10-19 14:15:06 +03:00
Svetlana Isakova
cb34498278 Check nullability in initial constraints
except constraints for receiver type (it can be accessed via safe call)
2015-10-19 14:15:06 +03:00
Svetlana Isakova
bb9f7094e0 Report 'TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH'
on call element, not on callee expression
2015-10-19 14:15:05 +03:00
Svetlana Isakova
4c85b69c88 Report type inference error
when inference failed with 'NoInfer' annotation
2015-10-19 14:15:05 +03:00
Zalim Bashorov
5ab3dd1716 Minor: do simpler check first 2015-10-19 14:01:59 +03:00
Yan Zhulanow
b2470a6aad Report warning on unary plus()/minus() 2015-10-19 11:51:54 +03:00
Nikolay Krasko
58cbf09232 Refactoring: collect all annotation presentation data in one place 2015-10-19 11:30:50 +03:00
Nikolay Krasko
4adcf3f114 Refactoring: return not-null from doCreateActions() 2015-10-19 11:30:49 +03:00
Nikolay Krasko
9ef8370871 Allow to create quickfix multifile tests in single file
It simplifies creating new tests
2015-10-19 11:30:47 +03:00
Nikolay Krasko
573738c87e Refactoring: extract name highlighting to separate class 2015-10-19 11:30:44 +03:00
Valentin Kipyatkov
734d3f4fca Removed test which did not work by some reason 2015-10-19 09:43:13 +03:00
Valentin Kipyatkov
963a8992b1 Fixed availability of "Make abstract" and "Implement members" quickfixes 2015-10-19 09:43:13 +03:00
Valentin Kipyatkov
fc10fa66be J2K does not convert usages of java "get" methods into "[]" (explicit "operator" modifier is required) 2015-10-19 09:43:13 +03:00
Valentin Kipyatkov
e7fa2cb776 Replace with explicit "get" inspection enabled by default but is reported only for functions explicitly marked with "operator" 2015-10-19 09:43:13 +03:00
Valentin Kipyatkov
e3ff464109 Minor 2015-10-19 09:43:13 +03:00
Valentin Kipyatkov
55575b7f10 J2K adds "operator" modifier to methods that look like operator on conversion 2015-10-19 09:43:12 +03:00
Valentin Kipyatkov
563ad4bab2 Added test 2015-10-19 09:43:12 +03:00
Valentin Kipyatkov
5ce0ed37b1 Moved file to another package 2015-10-19 09:43:12 +03:00
Valentin Kipyatkov
d1de2f65c9 Rewritten AddOperatorModifierInspection to be based on an intention (shouldn't we drop the inspection at all?) 2015-10-19 09:43:12 +03:00
Valentin Kipyatkov
df9ad17ea2 Moved&renamed class 2015-10-19 09:43:12 +03:00
Valentin Kipyatkov
627b31f2f7 Minor 2015-10-19 09:43:12 +03:00
Valentin Kipyatkov
f89d41dcda OperatorModifierInspection: reused code from OperatorChecks 2015-10-19 09:43:11 +03:00
Valentin Kipyatkov
4e73fe0f39 Renamed test data folder 2015-10-19 09:43:11 +03:00
Valentin Kipyatkov
dc909ac166 J2K: coversion of specially mapped built-in methods + replacing "get" with "[]" where possible 2015-10-19 09:43:11 +03:00
Valentin Kipyatkov
50f559a1c8 ReplaceGetIntention should not be available for non-operator functions 2015-10-19 09:43:11 +03:00
Valentin Kipyatkov
45389c61b4 Made AddFunctionToSupertypeFix low priority 2015-10-19 09:43:11 +03:00
Valentin Kipyatkov
5e7fd78028 Don't cause tests to hang because of UnsupportedAbiVersion notification 2015-10-19 09:43:10 +03:00
Valentin Kipyatkov
e42bb1698d MoveAssignmentToInitializerIntention to select property type when it can be removed 2015-10-19 09:43:10 +03:00
Valentin Kipyatkov
fc89b1e766 ShortenReferences to use partial body resolve 2015-10-19 09:43:10 +03:00
Yan Zhulanow
3a89c2194a Fix Java 8 tests (annotation methods are not loaded as functions anymore) 2015-10-19 03:56:15 +03:00
Yan Zhulanow
e14c9645dc Error on 'if' without an 'else' branch when used as an expression 2015-10-19 03:56:15 +03:00
Zalim Bashorov
de5dc61820 Make NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION error 2015-10-18 22:49:08 +03:00
Michael Bogdanov
a16658a9e9 Temporary workaround for convention method invocation 2015-10-18 17:53:29 +03:00
Michael Bogdanov
01864801f3 Stable accessors names 2015-10-18 17:53:29 +03:00
Michael Bogdanov
7851abd535 Generate access to private members through synthetic accessors in inline functions 2015-10-18 17:53:28 +03:00
Michael Bogdanov
3b02498ca8 Tests for private members and accessors for them 2015-10-18 17:53:28 +03:00
Michael Bogdanov
8641dbf42a Fix couldUseDirectAccessToProperty for private top-level properties 2015-10-18 17:53:27 +03:00
Michael Bogdanov
e2eddac27d Workaround for KT-9603 2015-10-18 17:53:27 +03:00
Michael Bogdanov
7022d84ec1 Use package part context for class generation 2015-10-18 17:53:27 +03:00
Michael Bogdanov
3e64baad78 Support multifile facades in isCallInsideSameClassAsDeclared 2015-10-18 17:53:26 +03:00
Michael Bogdanov
c63d221da3 Skip private members in facades 2015-10-18 17:53:26 +03:00
Michael Bogdanov
5b3a7a473e Private visibility for top-level private members 2015-10-18 15:53:48 +03:00
Ilya Gorbunov
10784644a5 Throwable stackTrace property instead of getStackTrace() function. 2015-10-17 23:43:20 +03:00
Svetlana Isakova
7208efc784 Fix tests with type annotations 2015-10-17 19:07:25 +03:00
Denis Zharkov
fafca76ac5 Generate common bridges for final builtin declaration
#KT-9596 Fixed
2015-10-17 17:46:17 +03:00
Denis Zharkov
cc94acdabc Do not load common for special properties from Java
I.e. do not treat getName in Java enum as override of Enum.name
2015-10-17 17:46:17 +03:00
Denis Zharkov
28c46b73f1 Rename some of builtin parameters 2015-10-17 17:46:16 +03:00
Denis Zharkov
1c02231cda Regenerate rendered descriptors after transforming Enum.values to property 2015-10-17 17:46:16 +03:00
Denis Zharkov
d8ede6d03e Transform Enum.values to property 2015-10-17 17:46:16 +03:00
Mikhael Bogdanov
d985f56b8d Fix local variable shift for inline functions 2015-10-17 17:02:56 +03:00
Natalia Ukhorskaya
9168572b8c Write local variable for inline function and inline argument 2015-10-17 17:02:55 +03:00
Michael Bogdanov
3452fc8d02 Don't initialize const properties in constructor
#KT-9532 Fixed
2015-10-17 15:31:57 +03:00
Stanislav Erokhin
7d7d37719b Forbidden old invokeExtension convention. 2015-10-17 14:45:53 +03:00
Alexey Sedunov
fc4b0a8121 Minor: Rename test class 2015-10-17 00:24:40 +03:00
Alexey Sedunov
6f5d977728 Inspections: Add inspection on equals()/hashCode() 2015-10-17 00:24:39 +03:00
Alexey Sedunov
127cb36602 Minor: Allow running member generation actions without editor 2015-10-17 00:24:38 +03:00
Alexey Sedunov
915236a6ba Code Insight: "Generate equals/hashCode" action 2015-10-17 00:24:37 +03:00
Ilya Gorbunov
d1d0807229 Add a note about *Raw functions behavior. 2015-10-16 23:55:37 +03:00
Ilya Gorbunov
8fd5677fe0 Move map-related *Raw methods to Maps.kt and do some cleanup there.
Correct deprecation messages and replacements.
2015-10-16 23:38:40 +03:00
Ilya Gorbunov
e2cf8a919c Fix contains usages in stdlib tests 2015-10-16 23:38:30 +03:00
Ilya Gorbunov
683bc4bd01 Generate *Raw methods. 2015-10-16 23:38:29 +03:00
Ilya Gorbunov
8aed39d9bb Provide *Raw methods as a replacement. 2015-10-16 23:38:27 +03:00
Ilya Gorbunov
d1a007e902 Do not generate deprecated contains for ranges. 2015-10-16 23:38:25 +03:00
Ilya Gorbunov
c5cd599e30 Delegate indexOf and lastIndexOf to List if the Iterable is List. 2015-10-16 23:38:23 +03:00
Ilya Gorbunov
45d13fafc8 StdLib generator: Allow receiver star-projections to be specified per-family. 2015-10-16 23:38:22 +03:00
Ilya Gorbunov
efa285bc30 ExpressionDecomposer: non-nullable upper bound of R, since supertype expects R to be non-null. 2015-10-16 23:38:20 +03:00
Ilya Gorbunov
654a85368d Allow to evaluate FamilyProperty based on family value specified. 2015-10-16 23:38:18 +03:00
Yan Zhulanow
3bb1b1adfd Put property delegates -related warnings on 'by' 2015-10-16 22:20:06 +03:00
Yan Zhulanow
b42d913bd7 Unify 'lateinit' diagnostics 2015-10-16 22:19:33 +03:00
Yan Zhulanow
9699708fb8 Do not put inapplicable annotations on getter 2015-10-16 22:19:33 +03:00
Yan Zhulanow
9ae3b0fa9c Drop loading Java annotation methods as functions 2015-10-16 22:13:34 +03:00
Svetlana Isakova
25b40455ad Serialize/deserialize annotations on type parameters 2015-10-16 21:58:47 +03:00
Svetlana Isakova
b7e2604bf2 Rename DeserializedTypeParameterDescriptor .java -> .kt 2015-10-16 21:58:47 +03:00
Svetlana Isakova
ded62686a0 Added 'LowPriorityInOverloadResolution' annotation 2015-10-16 21:58:46 +03:00
Svetlana Isakova
1cfb7d8f57 Changed constraint system tests
after adding new error 'hasTypeParameterWithUnsatisfiedOnlyInputTypesError'
2015-10-16 21:58:46 +03:00
Svetlana Isakova
a6ec5cecc0 Added 'OnlyInputTypes' annotation 2015-10-16 21:58:46 +03:00
Svetlana Isakova
082469aee4 Resolve annotations on type parameters of functions and properties 2015-10-16 21:58:45 +03:00
Svetlana Isakova
9b440345a1 Do not render @NoInfer, @Exact annotations
For now they are always not rendered,
but later they should be rendered in descriptors, but omitted in error messages
2015-10-16 21:58:45 +03:00
Svetlana Isakova
566e27788f Moved @NoInfer, @Exact to internal package 2015-10-16 21:58:44 +03:00
Svetlana Isakova
b401d46ae4 Check annotations on type arguments 2015-10-16 21:58:44 +03:00
Svetlana Isakova
6c4771147a Added more tests on annotations for nullable types 2015-10-16 21:58:43 +03:00
Yan Zhulanow
8a5c59e6b7 Inline static fields from Java 2015-10-16 21:36:33 +03:00
Denis Zharkov
7cbab5816c Fix lost testData 2015-10-16 21:11:05 +03:00
Mikhail Glukhikh
4b35e3b135 Preliminary declaration visitor for estimating local variable's predictability for smart casts
Predictability estimation algorithm is completely new, but backward compatibility should present.
A large set of tests. Some updated tests.
Smart casts allowed for captured variables if they are not modified in closure #KT-9051 Fixed
Also #KT-8643 Fixed
Also #KT-7976 Fixed
Correct handling of lambda arguments in functions #KT-9143 Fixed
2015-10-16 20:47:47 +03:00
Stanislav Erokhin
de7d2978db Fix assertEquals usage in kotlin code after adding statics to scope. 2015-10-16 20:42:35 +03:00
Stanislav Erokhin
d5dbc9638d Added static methods, nested classes and companion object from superclasses. 2015-10-16 20:42:34 +03:00
Stanislav Erokhin
ace99f6c3f Don't use ForceResolveUtil.forceResolveAllContents in TypeResolver in order to avoid problems with cyclic hierarchy. 2015-10-16 20:42:33 +03:00
Ilya Gorbunov
e24af934dc Use the same implementation in Array.toArrayList as in arrayListOf. 2015-10-16 19:20:26 +03:00
Valentin Kipyatkov
55122cda9e Minor changes on code review 2015-10-16 19:06:35 +03:00
Valentin Kipyatkov
6cf7d92565 Checking that no quickfixes hold references to DeclarationDescriptor's 2015-10-16 19:06:35 +03:00
Valentin Kipyatkov
a6c4d29640 More correct 2015-10-16 19:06:34 +03:00
Valentin Kipyatkov
6dbfe11afc Dropped inheritance from HintAction when not needed, dropped JetHintAction 2015-10-16 19:06:34 +03:00
Valentin Kipyatkov
9c6e0293ed No i18n 2015-10-16 19:06:34 +03:00
Valentin Kipyatkov
8cc3763465 Inlined JetAddFunctionToClassifierAction class into AddFunctionToSupertypeFix 2015-10-16 19:06:34 +03:00
Valentin Kipyatkov
ff13bcce1f Code simplifications 2015-10-16 19:06:34 +03:00
Valentin Kipyatkov
1a13ec0b00 Converted to Kotlin 2015-10-16 19:06:34 +03:00
Valentin Kipyatkov
41775bf8a0 Code refactoring 2015-10-16 19:06:34 +03:00
Valentin Kipyatkov
7c4e9f1caf ChangeMemberFunctionSignatureFix to not hold DeclarationDescriptor's 2015-10-16 19:06:33 +03:00
Valentin Kipyatkov
8dcc0096a8 Code simplifications + no i18n 2015-10-16 19:06:33 +03:00
Valentin Kipyatkov
cd6450e1a1 Converted to Kotlin 2015-10-16 19:06:33 +03:00
Valentin Kipyatkov
714e97751d Not holding descriptor in SuperClassNotInitialized.AddParametersFix 2015-10-16 19:06:33 +03:00
Valentin Kipyatkov
412f4a30c4 Correctness check for wrapper action's priority 2015-10-16 19:06:33 +03:00
Valentin Kipyatkov
670b278891 MapPlatformClassToKotlinFix to not hold descriptors directly 2015-10-16 19:06:33 +03:00
Valentin Kipyatkov
9bb159d4bc Code simplifications 2015-10-16 19:06:32 +03:00
Valentin Kipyatkov
78ac41a676 Converted to Kotlin + no i18n 2015-10-16 19:06:32 +03:00
Valentin Kipyatkov
17123a3cf2 Renames 2015-10-16 19:06:32 +03:00
Valentin Kipyatkov
c849c029cc More refactoring 2015-10-16 19:06:32 +03:00
Valentin Kipyatkov
4cf440b801 Refactoring 2015-10-16 19:06:32 +03:00
Valentin Kipyatkov
f311d9febf Refactored change signature fixes to not hold DeclarationDescriptor's 2015-10-16 19:06:31 +03:00
Valentin Kipyatkov
b2a04a7b04 Code refactorings in QuickFixWithDelegateFactory 2015-10-16 19:06:31 +03:00
Valentin Kipyatkov
de52cae7be Moved and renamed CreateFromUsageFactory 2015-10-16 19:06:31 +03:00
Valentin Kipyatkov
79375fa5e1 No i18n 2015-10-16 19:06:31 +03:00
Valentin Kipyatkov
0542ef30e3 Converted to Kotlin 2015-10-16 19:06:31 +03:00
Valentin Kipyatkov
5d1d44dfd3 More correct way to map arguments to parameters 2015-10-16 19:06:31 +03:00
Valentin Kipyatkov
4df9a46b00 Moved method 2015-10-16 19:06:30 +03:00
Valentin Kipyatkov
bce9f26327 Code improvements 2015-10-16 19:06:30 +03:00
Valentin Kipyatkov
f67e05de72 No i18n 2015-10-16 19:06:30 +03:00
Valentin Kipyatkov
4816003efd Refactoring to not pass BindingContext 2015-10-16 19:06:30 +03:00
Valentin Kipyatkov
c79d93b46c Converted to Kotlin 2015-10-16 19:06:30 +03:00
Valentin Kipyatkov
23025b072e Renamed JetIntentionAction to KotlinQuickFixAction 2015-10-16 19:06:29 +03:00
Valentin Kipyatkov
ab87471177 Converted JetIntentionAction to Kotlin 2015-10-16 19:06:29 +03:00
Valentin Kipyatkov
800e629614 Changed code style settings to place 'else' on new line 2015-10-16 19:06:18 +03:00
Ilya Gorbunov
59f88cfb52 Ensure vararg copy behavior for specific case of arrayListOf in JS. 2015-10-16 18:43:41 +03:00
Ilya Gorbunov
446cdc087d Optimizations in listOf and arrayListOf constructor functions.
Remove linkedListOf() from JS.
#KT-5703 Fixed
#KT-8519 Fixed
2015-10-16 18:28:43 +03:00
Denis Zharkov
032ba44070 Minor. Add optimization for getOverriddenBuiltinWithDifferentJvmName 2015-10-16 18:16:03 +03:00
Denis Zharkov
155bbd40ae Do not generate not-null assertion for argument of Collection.contains
Of course not only for contains but for other methods having INSTANCEOF bar.rier
Otherwise using platform null values becomes for such methods becomes
dangerous in cases like `platformString in setOf("", "")`
2015-10-16 18:16:02 +03:00
Denis Zharkov
495780f5ab Generate INVOKEVIRTUAL 'contains(Object)' instead of 'contains(String)'
In cases when callee overrides Collection<String>.contains
2015-10-16 18:16:02 +03:00
Denis Zharkov
64da399b31 Do not generate builtin bridges with Kotlin signature as synthetic
They should be available in Java (at least for overridding)
2015-10-16 18:16:02 +03:00
Denis Zharkov
d335f71dfe Generate special bridges for builtins with same name but different JVM descriptor 2015-10-16 18:16:02 +03:00
Denis Zharkov
07d8754adb Minor. Add bytecode listing tests with contains* methods 2015-10-16 18:16:02 +03:00
Denis Zharkov
b5296104e9 Ignore fake overrides when generating stub methods for MutableCollections
Because it's redundant as we go through all mutable collection hierarchy anyway
It wasn't a problem because for fake override just `generatedBridges` is being called
and there were no special bridges for such methods.
2015-10-16 18:16:02 +03:00
Denis Zharkov
65551e1185 Print 'final' and 'abstract' in BytecodeListing tests and sort declarations
Latter is needed to make format stable
2015-10-16 18:16:02 +03:00
Denis Zharkov
978a4cfa3c Minor. Refine naming for SpecialBuiltinMembers 2015-10-16 18:16:02 +03:00
Denis Zharkov
b6df6d8ae0 Exclude runtime.jvm from source roots
It's needed not to broke whole project compilation
while transforming Array.size
2015-10-16 18:16:02 +03:00
Denis Zharkov
bd37a10677 Transform *Array.size to properties 2015-10-16 18:16:02 +03:00
Andrey Breslav
b050324869 Mark string prefixes and suffixes as unsupported 2015-10-16 18:03:53 +03:00
Andrey Breslav
267ec2724e Minor. Ant task renamed: JetLexer -> KotlinLexer 2015-10-16 17:55:12 +03:00
Andrey Breslav
d1a3a66e12 Minor. Comments removed 2015-10-16 17:55:11 +03:00
Nikolay Krasko
cf7f94a559 Process request for searching class with empty qualified name without errors 2015-10-16 16:28:02 +03:00
Yan Zhulanow
2a55894bec Update OperationsMapGenerated 2015-10-16 16:19:51 +03:00
Zalim Bashorov
e54e6a3f31 Minor: fix build 2015-10-16 16:14:34 +03:00
Zalim Bashorov
79d38a6c8f Report the error when a declaration in Kotlin accidentally overrides a static member from Java 2015-10-16 16:14:34 +03:00
Zalim Bashorov
72a686f9e0 Add tests for accessing to Java/Kotlin inner/nested classes 2015-10-16 16:09:35 +03:00
Zalim Bashorov
9acf3e40de Generic type with Nothing in arguments compiles to raw type 2015-10-16 15:30:41 +03:00
Michael Nedzelsky
8e9f1ac31a Extension function type is not allowed as supertype 2015-10-16 14:23:47 +03:00
Dmitry Petrov
d3e2dd5942 Dropping package facades: drop package facades not cleaned up automatically 2015-10-16 13:53:23 +03:00
Dmitry Petrov
670b49ec5e Dropping package facades: remove unused imports from package facades
(not cleaned up automatically)
2015-10-16 11:23:22 +03:00
Alexander Udalov
74cd449d86 Fix runtime copying for IDEA run configuration
- 'overwrite' is false by default, so now it's set to true explicitly
- copy the runtime to all other plugins as well because runtimes from those
  plugins sometimes appear before the Kotlin one
2015-10-15 22:36:23 +03:00
Alexander Udalov
f62128bdcd Fix protobuf extension API usages
"getExtension" returns default value when the requested extension is not
present, which is 0 for Int, which makes no sense for extensions like
methodImplClassName that are storing the number in the string table
2015-10-15 22:36:22 +03:00
Nikolay Krasko
4a361ebe60 Hide update plugin popup right after Intall was clicked to prevent multiple downloads 2015-10-15 19:37:22 +03:00
Michael Nedzelsky
114d19e6d9 use MainFunctionDetector in order to check for main function 2015-10-15 19:24:45 +03:00
Valentin Kipyatkov
e2c7ba7f40 Changed test data to not use deprecated api 2015-10-15 19:20:12 +03:00
Valentin Kipyatkov
36b3b16cb5 KT-5145 has been resolved but KT-9606 exists 2015-10-15 19:20:12 +03:00
Valentin Kipyatkov
a83539705e Fixed completion handler for annotations (because the parser does not parse "@ xxx" as annotation anymore) 2015-10-15 19:20:12 +03:00
Valentin Kipyatkov
dc83d5cf04 Fixed test data 2015-10-15 19:20:12 +03:00
Valentin Kipyatkov
f67bd8c13f Even more precise keyword completion for modifiers 2015-10-15 19:20:11 +03:00
Valentin Kipyatkov
15d507bf47 Removed obsolete comments 2015-10-15 19:20:11 +03:00
Valentin Kipyatkov
762900037e Minor 2015-10-15 19:20:11 +03:00
Valentin Kipyatkov
26768ad34b Renames 2015-10-15 19:20:11 +03:00
Valentin Kipyatkov
292ea7625c Removed obosolete modifier "ref" from tests 2015-10-15 19:20:11 +03:00
Valentin Kipyatkov
dfcf459bf6 Minor 2015-10-15 19:20:11 +03:00
Valentin Kipyatkov
87cfccc2d9 Removed all places in parser where obsolete annotation syntax was allowed 2015-10-15 19:20:10 +03:00
Valentin Kipyatkov
875eaa52e3 Removing unused code 2015-10-15 19:20:10 +03:00
Valentin Kipyatkov
58a9b34276 Minor 2015-10-15 19:20:10 +03:00
Valentin Kipyatkov
78f60503e3 More correct keyword completion after @ 2015-10-15 19:20:10 +03:00
Valentin Kipyatkov
e27528477f KT-9478 No override completion for second parameter in primary constructor
#KT-9478 Fixed
 #KT-9386 Fixed
2015-10-15 19:20:10 +03:00
Valentin Kipyatkov
434be3be21 Adapted keyword completion to changed parser + more precise completion for modifier keywords 2015-10-15 19:20:09 +03:00
Valentin Kipyatkov
f90ff31507 Adapting code completion to no annotations without "@" 2015-10-15 19:20:09 +03:00
Valentin Kipyatkov
ddcab047ce Added CallType.ANNOTATION 2015-10-15 19:20:09 +03:00
Valentin Kipyatkov
0030fb7155 Removed unused code 2015-10-15 19:20:09 +03:00
Valentin Kipyatkov
9e694523f8 Fixing conversion from Java on copy/paste after changes in parser 2015-10-15 19:20:09 +03:00
Valentin Kipyatkov
b519a8af08 Fixing live template context detection after changes in parser 2015-10-15 19:20:09 +03:00
Valentin Kipyatkov
988c934e78 Fixed Pull Up to generate correct annotation syntax 2015-10-15 19:20:08 +03:00
Valentin Kipyatkov
c8135fe4f2 Removed obolete syntax for enum entries in test data 2015-10-15 19:20:08 +03:00
Valentin Kipyatkov
090ea37a32 Fixed test data to use only annotation syntax with @ 2015-10-15 19:20:08 +03:00
Valentin Kipyatkov
487501a7a4 Fixed test data after changes in parser 2015-10-15 19:20:08 +03:00
Valentin Kipyatkov
d84020b1f3 Removed special support for parsing annotations for multi-declaration in for 2015-10-15 19:20:08 +03:00
Valentin Kipyatkov
98dc8f234e Drop suppport for annotation syntax without '@' from parser 2015-10-15 19:20:07 +03:00
Ilya Gorbunov
d8ba854036 Fixes and cleanup in stdlib generator after builtin renames. 2015-10-15 18:35:11 +03:00
Ilya Gorbunov
a5ccecfc3d StdLib generator: refactor deprecation DSL to be able to set deprecation level. 2015-10-15 18:30:19 +03:00
Alexander Udalov
66417ed329 Parse type arguments after callable reference as error
Is likely to be supported in the future
2015-10-15 18:25:42 +03:00
Alexander Udalov
32a9bddbf9 Increase ABI version after yet another change to binary format 2015-10-15 18:25:42 +03:00
Alexander Udalov
bf4a681589 Deduce receiver type of callable reference from LHS, not from descriptor 2015-10-15 18:25:42 +03:00
Alexander Udalov
2cf437c0e2 Fix type of callable reference to fake override 2015-10-15 18:25:41 +03:00
Alexander Udalov
9eb2e16b94 Support strings directly in JVM string table
For small strings it may be beneficial to store them as is in the proto at one
point instead of in a class annotation, because each annotation argument in the
classfile has a constant overhead which may be significant for small strings
2015-10-15 18:25:41 +03:00
Alexander Udalov
4c21142648 Store type parameter names sometimes instead of ids
This helps to reuse instances of types when TypeTable is enabled in cases when
a file or a class contains a lot of functions with type parameters with the
same name (like Maps.kt in the stdlib with "Map<K, V>")
2015-10-15 18:25:40 +03:00
Alexander Udalov
fb5d8de84b Use type table in DescriptorSerializer, add switch to enable/disable, test 2015-10-15 18:25:40 +03:00
Alexander Udalov
82d2e623d3 Support a more optimized way of storing types in metadata
Together with almost every type now there's also an id which references a type
from a separate table. Storing such ids instead of Type messages will allow to
reduce the size of the metadata for files where types are used many times over
and over again. Currently only deserialization of such types is supported,
along with the former mechanism
2015-10-15 18:25:39 +03:00
Yan Zhulanow
bff6639e2d Use stubs in checkParameterInFunctionType 2015-10-15 18:23:58 +03:00
Yan Zhulanow
d52f245cf7 Rename unary plus/minus in builtins and stdlib 2015-10-15 18:23:58 +03:00
Yan Zhulanow
f7ce0c2d20 Add new intrinsic methods: unaryPlus, unaryMinus 2015-10-15 18:23:58 +03:00
Ilya Gorbunov
2fba80168d Remove usages of Delegates.lazy 2015-10-15 18:20:41 +03:00
Ilya Gorbunov
c4ef4758d2 Remove last two usages of Delegates.blockingLazy 2015-10-15 18:20:39 +03:00
Pavel V. Talanov
053e61a226 file facade index: Fix indexing files without top level members by mistake 2015-10-15 15:49:46 +03:00
Pavel V. Talanov
d9ed79e781 Add test for not generating file facade light class for empty file 2015-10-15 15:49:46 +03:00
Pavel V. Talanov
123c55b6db IDELightClassGenerationSupport: fix not generating @JvmName annotation for file facade light classes
This was a minor inconsistency between compiler and ide light classes
2015-10-15 15:49:45 +03:00
Pavel V. Talanov
9e9f593a7f Generate tests for ide light classes from the same test data as for compiler light classes 2015-10-15 15:49:45 +03:00
Pavel V. Talanov
35e56993d3 Rename: KotlinLightClassTest -> CompilerLightClassTest
In fact we have very different code in compiler and ide but only one test
2015-10-15 15:49:44 +03:00
Pavel V. Talanov
225e5abc92 Test renaming empty file 2015-10-15 15:49:43 +03:00
Pavel V. Talanov
53b21061fd Don't use StubBasedPsiElementBase#getStubOrPsiParent
#KT-9579 Fixed
2015-10-15 15:49:42 +03:00
Pavel V. Talanov
bfcabad148 Don't override StubBasedPsiElementBase.getStub
#KT-9575 Fixed
2015-10-15 15:49:42 +03:00
Michael Nedzelsky
890ae3e914 Make single-file classes tolerant to having many main()'s 2015-10-15 15:46:26 +03:00
Dmitry Petrov
416dda95ce Drop package facades: build reflection in "regular" mode
(no multifile package facades).
2015-10-15 10:33:53 +03:00
Dmitry Petrov
8cd624a58a Drop package facades: code cleanup in Kotlin project. 2015-10-15 10:33:47 +03:00
Dmitry Petrov
57869d85e8 Spread should always copy arrays.
Introduce a special (package private) utility class ArraysUtilJVM
to fix Array<T>.asList() issues.
2015-10-15 09:16:21 +03:00
Alexander Udalov
97946feb9a Minor, rename and adapt test 2015-10-15 00:51:37 +03:00
Alexander Udalov
556a169a5d Update stdlib usages of PropertyMetadata to KProperty<*> 2015-10-15 00:05:31 +03:00
Ilya Gorbunov
43bb9347c6 Rename Regex.hasMatch to containsMatchIn, and add corresponding contains function to CharSequence. 2015-10-14 22:49:50 +03:00
Ilya Gorbunov
d1d865aa0f Rename methods in Regex. Add matchEntire method to match entire string against regex. 2015-10-14 22:49:48 +03:00
Ilya Gorbunov
d860f335a3 JS: Make StringBuilder implement CharSequence and introduce secondary constructors. 2015-10-14 22:49:47 +03:00
Ilya Gorbunov
935024db4e Fix with hack bridge codegen for indexOf and lastIndexOf methods. More sophisticated solution is required. 2015-10-14 22:49:40 +03:00
Alexander Udalov
5017e54022 Fix test broken during merge 2015-10-14 22:02:11 +03:00
Alexander Udalov
bd5f068454 Fix build after subtle change of Enum.name from function to property 2015-10-14 22:00:48 +03:00
Michael Nedzelsky
57205f5721 drop BASE_WITH_NULLABLE_UPPER_BOUND 2015-10-14 20:51:01 +03:00
Alexander Udalov
ced1edcf98 Prohibit callable references to object members
To be able to make them more useful in the future, i.e. bound to the object
instance
2015-10-14 20:45:56 +03:00
Alexander Udalov
63dfe13c43 Add some tests on KProperty usage from delegate methods 2015-10-14 20:45:55 +03:00
Alexander Udalov
6a965c9a06 Update IDE tests to use KProperty instead of PropertyMetadata 2015-10-14 20:45:55 +03:00
Alexander Udalov
51bf68ce27 Update compiler tests to use KProperty instead of PropertyMetadata 2015-10-14 20:45:54 +03:00
Alexander Udalov
a6846b3967 Insert KProperty<*> when creating property delegate methods in IDE 2015-10-14 20:45:26 +03:00
Alexander Udalov
ec1b4776fe Deprecate PropertyMetadata, use KProperty<*> for delegated properties instead 2015-10-14 20:45:25 +03:00
Alexander Udalov
3c74f48f91 Pass KProperty instances to property delegates
Inherit KProperty from PropertyMetadata, cache corresponding KProperty objects
instead of PropertyMetadataImpl objects, add support for properties with 2
receivers
2015-10-14 20:45:24 +03:00
Mikhail Glukhikh
4614e74e3f isFromJavaOrBuiltins() is now public (compilation fix) 2015-10-14 20:40:34 +03:00
Mikhail Glukhikh
8b482a59d9 No inline for MutableMap extensions with JvmName (to prevent stub comparison breaking) 2015-10-14 20:40:31 +03:00
Mikhail Glukhikh
3461837c28 Temporary move std-lib deprecated back to MutableCollections (due to backward compatibility stuff) 2015-10-14 20:40:29 +03:00
Mikhail Glukhikh
4987e095e5 Move some methods to deprecated built-ins 2015-10-14 20:40:26 +03:00
Mikhail Glukhikh
37ecf5def5 Fix: bridges are now generated for non-final functions of Kotlin built-in classes 2015-10-14 20:40:23 +03:00
Mikhail Glukhikh
d4a1a469b7 Number rename: xxxValue() --> toXxx(), test 2015-10-14 20:40:21 +03:00
Mikhail Glukhikh
c6a1bd7df3 different enum property rename: name --> ... 2015-10-14 20:40:18 +03:00
Mikhail Glukhikh
7ee1e555bc DataFlowValue enum property rename: name --> str 2015-10-14 20:40:15 +03:00
Mikhail Glukhikh
f8a356747e Stdlib rename: 'name' and 'ordinal' are now properties in Enum, same name functions are deprecated 2015-10-14 20:40:13 +03:00
Mikhail Glukhikh
78cfeb0d7d Stdlib rename: List.indexOf(T), List.lastIndexOf(T), MutableCollection.removeAll(Collection<T>), MutableCollection.retainAll(Collection<T>) 2015-10-14 20:40:09 +03:00
Denis Zharkov
ed5ba01e85 Temporary revert moving CharSequence.charAt because of markdown parser 2015-10-14 20:40:07 +03:00
Denis Zharkov
9e052372e6 Make SmartSet smarter 2015-10-14 20:40:04 +03:00
Denis Zharkov
6322198a11 Revert 'isEmpty' transformation 2015-10-14 20:40:01 +03:00
Denis Zharkov
17c906658d Transform Throwable members to properties 2015-10-14 20:39:59 +03:00
Denis Zharkov
9088bf67c7 Extract and clean deprecated builtin extensions 2015-10-14 20:39:56 +03:00
Denis Zharkov
0b9c9a6047 Support builtin properties in ConstantExpressionEvaluator 2015-10-14 20:39:53 +03:00
Denis Zharkov
e062e32f95 Do not load special builtin overrides from Java as synthesized
It has been done just to avoid clashes with real declarations that look
like our builtins: e.g. 'String removeAt(int index) {}' and 'String remove(int index) {}'in Java.

But synthesized members are even weaker than extensions.

Solution is just to ignore the latter declaration and treat first as effective override
of out builltin.
2015-10-14 20:39:51 +03:00
Denis Zharkov
cd589b7e6a Add workaround for KT-9571 2015-10-14 20:39:48 +03:00
Denis Zharkov
5c2fd75389 Minor. Clarified comments in test 2015-10-14 20:39:46 +03:00
Denis Zharkov
a6dfa53d77 Adjust JS stdlib maps to changes in builtins 2015-10-14 20:39:43 +03:00
Denis Zharkov
d71b0144d5 Adjust testData to *Map transformation 2015-10-14 20:39:40 +03:00
Denis Zharkov
6fa8083a70 Transform builtin Map declaration and adjust stdlib 2015-10-14 20:39:38 +03:00
Denis Zharkov
f0e3fd617d Adjust testData to CharSequence.length transformation 2015-10-14 20:39:35 +03:00
Denis Zharkov
cb562e7ea5 Adjust JS backend to CharSequence.length transformation 2015-10-14 20:39:32 +03:00
Denis Zharkov
1305d9755a Transform CharSequence.length to property 2015-10-14 20:39:29 +03:00
Denis Zharkov
6c0d55e4ed Minor. Rename kotlin file and package part: builtinsPropertiesUtil -> specialBuiltinMembers 2015-10-14 20:39:27 +03:00
Denis Zharkov
0a6bf31a2c Refactor util methods
Group semantically similar parts by objects
2015-10-14 20:39:24 +03:00
Alexey Tsvetkov
eae644c365 Remove isArrayOf reference from common JVM/JS test 2015-10-14 20:06:52 +03:00
Yan Zhulanow
528482f625 Deprecated conventions (get -> getValue, plus -> unaryPlus) quickfix 2015-10-14 19:10:36 +03:00
Yan Zhulanow
f9e89596fd Add 'operator' modifier to stdlib property Delegate functions 2015-10-14 19:10:36 +03:00
Mikhail Glukhikh
d2358c7fb4 Accidentally added code was rolled back 2015-10-14 18:55:26 +03:00
Alexey Tsvetkov
5449cea6b7 Make Array type parameter T non-reified 2015-10-14 18:36:53 +03:00
Alexey Tsvetkov
62c25c0370 Replace is Array<T> with .isArrayOf<T>() 2015-10-14 18:36:53 +03:00
Michael Nedzelsky
01cd277d63 fix maven build 2015-10-14 18:34:10 +03:00
Ilya Gorbunov
cac7bfc80b Clarify some type in tests. 2015-10-14 18:26:46 +03:00
Ilya Gorbunov
93c73500d7 Do not allow to delegate readonly property to a map with incompatible value type.
Infer type of delegated readonly property from the map value type.
2015-10-14 18:22:30 +03:00
Ilya Gorbunov
96b33a8bfd Minor reindent optimizations 2015-10-14 18:19:57 +03:00
Ilya Gorbunov
af0a59dd02 Deprecate StringBuilder { } function, and introduce buildString { } instead.
#KT-7295 Fixed
2015-10-14 18:19:57 +03:00
Ilya Gorbunov
6d7cc0671e Allow equals with ignoreCase parameter to take nullable Strings both as a receiver and a parameter.
#KT-9188
2015-10-14 18:19:56 +03:00
Mikhail Glukhikh
c0faf82f77 Initializer is now required for mutable properties with backing fields and open or custom setter #KT-9449 Fixed
Setters without body are not taken into account accordingly to KT-9449.
Old INITIALIZATION_USING_BACKING_FIELD_SETTER are both dropped.
2015-10-14 18:00:13 +03:00
Mikhail Glukhikh
9c9ab671b3 Effective visibility: local is now considered private, TYPE_DEPENDS_ON_LOCAL_CLASS diagnostics removed as repeated #KT-9542 Fixed #KT-9526 Fixed 2015-10-14 18:00:10 +03:00
Mikhail Glukhikh
3a902d6002 Effective visibility: fix for internal & protected vs protected comparison #KT-9582 Fixed 2015-10-14 18:00:07 +03:00
Mikhail Glukhikh
d1c7749103 Effective visibility: messages fix 2015-10-14 18:00:05 +03:00
Mikhail Glukhikh
c210ca5b4d Additional correctness check for noinline & crossinline #KT-9567 Fixed 2015-10-14 18:00:02 +03:00
Mikhail Glukhikh
96b567254d Deprecation fixes 2015-10-14 17:59:59 +03:00
Michael Nedzelsky
27b13dda65 improve diagnostic for KT-9484 Don't allow named arguments for inherited functions with parameter name conflicts
#KT-9484 Fixed
2015-10-14 16:58:19 +03:00
Michael Nedzelsky
d05a7224c7 add check for escaped identifiers 2015-10-14 16:57:06 +03:00
Michael Nedzelsky
1818e9f1bd fix parse `` 2015-10-14 16:57:03 +03:00
Michael Nedzelsky
7f0fbb4577 fix tests for quoted names 2015-10-14 16:57:00 +03:00
Michael Nedzelsky
2a97c28491 remove validation from FqName and FqNameUnsafe constructors 2015-10-14 16:56:58 +03:00
Michael Nedzelsky
cc2dfc4937 remove validation from Name.identifier 2015-10-14 16:56:55 +03:00
Mikhail Glukhikh
001b1269b9 IO deprecations: String.separatorsToSystem() --> File.separatorsToSystem() KT-9534, FileTreeWalk.filter --> FileTreeWalk.treeFilter KT-8517 2015-10-14 16:10:11 +03:00
Michael Bogdanov
d78b59eb73 Package private visibility for private top-level members 2015-10-14 16:03:54 +03:00
Pavel V. Talanov
d603142cc6 Provide inspection and quickfixes for usages of static fields which will be no longer accessible in future versions
For this inspection three kinds of fixes are potentially available:
- Add 'const' modifier to kotlin property
- Add '@JvmField' annotation to kotlin property
- Change field reference to getter invocation

In case user chooses to 'cleanup code', these fixes are prioritized in this order
2015-10-14 14:42:26 +03:00
Pavel V. Talanov
47cca7db1f Test data: adjust test data after prohibiting properties with typeparameters not used in receiver 2015-10-14 13:42:13 +03:00
Pavel V. Talanov
3468e83671 Drop ID property which would be unsupported 2015-10-14 13:42:11 +03:00
Pavel V. Talanov
2e75f7f103 Js stdlib: noImpl property has 'Nothing' type 2015-10-14 13:41:56 +03:00
Pavel V. Talanov
be15399313 Report errors for type parameters of properties that are not used in receiver types 2015-10-14 13:40:10 +03:00
Ilya Chernikov
b5537e7d42 Merge pull request #766 from JetBrains/rr/daemon-fixes
daemon fixes
2015-10-14 12:21:51 +02:00
Ilya Chernikov
3f83a2895f Code cleanup 2015-10-14 12:20:01 +02:00
Ilya Chernikov
029e823b06 Placing temp files to appropriate location in DaemonExecutionViaIntermediateProcess test 2015-10-14 12:20:01 +02:00
Ilya Chernikov
d9b0e4db48 Simplifying java binary selection: java.awt.headless property seems work on all platforms 2015-10-14 12:20:00 +02:00
Ilya Chernikov
21558fe1c6 Deriving callback server classes from UnicastRemoteObject instead of manual registration, magically solves the problems with parallel builds; modifying and refactoring usage places accordingly 2015-10-14 12:20:00 +02:00
Ilya Chernikov
5b5ec2cb04 Make getDaemonConnection synchronized to avoid racing conditions on connection 2015-10-14 12:19:59 +02:00
Michael Bogdanov
0209cd080e Deprecated flag for static non-JvmField and non-const properties 2015-10-14 13:13:49 +03:00
Yan Zhulanow
275f3f8954 'operator' checks 2015-10-14 01:29:10 +03:00
Yan Zhulanow
dc8e796e49 getValue()/setValue() should be marked with 'operator' 2015-10-14 01:29:09 +03:00
Yan Zhulanow
bc3d1ddda0 Remove old 'get' delegate convention in interfaces 2015-10-14 01:29:09 +03:00
Ilya Gorbunov
6d2f9cc669 Remove obsolete iterator tests 2015-10-13 22:31:15 +03:00
Ilya Gorbunov
c58d21a1e7 Remove obsolete test for KT-1131 2015-10-13 22:31:14 +03:00
Ilya Gorbunov
2cdd413590 StdLib generators: Add some infix extensions for DSL, remove unneeded import, simplify declarations. 2015-10-13 22:23:13 +03:00
Svetlana Isakova
075a8eaf39 Moved 'Exact' and 'NoInfer' annotations to stdlib 2015-10-13 21:42:54 +03:00
Alexey Sedunov
30d697109c Code Insight: "Generate secondary constructor" action
#KT-6970 Fixed
2015-10-13 20:56:52 +03:00
Alexander Udalov
78829b9e8f Minor, drop some obsolete usages of TRAIT in compiler 2015-10-13 20:29:39 +03:00
Alexander Udalov
baaa3ef50a Remove KotlinSignature annotations from project code 2015-10-13 20:29:16 +03:00
Alexander Udalov
b378969a0a Deprecate KotlinSignature, to be removed later 2015-10-13 20:29:15 +03:00
Alexander Udalov
f16f4e5541 Disable loading parameter names from KotlinSignature, update test data 2015-10-13 20:29:15 +03:00
Alexey Tsvetkov
c21534fea1 Fix annotation on parameter in function type test data 2015-10-13 20:11:34 +03:00
Valentin Kipyatkov
d728417f7f Fixed KT-9496 FQ-class name inserted in type argument on copy/paste
#KT-9496 Fixed
2015-10-13 19:13:22 +03:00
Mikhail Glukhikh
f4e1f53549 Error message fixed 2015-10-13 17:13:17 +03:00
Mikhail Glukhikh
5a16e43579 Synchronized is no more allowed on abstract functions 2015-10-13 16:37:34 +03:00
Mikhail Glukhikh
ccf0c363fa Volatile is no more allowed on values #KT-7670 Fixed 2015-10-13 16:37:24 +03:00
Mikhail Glukhikh
8473be357f Effective visibility: separate InternalProtected and InternalProtectedBound, messages, test change 2015-10-13 16:31:28 +03:00
Mikhail Glukhikh
4dbd7e7f69 Effective visibility: lower bounds introduced for all protected and for protected and internal #KT-9540 Fixed 2015-10-13 16:26:05 +03:00
Michael Bogdanov
bee0fb6283 Fix test data 2015-10-13 16:17:05 +03:00
Alexey Tsvetkov
a564724fa8 Fix issues with incremental cache version change
#KT-9360 fixed
2015-10-13 16:12:15 +03:00
Alexey Tsvetkov
af3f7dfafc Make test generated 2015-10-13 16:12:15 +03:00
Alexey Tsvetkov
0e606a3210 Prohibit named parameters in function types in supertype position 2015-10-13 16:07:55 +03:00
Alexey Tsvetkov
90849a67ae Prohibit annotations, modifiers and default values for parameters in function type
#KT-7619 fixed
2015-10-13 16:07:55 +03:00
Michael Bogdanov
27a1a17c09 Deprecate non-const properties copies in interface 2015-10-13 14:15:47 +03:00
Andrey Breslav
dbc0197a36 @HiddenDeclaration deprecated 2015-10-13 13:50:16 +03:00
Andrey Breslav
8e7f6f3c8c Migrated from @HiddenDeclaration to @Deprecated(..., level = DeprecationLevel.HIDDEN) 2015-10-13 13:50:16 +03:00
Dmitry Jemerov
7663afb7e0 send OS version to plugin update checker 2015-10-13 11:27:20 +02:00
Alexander Udalov
046722100c Minor, drop unused method 2015-10-13 11:59:46 +03:00
Alexander Udalov
571e5aea83 Minor, fix space in diagnostic message 2015-10-13 11:59:18 +03:00
Alexander Udalov
5f18cb8703 Rename files in reflection.jvm
Move KDeclarationContainer.functions to KClasses and make it accept only
KClass, since KPackage is deprecated anyway
2015-10-13 11:58:45 +03:00
Michael Bogdanov
a09c8105c4 Support reflection on top level properties 2015-10-13 11:14:33 +03:00
Michael Bogdanov
e8f9a9f3b8 Support reflection on @JvmField properties inside class companion 2015-10-13 11:14:32 +03:00
Michael Bogdanov
f4b7913dd3 sanitizeAsJavaIdentifier function moved to JvmAbi 2015-10-13 11:14:32 +03:00
Pavel V. Talanov
d8be99a378 Prohibit @JvmField for private properties 2015-10-13 11:14:31 +03:00
Michael Bogdanov
f7164c5bfd Don't rename class property with JvmField annotation, report clashing 2015-10-13 11:14:31 +03:00
Michael Bogdanov
b713328540 Fix reflection for internal properties without getter/setter 2015-10-13 10:50:10 +03:00
Michael Bogdanov
81f478c6fd JvmField retention changed to BINARY 2015-10-13 10:50:09 +03:00
Michael Bogdanov
22142ee44d Initial support of JvmField annotation 2015-10-13 10:50:09 +03:00
Pavel V. Talanov
6cf9bfdb70 publicField -> JvmField
Effectively drop publicField and introduce JvmField (which has the same effect for now)
Implement frontend checks for @JvmField
Replace publicField -> JvmField in test data
2015-10-13 10:50:08 +03:00
Pavel V. Talanov
bfaf806f47 Refactor: move various checkers from JvmPlatformConfigurator.kt 2015-10-13 10:50:07 +03:00
Michael Bogdanov
7ce770d97d Test data fix 2015-10-13 10:50:07 +03:00
Michael Bogdanov
ee6dbac381 Remove synthetic flag from internal members 2015-10-13 10:48:37 +03:00
Andrey Breslav
4f63d47f82 Intention action for hiddnen declarations fixed 2015-10-13 01:45:02 +03:00
Andrey Breslav
1c00b933a5 @Deprecated(..., level = HIDDEN) supported
isAnnotatedAsHidden() moved to front-end
2015-10-13 01:44:46 +03:00
Andrey Breslav
95240fc29f DEPRECATED_ERROR supported 2015-10-13 01:44:46 +03:00
Alexander Udalov
34267e436e Merge two deprecation diagnostics into one DEPRECATION
This also fixes weird suppressions in user code: instead of
«@Suppress("DEPRECATED_SYMBOL_WITH_MESSAGE")» you should now use
«@Suppress("DEPRECATION")»
2015-10-13 01:44:45 +03:00
Denis Zharkov
c817949221 Add services from descriptor.loader.java to resulting jars
#KT-9558 Fixed
2015-10-12 18:51:36 +03:00
Mikhail Glukhikh
92f031cc46 Warning "value of type parameter is predetermined" is no more generated for sealed bound #KT-9244 Fixed 2015-10-12 18:28:47 +03:00
Dmitry Petrov
b24623810e Java 8 and Any-related restrictions: fix commits clash in testData 2015-10-12 18:17:51 +03:00
Mikhail Glukhikh
e121ba549e Accessor visibilities are now forbidden for abstract properties 2015-10-12 18:12:39 +03:00
Svetlana Isakova
b709b431ea Parse annotations on nullable types 2015-10-12 16:28:48 +03:00
Svetlana Isakova
b49a3f8e00 Added test for annotations on nullable types 2015-10-12 16:28:48 +03:00
Svetlana Isakova
c531c5a0af KDoc. Don't ignore links in @see
Such link was totally ignored:
/**
 * @see <a href="http://kotl.in">http://kotl.in</a>
 */
2015-10-12 16:28:48 +03:00
Dmitry Petrov
818931ec06 Check for exposed local classes (or objects) in type signatures: fix IDE test 2015-10-12 15:35:39 +03:00
Dmitry Petrov
7e51fb8521 Check for exposed local classes (or objects) in type signatures 2015-10-12 15:24:54 +03:00
Valentin Kipyatkov
cbf4e4a973 Corrected order of modifier insertion 2015-10-12 15:10:39 +03:00
Valentin Kipyatkov
55cbe185f8 Do not offer to convert to infix call when calling non-infix function 2015-10-12 15:10:39 +03:00
Valentin Kipyatkov
ee7425c1de Checking "infix" modifier in completion and import popup 2015-10-12 15:10:39 +03:00
Valentin Kipyatkov
a7577ac722 Don't use JetSimpleNameExpression too much 2015-10-12 15:09:53 +03:00
Dmitry Jemerov
23e13d4043 fix type parameter migration for extension functions 2015-10-12 13:45:44 +02:00
Andrey Breslav
045df48588 Minor. TRAIT -> INTERFACE 2015-10-12 14:40:48 +03:00
Andrey Breslav
a2e5e60c68 TRAIT -> INTERFACE in diagnostics 2015-10-12 14:36:38 +03:00
Dmitry Petrov
ff1bf673ba Java 8 override restrictions: interface can't implement a method of 'Any'
- update Range and related classes
2015-10-12 14:12:31 +03:00
Dmitry Petrov
7e9e427d4c Java 8 rules for method overrides:
- report errors on implementing methods of Any in interfaces
- update testData

~~~

Java 8 override restrictions: interface can't implement a method of 'Any'
- update compiler sources
2015-10-12 14:12:31 +03:00
Dmitry Petrov
5d9ee7efee Java 8 rules for method overrides:
- base class method wins against a (default) interface method,
so an abstract base class method should always be implemented
in a derived class;

- interface methods clash regardless of abstract/default
with possibly undefined behavior at run-time,
so a class or interface should always define its own method
for methods inherited from multiple interfaces and not from base class;

- meaningful diagnostics for class inheriting conflicting JVM signatures.
Since no override will happen under Java 8 rules,
ACCIDENTAL_OVERRIDE is misleading for this case;

- update testData.
2015-10-12 14:12:31 +03:00
Mikhail Glukhikh
82c0265cb3 Quick fix for implicit nothing with a test 2015-10-12 13:30:22 +03:00
Mikhail Glukhikh
64543e3f52 Implicit Nothing return type is now deprecated 2015-10-12 13:30:16 +03:00
Mikhail Glukhikh
65f0f312ff Private setter is now forbidden for non-private late init variables 2015-10-12 13:30:13 +03:00
Dmitry Jemerov
2cab34bb3f drop hexadecimal double literals 2015-10-12 11:32:34 +02:00
Dmitry Jemerov
ead19076d7 stop calling propertyDelegated() method 2015-10-12 11:16:12 +02:00
Dmitry Jemerov
457e40a0b8 fix a few more tests 2015-10-12 11:11:31 +02:00
Dmitry Jemerov
02a242f15a parser tweaks to compensate for removal of static type assertions 2015-10-12 11:11:30 +02:00
Dmitry Jemerov
a63d3f5a0f fix more compilation errors and some tests 2015-10-12 11:11:29 +02:00
Dmitry Jemerov
f5aaf65ca9 remove usages of static type assertions from the compiler 2015-10-12 11:11:28 +02:00
Dmitry Jemerov
1523d5bcbf removing static type assertions work in progress 2015-10-12 11:11:23 +02:00
Nikolay Krasko
8f87efc0a2 Update to IDEA 143.116.4 2015-10-12 11:49:47 +03:00
Ilya Gorbunov
7ff0e140f0 Update MockJDK to include Pattern.class required in tests for #KT-7732 2015-10-12 00:13:37 +03:00
Ilya Gorbunov
4ae2491ab6 J2K: Special conversion for java.lang.String methods: String.join (cannot be tested with MockJDK)
#KT-7732
2015-10-12 00:13:23 +03:00
Ilya Gorbunov
5914625b53 J2K: Special conversion for java.lang.String methods: more accurate parameter count matching for String.format
#KT-7732
2015-10-12 00:13:09 +03:00
Ilya Gorbunov
77a46cab92 J2K: Special conversion for java.lang.String methods: tests for lastIndexOf
#KT-7732
2015-10-12 00:12:55 +03:00
Ilya Gorbunov
7a0a23366c Use PsiExpressionEvaluator to evaluate constant limit value. 2015-10-12 00:12:41 +03:00
Denis Zharkov
3bb8cf1bff Temporary restore CharSequence.get extension 2015-10-11 19:59:31 +03:00
Denis Zharkov
a76a8fcc3f Adjust various testData to remove/charAt transformation 2015-10-11 19:59:31 +03:00
Denis Zharkov
6d864e0854 Adjust collection stubs generating to 'remove' transformation
See substitutedList* tests in Backend
2015-10-11 19:59:30 +03:00
Denis Zharkov
1c7fa42b86 Adjust js codegen and lib to 'charAt' -> 'get' transformation 2015-10-11 19:59:30 +03:00
Denis Zharkov
6f4579213c Adjust rendered descriptors after remove/charAt transformations 2015-10-11 19:59:30 +03:00
Denis Zharkov
3733d0e84f Adjust stdlib to remove/charAt transformation 2015-10-11 19:59:25 +03:00
Denis Zharkov
89ded4ab1d Implement hack to support both remove() and removeAt() in MutableList<Int>
Also add couple of tests about CharSequence.get
2015-10-11 19:57:22 +03:00
Denis Zharkov
742a538aed Support loading builtin methods from Java with different names 2015-10-11 19:57:22 +03:00
Denis Zharkov
3f5498e9f5 Transform some builtin methods
1. CharSequence.charAt -> get
2. ML.remove(Int) -> removeAt,
3. MC.remove(Any?) -> MC.remove(E)
2015-10-11 19:57:21 +03:00
Denis Zharkov
a98d1e1e55 Minor. Convert some properties to functions 2015-10-11 19:57:08 +03:00
Alexander Udalov
c78410855d Refactor CallableClsStubBuilder, separate functions and properties 2015-10-11 17:10:41 +03:00
Alexander Udalov
9d626ef1d9 Rename KotlinCallable annotation to KotlinFunction 2015-10-11 17:10:40 +03:00
Alexander Udalov
55dd51814f Don't serialize built-in enum entries
These files are never read anyway
2015-10-11 17:10:39 +03:00
Alexander Udalov
15b0d3c7c7 Minor, safer way to avoid storing defaults in proto 2015-10-11 17:10:39 +03:00
Alexander Udalov
d4320b43fa Delete useless class, simplify reading class visitor 2015-10-11 17:10:38 +03:00
Alexander Udalov
9e4823ef82 Write module name to metadata, fix reflection for file facades
Module name will be used for proper introspection of internal members
2015-10-11 17:10:37 +03:00
Alexander Udalov
0218e0351b Deprecate KPackage, to be removed later 2015-10-11 17:10:37 +03:00
Alexander Udalov
790c59d9e5 Increase ABI & stub version
See previous commits for motivation
2015-10-11 17:10:36 +03:00
Alexander Udalov
37c36f806a Rename foreignKotlinClass -> getOrCreateKotlinClass
Previously this cache contained only Java (hence 'foreign') classes, that is
not the case anymore
2015-10-11 17:10:35 +03:00
Alexander Udalov
a4732b442d Don't create KClass and KPackage instances in <clinit>
This proved to be a fragile technique, which probably doesn't even improve
performance in most cases but has lots of unexpected problems: unconditional
initialization of reflection classes, increasing the size of the bytecode, bugs
with <clinit> in annotations on JVM 6, inability to support conversion of a
class from Kotlin to Java without recompiling clients which use it
reflectively, etc.
2015-10-11 17:10:35 +03:00
Alexander Udalov
fe737886cd Drop deprecated K*Function interfaces 2015-10-11 17:10:34 +03:00
Alexander Udalov
8c4d7fdf24 Drop deprecated nested classes from Kotlin metadata annotations 2015-10-11 17:10:33 +03:00
Alexander Udalov
1497648093 Add KOTLIN_MULTIFILE_CLASS annotation to KotlinAbiVersionIndex
It was forgotten during the package reform
2015-10-11 17:10:33 +03:00
Alexander Udalov
1c229d173e Forget old classes from jet.runtime.typeinfo.*, drop JetValueParameter 2015-10-11 17:10:32 +03:00
Alexander Udalov
e3a5590eb7 Simplify FQ name check in ReflectionTypes
Fix EA-73058
2015-10-11 17:10:32 +03:00
Alexander Udalov
cf54a76e3b Optimize JvmStringTable, don't store operation = NONE which is default 2015-10-11 17:10:31 +03:00
Alexander Udalov
934ffed944 Don't write field signatures when not necessary 2015-10-11 17:10:30 +03:00
Alexander Udalov
864926ee2e Don't always write JVM method signatures to metadata
When the trivial type mapping (implemented in JvmProtoBufUtil) from
ProtoBuf.Type instances works fine, don't write the signature since it can be
loaded by exactly the same trivial type mapping
2015-10-11 17:10:30 +03:00
Alexander Udalov
168f1000e4 Remove confusing outdated code about copying JVM signatures
This was necessary with old package facades, but not anymore because metadata
is written separately to file classes and codegen now never tries to serialize
deserialized descriptors
2015-10-11 17:10:29 +03:00
Alexander Udalov
3506a9615e Don't write default values of flags, provide sensible defaults 2015-10-11 17:10:28 +03:00
Alexander Udalov
e58677b8fe Do not fail on unknown visibilities, modalities, etc in deserialization
Provide some sensible defaults like "private", "final", "class" instead, which
will give us a small possibility to not break the format if a new
modality/visibility/... is introduced in the case when the old compiler may
safely consider it as the default one
2015-10-11 17:10:28 +03:00
Alexander Udalov
2e10d21e3f Minor, rename LATE_INIT -> IS_LATEINIT, INNER -> IS_INNER 2015-10-11 17:10:27 +03:00
Alexander Udalov
aa95375029 Fix incorrect copy-paste during proto messages refactoring
Annotations on properties should be loaded not when the message is Property
(this happens for getters/setters as well), but when the kind is explicitly set
to PROPERTY. Also restore construction of JVM signatures for constructors
2015-10-11 17:10:26 +03:00
Alexander Udalov
e4efa27b76 Drop Callable and primary/secondary constructor proto messages 2015-10-11 17:10:26 +03:00
Alexander Udalov
e02854db6d Support new protobuf messages in cls stub builder 2015-10-11 17:10:25 +03:00
Alexander Udalov
a44f74ea20 Load new proto messages for constructors 2015-10-11 17:10:24 +03:00
Alexander Udalov
9bf0502a31 Load new proto messages for functions and properties 2015-10-11 17:10:24 +03:00
Ilya Gorbunov
a58a7727d1 Preprocessor: cleanup unused code. 2015-10-11 16:14:38 +03:00
Ilya Gorbunov
423a146bce Preprocessor: do not use legacy package facade name in build.xml. 2015-10-11 16:14:24 +03:00
Alexey Sedunov
ae9bd371e6 Unit Test Tooling: Test navigation
#KT-6472 In Progress
2015-10-11 01:13:48 +03:00
Alexey Sedunov
ad929a6577 Unit Test Tooling: Implement "Create Test" action
#KT-6472 In Progress
2015-10-11 01:13:41 +03:00
Alexey Sedunov
c697eef803 Minor: Undeprecate JetClassOrObject.isAnnotation() function 2015-10-11 01:08:11 +03:00
Denis Zharkov
f9c7e7add4 Adjust project code to changes in properties loading 2015-10-10 12:29:15 +03:00
Denis Zharkov
97ed8c83a0 Adjust testData to isEmpty/key/value transformations 2015-10-10 12:29:15 +03:00
Denis Zharkov
83b680935b Adjust js stdlib to isEmpty transformation 2015-10-10 12:29:14 +03:00
Denis Zharkov
61459961fc Adjust stdlib to isEmpty transformation 2015-10-10 12:29:14 +03:00
Denis Zharkov
cfc9d19825 Transform Collection.isEmpty and Map.Entry.key/value to properties 2015-10-10 12:29:14 +03:00
Denis Zharkov
ad68378836 Support loading methods from Java as common properties overrides 2015-10-10 12:29:14 +03:00
Michael Nedzelsky
396f38e9b3 fix check for ambiguous parameter names for overriding methods 2015-10-10 02:55:31 +03:00
Ilya Chernikov
c3d3160345 Cleaning jar cache after build in gradle plugin, fixes KT-9440. Some refactorings on the way to fix. 2015-10-09 22:38:15 +02:00
Yan Zhulanow
ed5c059cea Rename unary plus() and minus() to unaryPlus() and unaryMinus() 2015-10-09 22:49:17 +03:00
Yan Zhulanow
1f2b4e20fe Replace get() and set() to getValue() and setValue() (property delegates) 2015-10-09 22:49:16 +03:00
Mikhail Glukhikh
2fee9d362c Local interfaces are forbidden now 2015-10-09 21:06:33 +03:00
Mikhail Glukhikh
d1ab5168ec Error messages about "var with open / custom setter initialization" changed accordingly with the new backing field syntax 2015-10-09 21:06:29 +03:00
Mikhail Glukhikh
6914d09297 Old backing field with dollar is now forbidden 2015-10-09 21:06:26 +03:00
Mikhail Glukhikh
5117f744f7 Change to backing field fix is dropped because of deprecated syntax 2015-10-09 21:06:01 +03:00
Mikhail Glukhikh
cf7146aaf7 Target is given for Throws annotation 2015-10-09 20:04:26 +03:00
Ilya Chernikov
1cb48d5ad9 Enabling daemon by default, removing word "experimental" from settings field name. 2015-10-09 17:47:50 +02:00
Dmitry Jemerov
07d3ab792a enable infix quickfix in cleanup 2015-10-09 17:43:27 +02:00
Dmitry Jemerov
6ca3a9fe9f quickfix to add 'infix' modifier 2015-10-09 17:43:26 +02:00
Dmitry Jemerov
dcab3e406e update checker: fix EDT assertion, don't retry update if plugin repo has no compatible version 2015-10-09 17:39:50 +02:00
Natalia Ukhorskaya
6bc1f15f46 Debugger: fix tests on stepping 2015-10-09 17:33:19 +03:00
Natalia Ukhorskaya
d441f2cf8a Debugger: do not compute location during creation of step command 2015-10-09 17:33:18 +03:00
Natalia Ukhorskaya
bf4a71ee02 Minor: fix number of steps in some tests 2015-10-09 17:33:17 +03:00
Natalia Ukhorskaya
a303c8a2f6 Debugger, stepping: first check that source position is in kotlin file 2015-10-09 17:33:17 +03:00
Valentin Kipyatkov
6fb329c1cd Minor 2015-10-09 16:42:07 +03:00
Valentin Kipyatkov
21b2631558 KT-9500 Prohibit java.lang.Deprecated in completion + no duplicates for built-ins in completion
#KT-9500 Fixed
2015-10-09 16:42:07 +03:00
Valentin Kipyatkov
7b2d63cfb9 Added infix modifier 2015-10-09 16:42:07 +03:00
Valentin Kipyatkov
91b2ba9ef3 Fixed warnings 2015-10-09 16:42:07 +03:00
Valentin Kipyatkov
b549bc913a Dropped ability to specify custom PrefixMatcher in LookupElementsCollector 2015-10-09 16:42:07 +03:00
Valentin Kipyatkov
aa0a68b4be More simple prefix matching in ParameterNameAndTypeCompletion 2015-10-09 16:42:06 +03:00
Valentin Kipyatkov
9b4070b881 Changed lookup strings and prefix matchers for parameter name&type completion to get more stable and correct ordering 2015-10-09 16:42:06 +03:00
Valentin Kipyatkov
7c39064f75 Removed unnecessary 'data' modifier 2015-10-09 16:42:06 +03:00
Valentin Kipyatkov
2c1defaf18 Smart completion for "ClassName::class" and "ClassName::class.java" when specific KClass or Class expected 2015-10-09 16:42:06 +03:00
Michael Nedzelsky
b92a06929e fix KT-9484 Don't allow named arguments for inherited functions with parameter name conflicts
#KT9484 Fixed
2015-10-09 16:35:44 +03:00
Michael Bogdanov
ae15443413 Generate linenumberts in objects clinit 2015-10-09 16:25:21 +03:00
Michael Bogdanov
afa281357a Changed visibility for trait static fields 2015-10-09 16:25:20 +03:00
Michael Bogdanov
8198ac77cb Generate private constructor for object
#KT-9510 Fixed
2015-10-09 16:25:20 +03:00
Michael Bogdanov
a3e0205aec JvmAbi increased 2015-10-09 16:25:19 +03:00
Pavel V. Talanov
f4ef9647b1 Idea: add quick fix for replacing usages of deprecated "INSTANCE$" field 2015-10-09 16:25:19 +03:00
Pavel V. Talanov
d630c25f7d Add test for light class generated from object 2015-10-09 16:25:18 +03:00
Michael Bogdanov
a4997e8b31 backend tests: INSTANCE$ -> INSTANCE 2015-10-09 16:25:18 +03:00
Pavel V. Talanov
679748e1ee j2k tests: INSTANCE$ -> INSTANCE 2015-10-09 16:25:17 +03:00
Pavel V. Talanov
c28107034a Idea tests: INSTANCE$ -> INSTANCE 2015-10-09 16:25:17 +03:00
Michael Bogdanov
7fe71d21f3 Initialize class companion object fields on accessing its java class 2015-10-09 16:25:16 +03:00
Michael Bogdanov
60d1736b97 Instance field generation in objects 2015-10-09 16:25:16 +03:00
Michael Bogdanov
53ced57c42 Annotations.EMPTY replaced with Annotations.Companion.getEMPTY() in java classes 2015-10-09 16:25:15 +03:00
Michael Bogdanov
12afbffb09 Copy to interface just companion object public const properties 2015-10-09 16:25:15 +03:00
Michael Bogdanov
a9aa2bc147 Interface companion object backing fields become static 2015-10-09 16:25:14 +03:00
Nikolay Krasko
8f20595e8c Disable plugin updater check in tests 2015-10-09 16:14:27 +03:00
Natalia Ukhorskaya
391af972d7 CodeFragments: do not add imports from context file 2015-10-09 15:10:03 +03:00
Zalim Bashorov
e9b138557b Report error when try to access to static field which come from many sources 2015-10-09 15:00:59 +03:00
Denis Zharkov
da00ddfc3e Filter out UnsafeVariance annotation when it sticks after substitution 2015-10-09 14:40:34 +03:00
Denis Zharkov
888f8cc548 Adjust stdlib to contains* transformation 2015-10-09 14:40:34 +03:00
Denis Zharkov
14f93a88c4 Adjust rendered collections desciptors to contains* transformation 2015-10-09 14:40:34 +03:00
Denis Zharkov
e9cd9db2a7 Adjust testData after contains transformation 2015-10-09 14:40:34 +03:00
Denis Zharkov
35783f129b Generate INSTANCEOF barrier in bridges for Collection.contains 2015-10-09 14:40:33 +03:00
Denis Zharkov
80da320c2c Customize JVM signature for Collection's members
- Do not write signature for `contains`
- Write signature for `containsAll` as it's declared like `containsAll(Collection<?>)`
2015-10-09 14:40:33 +03:00
Denis Zharkov
1f52dfccdb Setup specific loading contains/containsAll from java
If they override Kotlin collection members

contains(Object) -> contains(E)
containsAll(Collection<?>) -> containsAll(Collection<E>)
2015-10-09 14:40:33 +03:00
Denis Zharkov
d27d3950fb Refine signature for Collection.contains/containsAll 2015-10-09 14:40:33 +03:00
Denis Zharkov
521e958f6d Serialize type annotations in builtins 2015-10-09 14:40:33 +03:00
Denis Zharkov
e800be18c6 Introduce UnsafeVariance annotation 2015-10-09 14:40:33 +03:00
Nikolay Krasko
013b257347 Make it possible to get diagnostics factory was registered for 2015-10-09 14:15:09 +03:00
Nikolay Krasko
efaa1d9614 Minor: add factory info into toString() for diagnostics 2015-10-09 14:15:08 +03:00
Nikolay Krasko
a2ba1d762d Fix spelling in error message (KT-9475)
#KT-9475 Fixed
2015-10-09 14:15:07 +03:00
Dmitry Jemerov
07332106a5 Gradle plugin build fixed 2015-10-09 12:57:02 +02:00
Dmitry Jemerov
a54e49aedd Maven build fixed 2015-10-09 12:43:00 +02:00
Michael Bogdanov
7cdc3d8dd9 Fix test data 2015-10-09 13:03:01 +03:00
Natalia Ukhorskaya
ccbb015606 Completion for evaluate expression: add only imports from code fragment to scope when analyzing it 2015-10-09 12:58:39 +03:00
Dmitry Jemerov
7e2c2ef678 restore compilation after rebase of dropping external annotations; fix affected tests 2015-10-09 11:52:02 +02:00
Alexander Udalov
c41aefe2cb Drop JVMConfigurationKeys.ANNOTATIONS_PATH_KEY and external annotations in CLI
CoreExternalAnnotationsManager is moved to the only usage left, which is in the
test
2015-10-09 11:52:00 +02:00
Alexander Udalov
b0a4e812e5 Drop ConfigurationKind.JDK_AND_ANNOTATIONS, JetTestUtils.getJdkAnnotationsJar() 2015-10-09 11:51:59 +02:00
Alexander Udalov
448b3f6195 Rename testData/codegen/boxWithStdlib/{jdkAnnotations -> jdk} 2015-10-09 11:51:58 +02:00
Alexander Udalov
13c54a2678 Drop external annotations support in build tools
External annotations will only be considered in the IDE for additional
inspections based on more precise types in Java libraries
2015-10-09 11:51:58 +02:00
Svetlana Isakova
f2efd30a5d Added 'NoInfer' and 'Exact' annotations 2015-10-09 11:05:52 +03:00
Svetlana Isakova
9b1030de2e Annotations on type projection belong to type reference 2015-10-09 11:05:52 +03:00
Svetlana Isakova
63d9e287b7 Converted JetTypeReference to Kotlin 2015-10-09 11:05:52 +03:00
Svetlana Isakova
d8e7dccc90 Rename JetTypeReference .java -> .kt 2015-10-09 11:05:51 +03:00
Dmitry Jemerov
d6ea701901 use IDEA 15 UI for "Show expression type" 2015-10-08 19:59:25 +02:00
Dmitry Jemerov
d8122e835e dead code deleted 2015-10-08 19:58:00 +02:00
Dmitry Jemerov
3c93824e16 mark JS features as experimental in the UI 2015-10-08 19:57:59 +02:00
Valentin Kipyatkov
b29267ff93 "Single instance only" for IDEA run configurations 2015-10-08 20:36:18 +03:00
Zalim Bashorov
c8f54b3ccb Fix the accessing to static field from Parent through Child 2015-10-08 19:33:29 +03:00
Zalim Bashorov
ae2831338b Load Java static members from parents 2015-10-08 19:33:29 +03:00
Yan Zhulanow
d90585624f Add 'DeprecationLevel' parameter to 'Deprecated' 2015-10-08 18:31:08 +03:00
Yan Zhulanow
fd3c28c950 Forbid Foo<T>.Bar 2015-10-08 18:31:07 +03:00
Yan Zhulanow
937d1913b8 Automatically put 'operator' modifier on appropriate Java methods 2015-10-08 18:31:07 +03:00
Yan Zhulanow
2c848b8bb0 Add JvmSynthetic annotation 2015-10-08 18:31:06 +03:00
Yan Zhulanow
9eeb89a6aa Rename sparam to setparam 2015-10-08 18:31:06 +03:00
Yan Zhulanow
e85d76f9cc Parse ;; as a single token 2015-10-08 18:31:05 +03:00
Yan Zhulanow
8d5cbeeab0 Fix "not initialized" on lateinit property (KT-9369) 2015-10-08 18:31:05 +03:00
Yan Zhulanow
aa573c2e31 Report more specific error on primitive type property (KT-9358) 2015-10-08 18:31:04 +03:00
Yan Zhulanow
e6c0d4692a Fix operator warning on 'Constr()()' 2015-10-08 18:31:04 +03:00
Mikhail Glukhikh
7e4fbfaa6d Exposed visibility: warning messages changed 2015-10-08 18:25:37 +03:00
Mikhail Glukhikh
e99a070a2e Refactoring: decomposition of checkExposed... methods 2015-10-08 18:25:31 +03:00
Dmitry Jemerov
7abc29cff6 fix 'where' clause in IDEA plugin code 2015-10-08 17:09:58 +02:00
Dmitry Jemerov
45d1129dbb quickfix to move type constraint to 'where' clause 2015-10-08 17:09:58 +02:00
Dmitry Jemerov
4c4030dfc1 disallow putting type parameter constraints both in type parameter list and in 'where' clause 2015-10-08 17:09:57 +02:00
Dmitry Petrov
51225d3556 Test for KT-9430: proper visibility of protected members of base class
in child classes
2015-10-08 18:08:52 +03:00
Ilya Gorbunov
b6caedbc82 Add operator to Comparable.rangeTo 2015-10-08 17:48:49 +03:00
Ilya Gorbunov
e09c0ae2ff Rename toMap { selector } to toMapBy.
#KT-6657
2015-10-08 17:48:47 +03:00
Ilya Gorbunov
fd7b670414 Replace deprecated package facade ref. 2015-10-08 17:48:37 +03:00
Ilya Gorbunov
db93532e7c Deprecate merge and introduce instead zip with transform.
Add zip with transform for Strings.
2015-10-08 17:48:35 +03:00
Ilya Gorbunov
12d9beb3a4 Deprecate join (use joinToString instead)
#KT-6909
2015-10-08 17:48:33 +03:00
Sergey Mashkov
f37e022b8e IDL2K: review changes 2015-10-08 14:16:48 +03:00
Sergey Mashkov
2a0c1a997e IDL2K: support for operator modifier 2015-10-08 14:16:48 +03:00
Sergey Mashkov
4d8bd683eb IDL2K code cleanup, add to build 2015-10-08 14:16:48 +03:00
Alexey Sedunov
e8e0f2d7e1 Unused Symbol: Check descriptor before creating light class to prevent InvalidMirrorException on red code 2015-10-08 13:15:20 +03:00
Alexey Sedunov
730cc7b551 Code insight: "Generate..." actions for test framework support methods
#KT-9355 Fixed
2015-10-08 13:15:18 +03:00
Alexey Sedunov
5a325aeec0 Line Marking: Implement run markers for test classes/functions 2015-10-08 13:15:16 +03:00
Alexey Sedunov
1a36c3e29a Quick Fixes: Implement quickfix for missing library 2015-10-08 13:15:15 +03:00
Alexey Sedunov
f59e56b7e9 Minor: Simplify generateMembers() function 2015-10-08 13:15:13 +03:00
Alexey Sedunov
3c14bedc04 Minor: Move around some functions 2015-10-08 13:15:07 +03:00
Valentin Kipyatkov
84008e9381 Comment 2015-10-07 23:09:57 +03:00
Valentin Kipyatkov
cb24d3df1a Fixed JetLanguage + used better api 2015-10-07 23:09:56 +03:00
Valentin Kipyatkov
9d51e8e0e6 Added test 2015-10-07 23:09:56 +03:00
Valentin Kipyatkov
016401a2b7 Fixed test data 2015-10-07 23:09:56 +03:00
Valentin Kipyatkov
af9e66da62 Checked that "KT-7441 Smart completion does not work for argument of "this(..)" or "super(..)" call in non-primary constructor declaration" has been fixed too
#KT-7441 Fixed
2015-10-07 23:09:56 +03:00
Valentin Kipyatkov
9b0292f4c0 Fixed incorrect filtering of super constructors by visibility in Parameter Info 2015-10-07 23:09:56 +03:00
Valentin Kipyatkov
6ed7ac5285 KT-7231 Support Parameter Info inside this or super constructor calls
#KT-7231 Fixed
2015-10-07 23:09:56 +03:00
Valentin Kipyatkov
4256fb9c6e Checked that KT-9006 has been fixed
#KT-9006 Obsolete
2015-10-07 23:09:55 +03:00
Valentin Kipyatkov
b5ee84075a Do not show synthesized parameter names in Parameter Info 2015-10-07 23:09:55 +03:00
Valentin Kipyatkov
6e8be8d5af Extracted common code for detecting candidates for a Call 2015-10-07 23:09:55 +03:00
Valentin Kipyatkov
b997b3b09e No named arguments completion in brackets 2015-10-07 23:09:55 +03:00
Valentin Kipyatkov
c876759ee0 Insert ']' instead of ')' 2015-10-07 23:09:55 +03:00
Valentin Kipyatkov
fa51ca5716 KT-4977 Smart completion should work for arguments in brackets
#KT-4977 Fixed
2015-10-07 23:09:54 +03:00
Valentin Kipyatkov
ab41641a19 KT-8794 Parameter Information should work in index expression
#KT-8794 Fixed
2015-10-07 23:09:54 +03:00
Valentin Kipyatkov
9bd5f8affc Also more correct 2015-10-07 23:09:54 +03:00
Valentin Kipyatkov
e2a0cfddcd More correct? 2015-10-07 23:09:54 +03:00
Valentin Kipyatkov
a923e9e9c8 Parameter info fetches default parameter values from library sources 2015-10-07 23:09:54 +03:00
Valentin Kipyatkov
778e2f6f0b More simple and correct overload to highlight detection 2015-10-07 23:09:54 +03:00
Valentin Kipyatkov
9ba2242ea9 More simple code 2015-10-07 23:09:53 +03:00
Valentin Kipyatkov
192ce59a63 Inlined function 2015-10-07 23:09:53 +03:00
Valentin Kipyatkov
064ff5d8cc Fixed bug with local function 2015-10-07 23:09:53 +03:00
Valentin Kipyatkov
9da7f39195 Added test for update on typing 2015-10-07 23:09:53 +03:00
Valentin Kipyatkov
4865139fb1 Parameter info: update substitution on typing 2015-10-07 23:09:53 +03:00
Valentin Kipyatkov
9c1084b204 Minor 2015-10-07 23:09:53 +03:00
Valentin Kipyatkov
06a0154b75 Fixed crash 2015-10-07 23:09:52 +03:00
Valentin Kipyatkov
97d566105a Parameter info whole signature is built by information from resolve (+ changed policy for currentParameterIndex == 0) 2015-10-07 23:09:52 +03:00
Valentin Kipyatkov
b33bff89a5 Highlighting current parameter also uses resolve 2015-10-07 23:09:52 +03:00
Valentin Kipyatkov
e69cfdaaa0 Parameter info: overload "grey" status is calculated via resolve 2015-10-07 23:09:52 +03:00
Valentin Kipyatkov
eb500e0fef Minor refactoring 2015-10-07 23:09:52 +03:00
Valentin Kipyatkov
d338731734 Minor 2015-10-07 23:09:52 +03:00
Valentin Kipyatkov
f27d24e640 Parameter info to use resolve candidates instead of ReferenceVariantsHelper
#KT-6164 Fixed
 #KT-8931 Fixed
2015-10-07 23:09:51 +03:00
Valentin Kipyatkov
80bb1e7430 Inlined method 2015-10-07 23:09:51 +03:00
Valentin Kipyatkov
6c1bfdb74f No need to put ResolutionFacade into parameter info items 2015-10-07 23:09:51 +03:00
Valentin Kipyatkov
488e6f7458 Refactoring code 2015-10-07 23:09:51 +03:00
Valentin Kipyatkov
058f41a28b Renamed class 2015-10-07 23:09:51 +03:00
Valentin Kipyatkov
0651ec5265 Converted JetFunctionParameterInfoHandler to Kotlin 2015-10-07 23:09:50 +03:00
Ilya Gorbunov
73b8ef7a1f Replace KotlinPackage legacy facade with corresponding package parts in DebuggerUtils.java 2015-10-07 22:36:54 +03:00
Ilya Gorbunov
a8830b5816 sortedByDescending { key } instead of sortedBy { -key } 2015-10-07 22:36:52 +03:00
Ilya Gorbunov
17fc1d9562 Do not sort twice 2015-10-07 22:36:50 +03:00
Ilya Gorbunov
352ac58ba5 Fix testData/js: replace deprecated usages: times, sortBy, reverse, splitBy. 2015-10-07 22:36:48 +03:00
Ilya Gorbunov
1c416ae5f3 Fix testData/intentions: replace deprecated reverse usages. 2015-10-07 22:36:47 +03:00
Ilya Gorbunov
782f41580e Fix testData/debugger stepping: replace deprecated withIndices and sortBy usages. 2015-10-07 22:36:45 +03:00
Ilya Gorbunov
43a74e575e Fix testData/codegen: replace deprecated sort usages. 2015-10-07 22:36:43 +03:00
Ilya Gorbunov
c54ffe39b1 Drop deprecated API: String operations. 2015-10-07 22:36:41 +03:00
Ilya Gorbunov
6565989a61 Drop deprecated API: Comparators 2015-10-07 22:36:40 +03:00
Ilya Gorbunov
0df3d37f88 Drop deprecated API. 2015-10-07 22:36:38 +03:00
Ilya Gorbunov
0b88801c66 Drop deprecated sorting and reversing methods. 2015-10-07 22:36:36 +03:00
Ilya Gorbunov
e54db8cd2a Drop deprecated sequence() and withIndices() 2015-10-07 22:36:34 +03:00
Ilya Gorbunov
1c79cf2b51 Replace KotlinPackage legacy facade with corresponding package parts. 2015-10-07 22:36:32 +03:00
Ilya Gorbunov
fa491c8f1f Replace IoPackage legacy facade with corresponding package parts. 2015-10-07 22:36:31 +03:00
Ilya Gorbunov
90e5ee8a7e Replace KotlinPackage legacy facade with corresponding package parts. 2015-10-07 22:36:29 +03:00
Ilya Gorbunov
80e4ba8712 Replace splitBy with split 2015-10-07 22:36:27 +03:00
Ilya Gorbunov
25df3aac11 Replace parent with parentFile, relativePath with relativeTo 2015-10-07 22:36:25 +03:00
Ilya Gorbunov
3106458cc4 Replace assert with lazy assert, times with repeat. 2015-10-07 22:36:23 +03:00
Ilya Gorbunov
c1ba30b4bc Replace fails with assertFails 2015-10-07 22:36:21 +03:00
Ilya Gorbunov
ec416c5210 Replace identityEqulas with === 2015-10-07 22:36:20 +03:00
Ilya Gorbunov
b50c106648 Replace reverse with reversed or asReversed. 2015-10-07 22:36:18 +03:00
Ilya Gorbunov
37a0347669 Replace sort with sorted. 2015-10-07 22:36:16 +03:00
Ilya Gorbunov
389ea1b230 Do not suppress kotlin warnings. 2015-10-07 22:36:14 +03:00
Ilya Gorbunov
73e41fb216 StdLib cleanup: remove unused imports 2015-10-07 22:36:13 +03:00
Ilya Gorbunov
c6caa67cfb StdLib cleanup: replace KeyMissingException with NoSuchElementException.
Remove KeyMissingException from testData
2015-10-07 22:36:11 +03:00
Ilya Gorbunov
ff69b97030 StdLib cleanup: deprecated usages 2015-10-07 22:36:09 +03:00
Ilya Gorbunov
70d064052b StdLib cleanup: get rid of platformName and platformStatic usages 2015-10-07 22:36:07 +03:00
Ilya Gorbunov
404b228954 StdLib cleanup: replace fails with assertFails 2015-10-07 22:36:06 +03:00
Yan Zhulanow
c39327dd74 Fix tests for 'infix' 2015-10-07 21:56:07 +03:00
Dmitry Jemerov
401b1e56c0 assorted updates to the readme 2015-10-07 20:52:55 +02:00
Ilya Chernikov
6a7c5e1576 Reducing overhead of rpc callbacks by 1) subsampling cancelled status check (had severe impact), and 2) using buffered remote message streams (had less but still noticeable impact) 2015-10-07 19:55:06 +02:00
Ilya Chernikov
e27abe2f03 Caching daemon connection in JPS, additional logging and minor perf measurements refactoring
# Conflicts:
#	jps-plugin/src/org/jetbrains/kotlin/compilerRunner/KotlinCompilerRunner.kt
2015-10-07 19:55:05 +02:00
Ilya Chernikov
50f482e50f Fixing problem of hanging wait for jps process in idea by using a native-platform lib for platform-specific daemon execution
Adding native-platform uberjar contents to kotlin jps plugin jar
2015-10-07 19:55:04 +02:00
Ilya Chernikov
6848628f4a Creating a test simulating idea-jps-daemon processes, that should now fail on windows, some refactorings in the daemon client to simplify test writing 2015-10-07 19:55:04 +02:00
Ilya Chernikov
99b638a58b Adding support for JS compilation on daemon 2015-10-07 19:55:03 +02:00
Ilya Chernikov
391c292b8d Merging callback services into single facade - phase 2 - rewriting interfaces and implementations 2015-10-07 19:55:03 +02:00
Ilya Chernikov
0f33633cc5 Merging callback services into single facade - phase 1 - rearranging interfaces and implementations into target files 2015-10-07 19:55:02 +02:00
Ilya Chernikov
be66c24467 Extracting performance measuring utils into mini-framework, implement measurements of the rpc time, adding more measurements to performance logging, minor refactorings 2015-10-07 19:55:01 +02:00
Natalia Ukhorskaya
7e356354e0 Debugger: fix breakpoints in files with JvmName annotation
Drop unnessecary logic about part classes with hashcodes
#KT-9480 Fixed
2015-10-07 20:30:00 +03:00
Natalia Ukhorskaya
11ea5f28e8 Debugger: location.sourceName could throw InternalError if codeIndex isn't valid 2015-10-07 20:29:59 +03:00
Natalia Ukhorskaya
7776aa77c8 Completion for codeFragments: do not add runtime types variants if receiver type is the same as runtime type because they are already added by regular completion 2015-10-07 20:29:58 +03:00
Natalia Ukhorskaya
6fc8a16dd5 Completion for codeFragments: do not show java getters/setters at first completion 2015-10-07 20:29:57 +03:00
Natalia Ukhorskaya
9d7585207c Completion for codeFragments: no duplicates for synthetic properties 2015-10-07 20:29:56 +03:00
Natalia Ukhorskaya
9f96de3f7b Compare descriptors by topmost override 2015-10-07 20:29:56 +03:00
Natalia Ukhorskaya
17816002cc Minor: fix warnings 2015-10-07 20:29:55 +03:00
Natalia Ukhorskaya
a2d3607b5b J2K: Generate assert with lambda
#KT-9191 Fixed
2015-10-07 20:29:54 +03:00
Mikhail Glukhikh
0cc861f00b Exposed visibility checking, a set of exposed visibility tests, some test fixes
Effective visibility mechanism introduced.
Local is considered as public, java protected as Kotlin protected, java package private as Kotlin private.
2015-10-07 20:15:16 +03:00
Michael Bogdanov
fa32aa2950 SYNTHETIC flag for internal members 2015-10-07 18:10:56 +03:00
Michael Bogdanov
a2455aab7a Pull up refactoring update 2015-10-07 18:10:55 +03:00
Michael Bogdanov
264d7da450 PACKAGE_VISIBILITY normalization chaged to PROTECTED 2015-10-07 18:10:55 +03:00
Michael Bogdanov
882f6113dc Initial internal member mangling 2015-10-07 18:10:54 +03:00
Michael Bogdanov
306ac73eb7 Actual KotlinCompilerAdapter conversion 2015-10-07 18:10:53 +03:00
Michael Bogdanov
bf18a7647a KotlinCompilerAdapter.java->KotlinCompilerAdapter.kt 2015-10-07 18:10:53 +03:00
Yan Zhulanow
1b01e7a85a Fix tests ('infix') 2015-10-07 15:50:23 +03:00
Yan Zhulanow
7e8674c6ee Fix resolve (members/extensions with 'infix' has higher priority) 2015-10-07 15:49:50 +03:00
Yan Zhulanow
d28ecc2316 Mark builtins and stdlib functions with 'infix' 2015-10-07 15:49:29 +03:00
Yan Zhulanow
1238e93b9f Diagnostics on 'infix' (declaration&use site) 2015-10-07 15:49:28 +03:00
Mikhail Glukhikh
fff434d377 data + open / inner / abstract / sealed are now forbidden 2015-10-07 15:13:14 +03:00
Mikhail Glukhikh
3725ef8cdf Open / data forbidden code fix (eval4j) 2015-10-07 15:13:11 +03:00
Mikhail Glukhikh
b79c1435a3 Open / data forbidden: SMAP fixes 2015-10-07 15:13:09 +03:00
Svetlana Isakova
efb23be367 Open / data forbidden: ConstraintPosition fix 2015-10-07 14:41:42 +03:00
Mikhail Glukhikh
7331eec817 override is forbidden inside annotations 2015-10-07 11:57:41 +03:00
Mikhail Glukhikh
c07f0e9602 private / internal / protected are forbidden in annotations 2015-10-07 11:57:39 +03:00
Mikhail Glukhikh
cba6870f52 protected & internal are now forbidden in interfaces 2015-10-07 11:57:14 +03:00
Mikhail Glukhikh
5f43628f1b Abstract data is forbidden: Idea module infos fixed 2015-10-07 11:57:02 +03:00
Mikhail Glukhikh
67755d7dca Protected / final are deprecated in interfaces: scopes and call translator 2015-10-07 11:49:45 +03:00
Mikhail Glukhikh
49a420e3f9 Build fixed (deprecated protected in interface) 2015-10-07 11:48:37 +03:00
Mikhail Glukhikh
846d7cac69 protected is deprecated inside objects and forbidden inside annotations and enum entries 2015-10-07 10:21:11 +03:00
Mikhail Glukhikh
407d46baad Protected in object deprecated: overriders search fix 2015-10-07 10:17:47 +03:00
Mikhail Glukhikh
c77d0b9cce No protected inside object: performance counter fixed 2015-10-07 10:17:44 +03:00
Mikhail Glukhikh
06cd19dd0d Open / data forbidden: AnalysisResult fix 2015-10-07 10:17:41 +03:00
Mikhail Glukhikh
5e6c9f1979 Internal is deprecated in interfaces: reflection fix 2015-10-07 10:17:38 +03:00
Mikhail Glukhikh
434a318439 Typo fixed 2015-10-07 10:17:35 +03:00
Denis Zharkov
6a1566a6dc Make JVM backend work with Collection.size as val
0. Such properties are called special because their accessor JVM name differs from usual one
1. When making call to such property, always choose special name
2. When generating Kotlin class inheriting such property generate `final bridge int size() { return this.getSize(); }`
3. If there is no `size` declaration in current class generate `bridge int getSize() { // super-call }`
2015-10-07 08:46:35 +03:00
Denis Zharkov
252c82abe3 Generate bridges for FAKE_OVERRIDE properties
The same way it's done for function, just call generateBridges for accessors

 #KT-9442 Fixed
2015-10-07 08:46:34 +03:00
Denis Zharkov
c21d827326 Adjust various testData to size transformation 2015-10-07 08:46:34 +03:00
Denis Zharkov
a0e9754edc Adjust js collections to size transformation 2015-10-07 08:46:33 +03:00
Denis Zharkov
e52e6cf869 Temporary make SmartSet less smart
SmartSet is compiled both with bootstrap and new compiler, so it can't
implement both old and new Set interfaces (with 'size' as function and as property).

This commit should be reverted after bootstraping
2015-10-07 08:46:33 +03:00
Denis Zharkov
61416b3d14 Adjust stdlib to size transformation 2015-10-07 08:46:27 +03:00
Denis Zharkov
7b432e4830 Introduce size() extensions for migrational purposes 2015-10-06 23:56:17 +03:00
Denis Zharkov
547aa2cda6 Load special java methods as properites
Currently only those that override special builtin properties (e.g. `Collection.size`)
Their modality is defined by method's modality
2015-10-06 23:56:17 +03:00
Denis Zharkov
a02b64f0e3 Setup overridability rules for properties built on Java fields
- They overrides each other
- They do not overrides Kotlin propeties and vice versa
2015-10-06 23:56:17 +03:00
Denis Zharkov
dfe93406d9 Minor. Inline parameter 2015-10-06 23:56:17 +03:00
Denis Zharkov
27b231cd7d Minor. Do not record method within resolveMethodToFunctionDescriptor 2015-10-06 23:56:17 +03:00
Denis Zharkov
9d087ce5bd Convert size() functions in builtins to properties
Just like it will work itself out :)
2015-10-06 23:56:17 +03:00
Nikolay Krasko
a4d029dab2 Rename ant tasks for continuous builds: unify suffixes with correspondent branches 2015-10-06 20:51:43 +03:00
Ilya Gorbunov
0851728454 Deprecate mapNotNull to change its behavior later.
#KT-4410
2015-10-06 18:32:06 +03:00
Ilya Gorbunov
d7da8b7bd3 J2K: Special conversion for java.lang.String methods.
#KT-7732
2015-10-06 18:24:24 +03:00
Dmitry Jemerov
4b92bd100c add space between property type parameter list and property name 2015-10-06 16:20:48 +02:00
Dmitry Jemerov
1fdf08bec5 quickfix to migrate function type parameter lists to new syntax 2015-10-06 16:20:48 +02:00
Dmitry Jemerov
7c20630272 diagnostics for deprecated syntax of function type parameter list 2015-10-06 16:20:47 +02:00
Dmitry Jemerov
c5d3673b6b change the ID of the language from "jet" to "kotlin"; rename JetLanguage to KotlinLanguage 2015-10-06 16:14:07 +02:00
Dmitry Jemerov
870b640008 "add operator modifier" fix handles fake overrides
#KT-9347 Fixed
2015-10-06 16:12:09 +02:00
Dmitry Jemerov
8fd9d181de add @suppress to the list of known KDoc tags
#KT-9415 Fixed
2015-10-06 16:12:08 +02:00
Dmitry Jemerov
2884a1c6ea handle semicolons in "introduce backing property"
#KT-9417 Fixed
2015-10-06 16:12:08 +02:00
Pavel V. Talanov
3ed04aea8a Imports from objects: Do not create new instances on getOriginal every time
Also fixes a problem where DeclarationLookupObjectImpl didn't have stable hashCode
2015-10-06 16:31:23 +03:00
Pavel V. Talanov
508b401603 Codegen: fix callable reference to member imported from object 2015-10-06 16:31:22 +03:00
Pavel V. Talanov
37d5c4b223 Allow to import members from object by name
Wrap object members so they do not require dispatch receiver
Hack jvm backend to make it work
2015-10-06 16:31:21 +03:00
Pavel V. Talanov
507293e1ff QualifiedExpressionResolver, minor: extract a couple of functions 2015-10-06 16:31:20 +03:00
Nikolay Krasko
ca2c78e629 Refactoring: remove warnings about javaClass() call 2015-10-06 14:00:23 +03:00
Nikolay Krasko
05cf67049c Allow roots before parent setup and disallow after teardown 2015-10-06 14:00:20 +03:00
Nikolay Krasko
d999000705 Minor: fix warning about annotation absence 2015-10-06 14:00:18 +03:00
Dmitry Petrov
4a3f53b322 Revert fbf2424838:
postpone "transparent semantics for spread operator"
until Java-related design issues are resolved (java.utils.Arrays#asList).
2015-10-06 13:48:59 +03:00
Dmitry Petrov
fbf2424838 Spread should always copy arrays. 2015-10-06 10:07:12 +03:00
Dmitry Petrov
9e546bda27 Support is/as/as? with Function[K]<...> types. 2015-10-06 10:06:27 +03:00
Ilya Gorbunov
e1d53a2843 kotlin-jdbc can be found in its own repository: https://github.com/kotlin-projects/kotlin-jdbc 2015-10-05 21:28:09 +03:00
Ilya Gorbunov
b081535bb6 kotlin-swing can be found in its own repository: https://github.com/kotlin-projects/kotlin-swing 2015-10-05 21:27:31 +03:00
Stanislav Erokhin
b69197962d KT-9461: Inference failed: type parameter fixed early
#KT-9461 Fixed
2015-10-05 20:32:44 +03:00
Nikolay Krasko
493108eca1 Change default visibility icon for declaration with absent modifier to public (KT-9411)
#KT-9411 Fixed
2015-10-05 16:09:46 +03:00
Nikolay Krasko
cb510a6809 Don't pack version of libraries into compiler artifact 2015-10-05 16:09:45 +03:00
Valentin Kipyatkov
45748eb169 More correct check for ResolvedCall status everywhere in the IDE + added assert into ResolvedCallImpl 2015-10-05 15:39:08 +03:00
Valentin Kipyatkov
110d53b4a6 No setter parameter type required 2015-10-05 15:35:17 +03:00
Valentin Kipyatkov
596635270e J2K: more correct comment placement 2015-10-05 15:35:17 +03:00
Valentin Kipyatkov
1fb01dcfbb Minor correction 2015-10-05 15:35:17 +03:00
Valentin Kipyatkov
ec685195bd Better tests 2015-10-05 15:33:50 +03:00
Valentin Kipyatkov
7b063d0391 Completion: lower priority for override member items
#KT-9403 Fixed
2015-10-05 15:33:50 +03:00
Valentin Kipyatkov
c5fdd649ab Overrides completion on typing member name too
#KT-9431 Fixed
2015-10-05 15:33:49 +03:00
Valentin Kipyatkov
fd6244ac51 Never take ExpectedInfo from outer expression "as is" 2015-10-05 15:33:49 +03:00
Valentin Kipyatkov
da7c62e788 Refactored 2015-10-05 15:33:48 +03:00
Valentin Kipyatkov
a75b3e6cf1 Auto-import popup does not suggest to import non-operator functions when operator required 2015-10-05 15:33:48 +03:00
Valentin Kipyatkov
b03a297ed0 KT-9326 IDE tries to resolve name in qualified this to any class in project/classpath
#KT-9326 Fixed
2015-10-05 15:33:47 +03:00
Valentin Kipyatkov
dda9476793 Additional safety check to not corrupt PSI tree (see KT-9122) 2015-10-05 15:33:47 +03:00
Valentin Kipyatkov
1bb6dae444 Auto-import fix should suggest declarations that cannot be used in this position
This also should fix KT-9122 Assertion error when psi modified from IDE

 #KT-9122 Fixed
2015-10-05 15:33:46 +03:00
Valentin Kipyatkov
ab5fe60bbe Corrected quickfix class name in tests 2015-10-05 15:33:45 +03:00
Valentin Kipyatkov
2ae13ed76b KT-9380 Handle malformed ReplaceWith annotations gracefully
#KT-9380 Fixed
2015-10-05 15:33:45 +03:00
Valentin Kipyatkov
45c3d74b42 KT-9284 Intention to convert to expression body doesn't work in particular case
#KT-9284 Fixed
2015-10-05 15:33:44 +03:00
Dmitry Jemerov
94204b7d4e Kotlin plugin updater initial implementation 2015-10-05 12:42:55 +02:00
Michael Nedzelsky
483110332c fix KT-431 Prohibit safe calls on namespaces, super etc
#KT-431 Fixed
2015-10-05 13:14:42 +03:00
Natalia Ukhorskaya
5848ea8d77 Fix usage of deprecated function in debugger testData 2015-10-05 11:44:58 +03:00
Natalia Ukhorskaya
dc7ced1581 JDIEval: fix ClassNotLoadedException 2015-10-05 11:44:50 +03:00
Alexander Udalov
d83ed11cd9 Add "add type to callable reference LHS" quickfix to Code Cleanup 2015-10-05 09:18:48 +03:00
Alexander Udalov
b47982a0a6 Write new protobuf messages for packages as well as classes
An addition to ad735cd
2015-10-05 09:08:51 +03:00
Ilya Gorbunov
ca18613049 J2K: Special conversion for java.lang.String.replaceAll.
#KT-7732
2015-10-05 01:54:21 +03:00
Ilya Gorbunov
36f854e421 Correct replacement for platformName annotation. 2015-10-05 01:54:16 +03:00
Michael Bogdanov
21b603af8f FunctionReferenceGenerationStrategy fake resolved call refactoring 2015-10-03 10:53:24 +03:00
Michael Bogdanov
cd78514b76 Code clean, small refactorings and tests
#KT-8987 Fixed
2015-10-03 10:53:22 +03:00
Michael Bogdanov
3806ad65fc Fixed error with wrong parameter size calculation 2015-10-03 10:53:21 +03:00
Michael Bogdanov
466b20b0fc Parameters refactoring 2015-10-03 10:53:20 +03:00
Michael Bogdanov
1900ddd020 Parametrs.java->Parameters.kt 2015-10-03 10:53:19 +03:00
Michael Bogdanov
2a19b06874 new tests 2015-10-03 10:53:18 +03:00
Michael Bogdanov
c83a5b8bd5 Proper param propagation in inline 2015-10-03 10:53:17 +03:00
Michael Bogdanov
79fce388b3 Actual conversion ParametersBuilder.java->ParametersBuilder.kt 2015-10-03 10:53:16 +03:00
Michael Bogdanov
345b21b3eb ParametersBuilder.java->ParametersBuilder.kt 2015-10-03 10:53:15 +03:00
Michael Bogdanov
03158ed9c3 ParameterBuilder refactoring 2015-10-03 10:53:14 +03:00
Michael Bogdanov
85f7c174cd First implementation of proper agrument order 2015-10-03 10:53:13 +03:00
Michael Bogdanov
1f2b9ce72b Addded DefaultCallMask class and extended interface for argument generation 2015-10-03 10:53:12 +03:00
Michael Bogdanov
8104c10c5a Actual ArgumentGenerator.java convertion 2015-10-03 10:53:10 +03:00
Michael Bogdanov
c9b5753ff3 ArgumentGenerator.java->ArgumentGenerator.kt 2015-10-03 10:53:09 +03:00
Valentin Kipyatkov
cbf5be5c08 No callable reference to generic callables 2015-10-03 10:40:54 +03:00
Valentin Kipyatkov
feb4492455 No true/false for if-condition too 2015-10-03 10:40:54 +03:00
Valentin Kipyatkov
7436355c17 Fix true and false in when entry with subject broken before 2015-10-03 10:40:54 +03:00
Valentin Kipyatkov
2e02f02d9b More clear code 2015-10-03 10:40:53 +03:00
Valentin Kipyatkov
184d59a645 No shadowed declaration filtering for callable references (as well as imports) 2015-10-03 10:40:53 +03:00
Valentin Kipyatkov
d547ea9b57 Overload callable references are now supported - changed code accordingly 2015-10-03 10:40:53 +03:00
Valentin Kipyatkov
b23602237a Smart completion: no "::xxx" items for members and fixed bug with constructors not appearing there 2015-10-03 10:40:53 +03:00
Valentin Kipyatkov
b0d31fc86d Property types supported in smart completion without "::" 2015-10-03 10:40:53 +03:00
Valentin Kipyatkov
aaf507121f Refactored code: the same code for detection of callable reference type 2015-10-03 10:40:52 +03:00
Valentin Kipyatkov
1bc132bc1a No members&extensions after non-qualified "::" because it will be soon unsupported by the compiler 2015-10-03 10:40:52 +03:00
Valentin Kipyatkov
f58f5dd82a Added parameters and type text (grayed) to "::xxx" items in smart completion 2015-10-03 10:40:52 +03:00
Valentin Kipyatkov
58bcb576a1 Completion: grayed parameters and type in completion of imports and callable references (arguable) 2015-10-03 10:40:52 +03:00
Valentin Kipyatkov
ee28a170d6 Auto-popup completion after "::" 2015-10-03 10:40:52 +03:00
Valentin Kipyatkov
836d116786 Checked that import popup now works for callable references 2015-10-03 10:40:52 +03:00
Valentin Kipyatkov
e562c019f9 No "{...}" in presentation for functions in completion of imports and callable references 2015-10-03 10:40:51 +03:00
Valentin Kipyatkov
08335a2ac9 Callable reference completion for non-imported callables 2015-10-03 10:40:51 +03:00
Valentin Kipyatkov
3a2bc51445 Renamed term "classifier" to "matcher" 2015-10-03 10:40:51 +03:00
Valentin Kipyatkov
c0bfca4f89 A::class and A::class.java supported in smart completion too 2015-10-03 10:40:51 +03:00
Valentin Kipyatkov
ec5d1d3a52 Support for A::class and A::class.java in basic completion (but not in smart) 2015-10-03 10:40:51 +03:00
Valentin Kipyatkov
ebf649a681 Support for callable references in smart completion 2015-10-03 10:40:50 +03:00
Valentin Kipyatkov
3f64b25df3 Renamed tests 2015-10-03 10:40:50 +03:00
Valentin Kipyatkov
5fddefbf4d Corrected and restored test 2015-10-03 10:40:50 +03:00
Valentin Kipyatkov
1e21b0201c Renamed test folder 2015-10-03 10:40:50 +03:00
Valentin Kipyatkov
ce05434a0c Fixed extension functions being grayed in import statement completion
#KT-5627 Fixed
2015-10-03 10:40:50 +03:00
Valentin Kipyatkov
e41732e572 No callable references to synthetic extensions (and ones for get/set) 2015-10-03 10:40:50 +03:00
Valentin Kipyatkov
2471647952 Minor refactoring 2015-10-03 10:40:49 +03:00
Valentin Kipyatkov
eaec9795e5 Workaround for compiler bug 2015-10-03 10:40:49 +03:00
Valentin Kipyatkov
2760b0bdb9 Refactoring to make receiver type safe 2015-10-03 10:40:49 +03:00
Valentin Kipyatkov
c12520da7f Move 2015-10-03 10:40:49 +03:00
Valentin Kipyatkov
56bb8adfd0 Refactoring to add CallType.IMPORT_DIRECTIVE and CallType.PACKAGE_DIRECTIVE 2015-10-03 10:40:49 +03:00
Valentin Kipyatkov
d38ceb50b6 Initial support for KT-7090 Completion for callable references
#KT-7090 Fixed
2015-10-03 10:40:49 +03:00
Valentin Kipyatkov
7ee65bf41a Minor 2015-10-03 10:38:31 +03:00
Valentin Kipyatkov
72a5a68769 Dropped support for backing fields (with '$') completion 2015-10-03 10:38:31 +03:00
Alexander Udalov
7c0b3e31c7 Fix usages of callable references with empty LHS in project 2015-10-03 04:37:06 +03:00
Alexander Udalov
659826d5c3 Update reservedWords JS tests after changes to callable references 2015-10-03 04:37:05 +03:00
Alexander Udalov
012a2971ff Quick-fix to add type to LHS of incorrect callable references 2015-10-03 04:37:05 +03:00
Alexander Udalov
661f4efc68 Forbid callable references to members and extensions with empty LHS
This syntax is reserved to be likely used in the future as a shorthand for
"this::foo" where the resulting expression doesn't take the receiver as a
parameter but has "this" already bound to it
2015-10-03 04:37:04 +03:00
Alexander Udalov
f310d4c10e Don't write Kotlin metadata in light classes mode
This was already happening for classes and packages, now will also for
interface DefaultImpls and any other possible classes
2015-10-03 01:03:35 +03:00
Alexander Udalov
cb6d16d224 Advance ABI version after changes to binary format 2015-10-03 00:59:52 +03:00
Alexander Udalov
bdd69d9e46 Use internal names in multifile class metadata
To reuse the strings already existing in the constant pool of the class file
2015-10-03 00:59:34 +03:00
Alexander Udalov
e1ccb92438 Write built-in extensions to new protobuf messages 2015-10-03 00:59:34 +03:00
Alexander Udalov
8c0a86617a Write JVM signatures to new protobuf messages 2015-10-03 00:59:33 +03:00
Alexander Udalov
06a7ca5571 Minor, use existing utility for getting implClassName 2015-10-03 00:59:33 +03:00
Alexander Udalov
4f21caecc4 Simplify AnnotationAndConstantLoader, use NameResolver from ProtoContainer 2015-10-03 00:59:32 +03:00
Alexander Udalov
3a7a48a079 Minor, add nameResolver to ProtoContainer 2015-10-03 00:59:32 +03:00
Alexander Udalov
14ec34e37c Refactor annotation and constant loader, simplify, drop some useless checks 2015-10-03 00:59:31 +03:00
Alexander Udalov
ad735cd788 Split ProtoBuf.Callable to three messages: constructor, function, property
Serialize both at the moment, will drop the old one after bootstrap
2015-10-03 00:59:30 +03:00
Alexander Udalov
041af28166 Deprecate and don't write KotlinClass$Kind, to be removed later 2015-10-03 00:59:30 +03:00
Alexander Udalov
056bb3f833 Deprecate and don't write KotlinSyntheticClass$Kind, to be removed later 2015-10-03 00:59:28 +03:00
Alexander Udalov
5bb47c8365 Write KotlinInterfaceDefaultImpls annotation to DefaultImpls classes
Instead of KotlinSyntheticClass with kind = TRAIT_IMPL
2015-10-03 00:58:52 +03:00
Alexander Udalov
e4090d3f30 Cleanup descriptors.proto, regenerate
- move enums and messages nested in Callable to top level, since they're likely
  to be reused in other messages soon
- delete obsolete comments: some did not any value, some became obsolete with
  custom options ("id in StringTable" -> name_id_in_table)
2015-10-02 20:30:55 +03:00
Dmitry Petrov
b09e727462 Update ideaVersion to 142.5239.7. 2015-10-02 19:07:30 +03:00
Nikolay Krasko
e4ac217e46 Update idea-continuous branches
- abandon 142 branch
 - introduce 143 and 144 branches
2015-10-02 18:23:42 +03:00
Nikolay Krasko
6b6a6d98b7 Add additional line which shouldn't be modified after commenting in other branches to make git auto-merge possible 2015-10-02 18:23:41 +03:00
Dmitry Petrov
1f69ae254d KT-9377 Support is-checks for read-only collections
Additional tests.
2015-10-02 15:17:00 +03:00
Dmitry Petrov
06d9ff6a71 KT-9377 Support is-checks for read-only collections
Generate better code for 'as?' with mutable collection types:
use CHECKCAST, do not introduce special intrinsics for safe-as.
2015-10-02 15:17:00 +03:00
Dmitry Petrov
e033d093d4 KT-9377 Support is-checks for read-only collections
Reorganize marker interfaces and is/as/as? intrinsics.
2015-10-02 15:17:00 +03:00
Dmitry Petrov
6cb0e5151c KT-9377 Support is-checks for read-only collections
Intrinsics for is/as/as? with mutable Kotlin collections and related types.
2015-10-02 15:17:00 +03:00
Dmitry Petrov
35881198c3 KT-9377 Support is-checks for read-only collections
Marker interfaces for mutable Kotlin collections and related classes.
2015-10-02 15:17:00 +03:00
Michael Bogdanov
e91c556d06 Fix for wrong local variable table at inlining lambda with finallies 2015-10-02 13:41:41 +03:00
Mikhail Glukhikh
8ab746d6a3 J2K: visibility modifiers are no more applicable to local classes 2015-10-02 12:52:57 +03:00
Dmitry Jemerov
4ee1b4da84 fix compilation 2015-10-01 20:04:07 +02:00
Dmitry Jemerov
7bc3161e2f "Rename" quickfix for underscore identifiers 2015-10-01 19:19:23 +02:00
Dmitry Jemerov
983de529ed add missing read actions to overriders search
#KT-9147 Fixed
2015-10-01 19:17:24 +02:00
Dmitry Jemerov
4070ba13cd when getting a descriptor for a PsiMethod, also check that it has a valid name (KT-9174)
#KT-9174 Fixed
2015-10-01 19:17:24 +02:00
Dmitry Jemerov
e70f88c67f don't create editor in air if we can't find an editor for the element (EA-72968 - TDDE: TraceableDisposable.throwDisposalError) 2015-10-01 19:17:23 +02:00
Dmitry Jemerov
4f56821101 Java sometimes asks us to find usages of a method with no containing class; don't crash on this (EA-73362 - assert: JavaMemberImpl.getContainingClass) 2015-10-01 19:17:23 +02:00
Dmitry Jemerov
49eace61c9 don't report exception if trying to update jar to the same file (this can happen if the version of the plugin is different from the version of the runtime it bundles; in that case, we've already messed up and there is no value in spamming EA with exceptions) (EA-73451 - IAE: KotlinRuntimeLibraryUtil.replaceFile) 2015-10-01 19:17:22 +02:00
Dmitry Jemerov
5c93e25e67 remove dead code 2015-10-01 19:17:21 +02:00
Dmitry Jemerov
9c6f206606 don't try to get the parent of an empty FQ name (EA-73459 - ISE: FqName.parent)
#KT-9162 Fixed
2015-10-01 19:17:21 +02:00
Sergey Mashkov
c9843f6387 Downgrade maven-bundle-plugin to build against Java 6 2015-10-01 18:22:28 +03:00
Pavel V. Talanov
caefb2cf50 Adjust test data for converter test
Due to type inference change
2015-10-01 17:53:20 +03:00
Pavel V. Talanov
c19b8353d0 Minor, tests: remove some static accesses to builtIns 2015-10-01 17:53:20 +03:00
Pavel V. Talanov
a3fbf2fabc Test that primitives, arrays, enums are implicitly serializable on jvm and not js
Specifically test calling java function that accepts java.io.Serializable
2015-10-01 17:53:19 +03:00
Pavel V. Talanov
7b49baf8c3 Test data adjustment: JetDiagnosticsTest 2015-10-01 17:53:19 +03:00
Pavel V. Talanov
bc8449a70c Test data adjustment: Resolved calls and constraint system test 2015-10-01 17:53:18 +03:00
Pavel V. Talanov
41c0895abb JetExtractionTest: adjust test data
after making some of builtin types serializable
2015-10-01 17:53:17 +03:00
Pavel V. Talanov
e263c85142 JetTypeChecker: adjust test data
after making some of builtin types serializable
2015-10-01 17:53:17 +03:00
Pavel V. Talanov
1f36b7fbea Extract FunctionPlaceholders from ErrorUtils to a separate component since they are not really an error 2015-10-01 17:53:16 +03:00
Pavel V. Talanov
d5624708fb Add "java.io.Serializable" as supertype to java builtIns mapped to classes that are serializable on jvm
Implementation is hacky, relies on adding fictional supertype to corresponding classes
2015-10-01 17:53:16 +03:00
Pavel V. Talanov
427c853e27 ErrorUtils return DefaultBuiltIns
This should be changed in the future by making ErrorUtils not-static
2015-10-01 17:53:15 +03:00
Pavel V. Talanov
76029ee9b2 Introduce JvmBuiltIns and DefaultBuiltIns, different instances of KotlinBuiltIns
Make KotlinBuiltIns an abstract class
JsPlatform has DefaultBuiltIns
2015-10-01 17:53:14 +03:00
Pavel V. Talanov
4b9e167fd2 Minor: move builtIns initialization into constructor 2015-10-01 17:53:14 +03:00
Pavel V. Talanov
0ae842a05d 'descriptors' module exports 'deserialization', not the other way around
Also remove some of redundantly specified dependencies
2015-10-01 17:53:13 +03:00
Pavel V. Talanov
22e3e192ee ModuleDescriptorImpl: remove KBI as default parameter 2015-10-01 17:53:12 +03:00
Pavel V. Talanov
7d1b6f4bbb GenerateOperationsMap uses builtIns from default platform 2015-10-01 17:53:12 +03:00
Pavel V. Talanov
767950fea3 Tests: Replace some usages of KotlinBuiltIns.getInstance()
In cases where platform is either unimportant or predefined in test code
2015-10-01 17:53:11 +03:00
Pavel V. Talanov
af3bb80a54 JetChangeSignatureTest: Drop usages of KotlinBuiltIns.getInstance() 2015-10-01 17:53:11 +03:00
Pavel V. Talanov
b79881848f jvm-backend, cli: Replace some usages of KotlinBuiltIns.getInstance() by JvmPlatform.builtIns 2015-10-01 17:53:10 +03:00
Pavel V. Talanov
5dd4843b5a reflection.jvm: Drop usages of KotlinBuiltIns.getInstance() 2015-10-01 17:53:09 +03:00
Pavel V. Talanov
537134613a js.translator: Drop usages of KotlinBuiltIns.getInstance() 2015-10-01 17:53:09 +03:00
Pavel V. Talanov
643cb0a5d4 js.frontend: Drop usages of KotlinBuiltIns.getInstance() 2015-10-01 17:53:08 +03:00
Pavel V. Talanov
0a2bd257a5 frontend.java: Drop usages of KotlinBuiltIns.getInstance() 2015-10-01 17:53:08 +03:00
Pavel V. Talanov
64d8baee1d DeserializerForDecompilerBase depends on TargetPlatform 2015-10-01 17:53:07 +03:00
Pavel V. Talanov
bb3028b6c9 JetSourceNavigationHelper: drop usage of KotlinBuiltIns.getInstance() 2015-10-01 17:53:07 +03:00
Pavel V. Talanov
f28a8a60c1 AllClassesCompletion: drop usage of KotlinBuiltIns.getInstance() 2015-10-01 17:53:06 +03:00
Pavel V. Talanov
3963c8b833 MemberMatching: drop usage of KotlinBuiltIns.getInstance() 2015-10-01 17:53:06 +03:00
Pavel V. Talanov
36fee381c3 BuiltInsReferenceResolver: drop usage of KotlinBuiltIns.getInstance() 2015-10-01 17:53:05 +03:00
Pavel V. Talanov
e4c0d93224 idea: Use platform extension to eliminate other usages of KotlinBuiltIns 2015-10-01 17:53:04 +03:00
Pavel V. Talanov
315809a34b Add builtIns property to TargetPlatform
Add utility to get TargetPlatform by JetElement
2015-10-01 17:53:03 +03:00
Pavel V. Talanov
51113c10b4 Drop some usages of KotlinBuiltIns.getInstance() in idea module 2015-10-01 17:53:02 +03:00
Pavel V. Talanov
f1c76f0467 extractableAnalysisUtil: Drop some usages of KotlinBuiltIns.getInstance() 2015-10-01 17:52:04 +03:00
Pavel V. Talanov
e42057c71c Drop some usages of KotlinBuiltIns.getInstance() in ide-common module 2015-10-01 17:52:04 +03:00
Pavel V. Talanov
0610dd36fa ConstantExpressionEvaluator: avoid calling KotlinBuiltIns.getInstance() 2015-10-01 17:52:03 +03:00
Pavel V. Talanov
b9da08d11c TypeIntersector: refactor it to being a static utility
Deal with intersecting empty set of types on the call site
2015-10-01 17:52:03 +03:00
Pavel V. Talanov
b85fe40275 ScriptReceiver: Remove usage of KotlinBuiltIns.getInstance() 2015-10-01 17:52:02 +03:00
Pavel V. Talanov
e35e6f7f52 JetTypeCodeFragment: Remove usage of KotlinBuiltIns.getInstance() 2015-10-01 17:52:01 +03:00
Pavel V. Talanov
b5712033a8 Make DataFlowValue.NULL not static 2015-10-01 17:52:01 +03:00
Pavel V. Talanov
a72b050d91 Pass builtIns into CompileTimeConstantChecker constructor 2015-10-01 17:52:00 +03:00
Pavel V. Talanov
9b0970e1a9 Avoid calling KotlinBuiltIns.getInstance() in DescriptorRendererImpl 2015-10-01 17:52:00 +03:00
Pavel V. Talanov
9f858cbc56 ControlStructureTypingUtils: use real module descriptor instead of error module 2015-10-01 17:51:59 +03:00
Pavel V. Talanov
7429b65c73 Try to implement some of error utils without using KotlinBuiltIns 2015-10-01 17:51:59 +03:00
Pavel V. Talanov
6780a1fe90 Make DynamicCallableDescriptors non static and remove static object DynamicType 2015-10-01 17:51:58 +03:00
Pavel V. Talanov
424d71e964 Remove reference to KotlinBuiltIns from CompanionObjectMapping
Make it a class
2015-10-01 17:51:57 +03:00
Pavel V. Talanov
d2a4235dd8 Pass KotlinBuiltIns into getExpectedTypePredicate utility 2015-10-01 17:51:56 +03:00
Pavel V. Talanov
0fc23fc426 Use new method instead of some usages of KotlinBuiltIns.getInstance() 2015-10-01 17:51:56 +03:00
Pavel V. Talanov
22c250778e Introduce TypeConstructor#getBuiltIns 2015-10-01 17:51:55 +03:00
Alexey Sedunov
896e1d8bc9 Rename: Drop 'override' keyword when renaming function/property without bases
#KT-4790 Fixed
2015-10-01 17:35:27 +03:00
Alexey Sedunov
2f251b9216 Rename: Drop 'operator' keyword if new name doesn't correspond to any convention
#KT-9357 Fixed
2015-10-01 17:35:26 +03:00
Alexey Sedunov
1f6f617546 Create from Usage: Suggest synthetic function classes as extension receivers 2015-10-01 17:35:25 +03:00
Alexey Sedunov
1d83d75a82 Create from Usage: Use function form when rendering FunctionN types
#KT-7522 Fixed
2015-10-01 17:35:24 +03:00
Alexey Sedunov
605802847a Move Declarations: Fix processing of self-references
#KT-5847 Fixed
2015-10-01 17:35:23 +03:00
Alexey Sedunov
e3d8d819da Inline Variable: Var support
#KT-5169 Fixed
2015-10-01 17:35:22 +03:00
Alexey Sedunov
007c7c17f0 Create parameter: Forbid inplace refactoring if occurrences contain out-of-parentheses lambda arguments. Fix lambda argument replacement
#KT-9307 Fixed
2015-10-01 17:35:21 +03:00
Alexey Sedunov
b805645489 Change Signature: Support receiver <-> parameter conversion for function expressions
#KT-9309 Fixed
2015-10-01 17:35:20 +03:00
Alexey Sedunov
2b354cd4db Create parameter: Look for containing function if no class is found. Support secondary constructors
#KT-9322 Fixed
2015-10-01 17:35:19 +03:00
Alexey Sedunov
78f7e6b459 Extraction Engine: Support type parameter references
#KT-7260 Fixed
2015-10-01 17:35:18 +03:00
Alexey Sedunov
aa080bf201 Create from Usage: Forbid for parameters/local variables when reference is not an identifier
#KT-9305 Fixed
2015-10-01 17:35:16 +03:00
Alexey Sedunov
0ef8281823 Parameter -> Receiver Conversion: Don't show change signature dialog
#KT-9302 Fixed
2015-10-01 17:35:15 +03:00
Alexey Sedunov
9ec87c01ab Property <-> Function Conversion: Add/remove 'get'/'is' prefixes automatically
#KT-8812 Fixed
2015-10-01 17:35:12 +03:00
Alexey Sedunov
1b9bbf0bb6 Move Declaration to Separate File: Process internal references since imports may be necessary in the new file 2015-10-01 17:35:11 +03:00
Nikolay Krasko
c2b4647aa8 Avoid storing same files in kotlin-compiler.jar for maven
#KT-9202 Fixed
2015-10-01 16:42:56 +03:00
Sergey Mashkov
a8e3ee9190 KT-6264 Introduce kotlin-osgi-bundle
The bundle is a mix of kotlin-runtime, kotlin-stdlib and kotlin-reflect. The main reason to do so intead of adding corresponding modules is that there is so called "split package" issue that couldn't be easily resolved
2015-10-01 15:37:35 +03:00
Michael Nedzelsky
0de9e8295a add tests for incremental compilation: package members 2015-10-01 15:16:30 +03:00
Michael Nedzelsky
8557e540fc incremental compilation: do not recompile on changes in private static final values. 2015-10-01 15:16:26 +03:00
Michael Nedzelsky
bc6746b9e6 add tests for comparison of package members 2015-10-01 15:16:22 +03:00
Michael Nedzelsky
c7b52bfdc1 fix KT-8977 Ignore non-public API changes for packages in incremental compilation
#KT-8977 Fixed
2015-10-01 15:16:18 +03:00
Zalim Bashorov
fca9b51548 Revert "extend test for code cleanup with changing visibility from private to internal for declarations, which are used outside of their file."
This reverts commit 9fd968d59e.
2015-10-01 14:57:26 +03:00
Zalim Bashorov
073b10072a Minor: fix testdata 2015-10-01 14:57:26 +03:00
Zalim Bashorov
9256682cc5 Fix quickfix and tests 2015-10-01 14:57:26 +03:00
Zalim Bashorov
a36e4abf4d Move visibility check for toplevel private declarations to Visibilities.PRIVATE and fix it. 2015-10-01 14:57:26 +03:00
Zalim Bashorov
94b110936e Add the ability to get containing source file from SourceElement 2015-10-01 14:37:25 +03:00
Michael Nedzelsky
c7e5eb9ab8 fix AbstractBytecodeTextTest: read expected file with UTF-8 encoding 2015-10-01 12:16:48 +03:00
Alexander Udalov
1e6f230d69 Fix "ant compiler-quick", add conditional-preprocessor 2015-10-01 02:14:25 +03:00
Alexander Udalov
34d14939f9 Fix build after change in property accessor names 2015-10-01 02:14:25 +03:00
Valentin Kipyatkov
5afa91d4ec Restored back temporarily renamed properties 2015-09-30 22:50:27 +03:00
Michael Nedzelsky
6466facffa force UTF-8 encoding in CodegenTestCase.loadFileByFullPath 2015-09-30 22:35:38 +03:00
Mikhail Glukhikh
361448de8b Rename: private / final property in trait --> in interface 2015-09-30 19:38:19 +03:00
Mikhail Glukhikh
7256a546df Visibility modifiers are no longer allowed on local classes 2015-09-30 19:38:16 +03:00
Mikhail Glukhikh
6f7d9459fa Completion for sealed class inheritors and a pair of tests 2015-09-30 19:38:14 +03:00
Mikhail Glukhikh
7a99b3872b Forbid private functions with no body and private properties in traits which are abstract by default 2015-09-30 19:38:02 +03:00
Mikhail Glukhikh
930402d910 Incorrect 'inner' usage is diagnosed by parent, not by target 2015-09-30 17:54:47 +03:00
Dmitry Jemerov
2109a6b760 advance until-build to branch 144 2015-09-30 15:40:19 +02:00
Dmitry Petrov
91214c50a6 Unify containing classes mapping for deserialized callable members. 2015-09-30 09:56:06 +03:00
Dmitry Petrov
c17326841a Inlining package members should use facade class for SMAP. 2015-09-30 09:56:05 +03:00
Dmitry Petrov
9a41ee41d7 Migrate to new storage API.
Remove IncrementalPackageFragment::getMultifileFacade.
2015-09-30 09:56:05 +03:00
Dmitry Petrov
3dfe9951ef Incremental compilation support for multifile classes. 2015-09-30 09:56:05 +03:00
Denis Zharkov
ea8ada4664 Fix accessor naming test: count only method declarations 2015-09-30 08:19:52 +03:00
Denis Zharkov
22d58239e3 Support DefaultImpls in light-classes and indices
#KT-4647 Fixed
2015-09-30 08:19:52 +03:00
Denis Zharkov
8b8fa40348 Drop tests with obsolete assumption
DefaultImpls classes are not visible in IDE no more because they are inner.
2015-09-30 08:19:52 +03:00
Denis Zharkov
fd0c92e307 Record inner class info for interface and DefaultImpls 2015-09-30 08:19:51 +03:00
Denis Zharkov
c1bed7efc7 Move generation of non-local interface DefaultImpls
`DefaultImpls` should be inner class of it's interface,
so for proper light classes building it should be built
before original interface has been done, i.e. `done` method called.

Everything is complicated with local interfaces, so they are just left untouched
2015-09-30 08:19:51 +03:00
Denis Zharkov
a101fffd9a Change INTERFACE_IMPL_CLASS_NAME: $TImpl -> DefaultImpls 2015-09-30 08:19:51 +03:00
Denis Zharkov
cabf0df5d1 Minor. Rename mapTraitImpl -> mapDefaultImpls 2015-09-30 08:19:51 +03:00
Denis Zharkov
b2d4bdc802 Minor. Rename isTrait -> isInterface 2015-09-30 08:19:51 +03:00
Denis Zharkov
6061528f7f Minor. Rename isInterface -> isJvmInterface 2015-09-30 08:19:51 +03:00
Denis Zharkov
cb1bdfde52 Minor. TraitImplBodyCodegen -> InterfaceImplBodyCodegen 2015-09-30 08:19:51 +03:00
Denis Zharkov
27bc62bd8e Minor. Rename constants: TRAIT_IMPL* -> DEFAULT_IMPLS* 2015-09-30 08:19:50 +03:00
Yan Zhulanow
32e2a550b4 'infix' modifier 2015-09-30 04:03:27 +03:00
Alexander Udalov
1fbfff97fa Delete NoInternalVisibilityInStdLibTest
'internal' is not a default visibility anymore and thus makes sense in stdlib
2015-09-29 21:42:58 +03:00
Zalim Bashorov
90915f2432 Backup project's system dir when create backup for debugging Kotlin incremental compilation 2015-09-29 19:42:30 +03:00
Zalim Bashorov
0eac238f9b KotlinBuilder: improve logging 2015-09-29 19:42:29 +03:00
Valentin Kipyatkov
2d0c1cd77d Advanced ABI version after accessor naming change 2015-09-29 18:38:42 +03:00
Valentin Kipyatkov
94d8e3f4b6 "is" getter naming allowed for non-booleans too 2015-09-29 18:32:25 +03:00
Valentin Kipyatkov
20bddce18d No synthetic property for false get-method like "issue()" 2015-09-29 18:32:25 +03:00
Valentin Kipyatkov
8f1a3043de Synthetic properties made locale-independant too 2015-09-29 18:32:25 +03:00
Valentin Kipyatkov
069ce12604 Accessor naming should be locale-independant 2015-09-29 18:32:24 +03:00
Valentin Kipyatkov
219fc46a36 Renamed property to avoid name clash 2015-09-29 18:32:24 +03:00
Valentin Kipyatkov
420c6856be Changed naming algorithm of accessor name generation: "isXXX" and "kClass" cases affected 2015-09-29 18:32:24 +03:00
Valentin Kipyatkov
98da621ab3 Temporary rename of properties starting with "is" and used from java code (will revert back after changing accessor naming policy) 2015-09-29 18:32:23 +03:00
Mikhail Glukhikh
1941827780 Typo fixed 2015-09-29 17:14:06 +03:00
Alexander Udalov
3b018e9eb0 Minor, move serialization-related stuff in codegen to separate package 2015-09-29 16:31:21 +03:00
Alexander Udalov
ba80a2404f Minor, improve signature of AsmUtil#writeAnnotationData 2015-09-29 16:26:29 +03:00
Alexander Udalov
3b9d90429b Simplify local class name serialization, don't go through extension
Also fix it for the case of a class in a non-default package
2015-09-29 16:26:28 +03:00
Alexander Udalov
1036506b25 Introduce new string table optimized for JVM class files
This format of the string table allows to reduce the size of the Kotlin
metadata in JVM class files by reusing constants already present in the
constant pool. Currently the string table produced by JvmStringTable is not
fully optimized in serialization (in particular, the 'substring' operation
which will be used to extract type names out of generic signature, is not used
at all), but the format and its complete support in the deserialization
(JvmNameResolver) allows future improvement without changing the binary version
2015-09-29 16:26:28 +03:00
Alexander Udalov
542bfab96f Don't write unnecessary information to ValueParameter proto
Flags can have a default value and the index can be trivially computed almost
all the time
2015-09-29 16:26:28 +03:00
Alexander Udalov
ccf72668e0 Don't write default upper bound for type parameters in protobuf 2015-09-29 16:26:27 +03:00
Alexander Udalov
6a8d0fbd75 Introduce infrastructure to separate string table from metadata on JVM
Nothing especially helpful happens here, this is only a big refactoring
introducing a separate string array for the string table, which is currently
always empty, but will contain actual strings soon
2015-09-29 16:26:27 +03:00
Alexander Udalov
5fe958f034 Add target TYPE to JVM metadata annotations 2015-09-29 16:26:26 +03:00
Alexander Udalov
89fe54c951 Remove NameResolver#getFqName, replace with getClassId 2015-09-29 16:26:26 +03:00
Alexander Udalov
7d5bd3cf50 Simplify storage of JVM signatures in binary metadata
Store the whole method & field descriptor strings. Moving these strings to
separate annotation arguments later will allow to reuse them with the ones in
the constant pool, presumably allowing to save lots of space (up to 10%)
2015-09-29 16:26:25 +03:00
Alexander Udalov
68051fa3bb Minor, refine parameter type of StringTable#getFqNameIndex 2015-09-29 16:26:25 +03:00
Alexander Udalov
5477570066 Extract interface out of NameResolver 2015-09-29 16:26:24 +03:00
Alexander Udalov
da68c4d9ee Extract interface out of StringTable
Rework SerializerExtension interface: don't pass StringTable to each method
every time, create it in each extension's constructor instead and expose to
DescriptorSerializer with an interface method
2015-09-29 16:26:24 +03:00
Alexander Udalov
e749bc262d Delete deprecated Type.Constructor message, advance ABI version 2015-09-29 16:26:24 +03:00
Nikolay Krasko
42eb413066 Update since to 142.5047.6 2015-09-29 15:43:02 +03:00
Stanislav Erokhin
5a61871d4b Minor. Fix testdata. 2015-09-29 13:33:57 +03:00
Stanislav Erokhin
5adec83907 Minor. Fix util function getResolutionScope. 2015-09-29 13:33:56 +03:00
Stanislav Erokhin
eb5a129253 Created util function recordScope and record scope for file and value parameters. 2015-09-29 13:33:56 +03:00
Stanislav Erokhin
fd503d0367 Minor. Replaced TYPE_RESOLUTION_SCOPE to LEXICAL_SCOPE 2015-09-29 13:33:55 +03:00
Mikhail Glukhikh
3d6d527d93 Synthetic 'field' variable is no more created in extension property accessors #KT-9303 Fixed 2015-09-29 13:05:19 +03:00
Mikhail Glukhikh
7b4f18035f L-value of assignment expression can now be annotated with expression-targeted annotation #KT-9154 Fixed 2015-09-29 13:05:16 +03:00
Mikhail Glukhikh
f4ccb16c2e Function expressions can be now annotated with expression-targeted annotation #KT-9323 Fixed 2015-09-29 13:05:13 +03:00
Mikhail Glukhikh
4e91f2ffb7 'open' + 'private' and 'abstract' + 'private' are now incompatible for functions and properties #KT-9324 Fixed 2015-09-29 13:05:11 +03:00
Mikhail Glukhikh
7cf2840fe5 'final' is deprecated in interfaces 2015-09-29 13:05:08 +03:00
Ilya Gorbunov
a55f9feacb Mark CharSequence.iterator() with operator. 2015-09-28 21:50:54 +03:00
Nikolay Krasko
e92a95eebb Fix typo in extension 2015-09-28 15:58:54 +03:00
Dmitry Kovanikov
6aa300e2d3 Minor: rename Kotlin console... action name to Kotlin REPL 2015-09-28 15:54:58 +03:00
Dmitry Kovanikov
45911cff90 Add icon to Kotlin console... action 2015-09-28 15:54:57 +03:00
Dmitry Kovanikov
84c1ac8885 KT-9262: don't show warning about non-existent location after typing ':quit' 2015-09-28 15:54:56 +03:00
Dmitry Kovanikov
2020351e2e KT-9263: don't show error message when user tries to execute command in non-existed REPL console 2015-09-28 15:54:54 +03:00
Dmitry Kovanikov
5cac0da2ba KT-9249: show text representation of first shortcut inside repl placeholder 2015-09-28 15:54:53 +03:00
Dmitry Jemerov
93e2827c1a dependency on java-i18n plugin 2015-09-28 14:49:06 +02:00
Mikhail Glukhikh
3ad628522a ReplaceWith now functions correctly in built-ins #KT-9351 Fixed 2015-09-28 15:38:05 +03:00
Dmitry Jemerov
ee1175d5e5 fix 'operator' modifier inspection
#KT-9349 Fixed
2015-09-28 14:35:41 +02:00
Natalia Ukhorskaya
58796da453 Extract function: render local class with debug name only in debug mode 2015-09-28 13:51:09 +03:00
Nikolay Krasko
881f1fd75e Suppress warning in proguard about jna classes 2015-09-28 11:38:08 +03:00
Nikolay Krasko
da22e40fad Update to IDEA 142.5047.6 2015-09-28 11:38:08 +03:00
Natalia Ukhorskaya
aa2ca1a7d5 Add missing readAction 2015-09-28 11:38:07 +03:00
Natalia Ukhorskaya
9ab4aafa01 jna-util.jar was renamed to jna-platform.jar 2015-09-28 11:38:07 +03:00
Natalia Ukhorskaya
606cf41e2a Fix compilation errors 2015-09-28 11:38:06 +03:00
Natalia Ukhorskaya
7582f1f454 Rewrite DebuggerTests (do not use FrameTree) 2015-09-28 11:38:06 +03:00
Natalia Ukhorskaya
5c04959871 Debugger: fix evaluation for local classes
#KT-5104 Fixed
2015-09-28 09:34:54 +03:00
Natalia Ukhorskaya
4fb4e0c21f Debugger: fix exception when process is resumed during stepping 2015-09-28 09:34:53 +03:00
Michael Nedzelsky
7234bf3572 get rid of internal JvmVersion annotation in kotlin-jdbc 2015-09-27 20:37:47 +03:00
Michael Nedzelsky
0035bbba7c fix check for internal from another module in imports and file level annotations 2015-09-27 20:37:41 +03:00
Yan Zhulanow
080dcf882e Minor: fix broken tests 2015-09-26 03:29:09 +03:00
Yan Zhulanow
3be050640c Fix Method.invoke() signature 2015-09-26 03:29:03 +03:00
Ilya Gorbunov
a1c3b26280 Temporary revert for M14 excluding kotlin-jdbc and kotlin-swing from maven deployment 2015-09-26 00:47:49 +03:00
Ilya Gorbunov
3f34bdf483 Make JvmVersion annotation internal for now. 2015-09-26 00:46:21 +03:00
Ilya Gorbunov
ee44717a41 private -> internal where it's necessary: synchronize OperationsMapGenerated and GenerateOperationsMap. 2015-09-26 00:26:59 +03:00
Ilya Gorbunov
0a24ba77b5 Add extension operators plus and minus for FileCollection to make them resolve into gradle api, rather than collection api. 2015-09-26 00:12:31 +03:00
Ilya Gorbunov
3915cfcea6 Merge Lazy's declarations in one file. 2015-09-25 23:50:55 +03:00
Zalim Bashorov
03fe293ace Minor: fix testdata 2015-09-25 22:36:01 +03:00
Ilya Gorbunov
1145cc0d1b Lazy: changes and clarifications after code-review.
LazyThreadSafety.NONE is actually *NONE* now.
2015-09-25 21:49:49 +03:00
Ilya Gorbunov
74f39c2375 Provide LazyThreadSafetyMode.PUBLICATION: concurrent non-blocking initializations, single publication. 2015-09-25 21:49:46 +03:00
Ilya Gorbunov
4a062698f2 Introduce final field in SynchronizedLazyImpl to enable safe publication. 2015-09-25 21:49:42 +03:00
Michael Nedzelsky
1986d8d7f8 add test for private in file 2015-09-25 21:16:04 +03:00
Michael Nedzelsky
c62b9dc416 remove test for KT-2257: cannot access private namespace var in multi-file namespace 2015-09-25 21:16:04 +03:00
Michael Nedzelsky
2f9151ec18 remove incremental test: accessPrivateMembers 2015-09-25 21:16:03 +03:00
Zalim Bashorov
c7c7382b8e Minor: fix testdata 2015-09-25 21:16:02 +03:00
Michael Nedzelsky
759c325e8b NoInternalVisibilityInStdLibTest: skip explicit internal modifiers 2015-09-25 21:16:02 +03:00
Michael Nedzelsky
2ad1459948 NoInternalVisibilityInStdLibTest: get rid of warnings 2015-09-25 21:16:01 +03:00
Zalim Bashorov
8cb87b3e49 private -> internal where it's necessary 2015-09-25 21:16:00 +03:00
Michael Nedzelsky
0d2196e226 ACCESS_TO_PRIVATE_TOP_LEVEL_FROM_ANOTHER_FILE: warning -> error 2015-09-25 21:13:18 +03:00
Ilya Gorbunov
1598660870 Deprecate extension property String.reader in favor of existing extension method reader() in kotlin.io package. 2015-09-25 21:10:20 +03:00
Ilya Gorbunov
379c39a2ef Move ByteArray.inputStream() method from kotlin package to kotlin.io 2015-09-25 21:10:17 +03:00
Ilya Gorbunov
8de40c01b9 Fix changed stdlib source file names in stepping tests. 2015-09-25 21:10:15 +03:00
Ilya Gorbunov
1622cf9506 Fix stdlib facade names in bytecode generation and decompilation tests. 2015-09-25 21:10:13 +03:00
Ilya Gorbunov
ed2b118fc8 Update java examples 2015-09-25 21:10:11 +03:00
Ilya Gorbunov
60c2f0fe0b Redistribute generated code between files. 2015-09-25 21:10:08 +03:00
Ilya Gorbunov
3e018f3a9f Annotate hand-written code with desired package part names. 2015-09-25 21:10:06 +03:00
Ilya Gorbunov
63f90eacdd Move flatten and unzip to parts corresponding to the receiver type of operation. 2015-09-25 21:10:03 +03:00
Ilya Gorbunov
3d7ff5c573 Move IO utility methods to corresponding parts. 2015-09-25 21:10:01 +03:00
Ilya Gorbunov
bf8df0f764 Move toRegex extension in kotlin package 2015-09-25 21:09:59 +03:00
Ilya Gorbunov
9ba50bcdff Move map- and set-related methods to corresponding parts. 2015-09-25 21:09:56 +03:00
Ilya Gorbunov
f6e0ef83e5 Move constants out of Console.kt 2015-09-25 21:09:54 +03:00
Ilya Gorbunov
058f2a8bd2 Move File-related extensions out of ReadWrite.kt 2015-09-25 21:09:52 +03:00
Ilya Gorbunov
13132e7483 Move synchronized method out of JLangJVM 2015-09-25 21:09:50 +03:00
Ilya Gorbunov
27ab643d3f Move to method to Tuples 2015-09-25 21:09:47 +03:00
Ilya Gorbunov
6bb88df693 Turn off Xmultifile-package-facades option for stdlib. 2015-09-25 21:09:45 +03:00
Ilya Gorbunov
0c777b87ed Add JvmMultifileClass to js as internal annotation. 2015-09-25 21:09:43 +03:00
Ilya Gorbunov
d40bbf6acb Allow to annotate generated code as jvm-only. 2015-09-25 21:09:40 +03:00
Ilya Gorbunov
1deb8b9dda Rename conflicting parts: add "Kt" 2015-09-25 21:09:38 +03:00
Ilya Gorbunov
473698a7e8 Generate JvmMultifileClass annotation on parts. 2015-09-25 21:09:36 +03:00
Ilya Gorbunov
2bc1fbab3f Allow stdlib generator to distribute concrete functions between different target files. 2015-09-25 21:09:33 +03:00
Ilya Gorbunov
947b8ac428 ant build: Do not preprocess stdlib source for JVM, only for JS. 2015-09-25 21:09:31 +03:00
Ilya Gorbunov
12d218632c logging: debug enabled for CLI 2015-09-25 21:09:29 +03:00
Ilya Gorbunov
9970c34961 Preprocessor: improved logging. 2015-09-25 21:09:27 +03:00
Ilya Gorbunov
7f5c3e15e4 Annotate stdlib jvm-only files without JVM suffix. 2015-09-25 21:09:24 +03:00
Ilya Gorbunov
1df4ab847d Remove task for ant, include preprocessor into the compiler, call preprocessor in ant build. 2015-09-25 21:09:22 +03:00
Ilya Gorbunov
e8c93abdb5 Developing preprocessor task for ant 2015-09-25 21:09:20 +03:00
Ilya Gorbunov
7b206fdaf4 Refactor a bit 2015-09-25 21:09:18 +03:00
Ilya Gorbunov
d76e177834 Each platform is processed separately but in parallel. 2015-09-25 21:09:15 +03:00
Ilya Gorbunov
706771829e Processing sources for multiple platforms in one pass. 2015-09-25 21:09:13 +03:00
Ilya Gorbunov
ae51f2eb2a Annotation for preprocessor to mark declaration as jvm-only 2015-09-25 21:09:11 +03:00
Ilya Gorbunov
de778d9865 Prototyping preprocessor: stripping declarations and replacing name. 2015-09-25 21:09:08 +03:00
Dmitry Jemerov
3d0e91065a quickfix for usages of operators that don't have the proper annotation 2015-09-25 20:00:29 +02:00
Dmitry Jemerov
8b0ccce4f1 code review; add 'operator' also to next() and hasNext(); check toplevel functions 2015-09-25 20:00:28 +02:00
Dmitry Jemerov
e0f8d68a5f add 'operator' modifier when creating next() and hasNext() from usage 2015-09-25 20:00:28 +02:00
Dmitry Jemerov
1e2d4c0471 use setOf() instead of Guava sets 2015-09-25 20:00:27 +02:00
Dmitry Jemerov
41d1cf6083 check return type of contains() and compareTo() 2015-09-25 20:00:26 +02:00
Dmitry Jemerov
3dbb74bf0c teach 'create from usage' to add 'operator' modifier when necessary 2015-09-25 20:00:26 +02:00
Dmitry Jemerov
bda0bd1de1 quickfix to add 'operator' keyword to operator-like functions 2015-09-25 20:00:19 +02:00
Yan Zhulanow
3a519ccc0a Add extension for Method.invoke() 2015-09-25 20:47:55 +03:00
Yan Zhulanow
b73f91d16b Fix "unresolved widget fqname" bug in Gradle 2015-09-25 20:47:54 +03:00
Yan Zhulanow
07b77432de Fix NPE in AndroidPsiTreeChangePreprocessor 2015-09-25 20:47:54 +03:00
Dmitry Jemerov
61d78e0880 tests for "Add 'const' modifier" 2015-09-25 19:14:54 +02:00
Dmitry Jemerov
48bcc93ec2 revert incorrect testdata changes 2015-09-25 19:14:53 +02:00
Dmitry Jemerov
86a01a9a0d update Java usages when adding 'const' modifier; make the action available as intention 2015-09-25 19:14:53 +02:00
Dmitry Jemerov
250456ab4b add quickfix for NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION 2015-09-25 19:14:52 +02:00
Alexey Tsvetkov
743c59331d Remove tests on turning incremental on/off temporary 2015-09-25 20:11:58 +03:00
Alexey Tsvetkov
1002d233cb Update cache version 2015-09-25 20:11:58 +03:00
Alexey Tsvetkov
ba33020140 Clean only kotlin caches when incremental compilation is off 2015-09-25 20:11:58 +03:00
Alexey Tsvetkov
1298d115bd Minor: rename test cases 2015-09-25 20:11:57 +03:00
Alexey Tsvetkov
c7f66a1585 Fix recompilation of dependent modules on cache/abi version change
New cache version was written to dependent targets,
when they have not been compiled yet

 #KT-9190 Fixed
2015-09-25 20:11:57 +03:00
Alexey Tsvetkov
7ef23da289 Clean all storages if incremental compilation is off 2015-09-25 20:11:57 +03:00
Alexey Tsvetkov
2bed8d0557 Test caches creation with turning incremental on/off 2015-09-25 20:11:57 +03:00
Alexey Tsvetkov
68437175f6 Enable disabling incremental compilation for tests 2015-09-25 20:11:57 +03:00
Alexey Tsvetkov
b6bbc4015b Write cache version only if incremental compilation is enabled 2015-09-25 20:11:57 +03:00
Alexey Tsvetkov
a3f2ccf72d Test that Kotlin incremental caches are created lazily 2015-09-25 20:11:57 +03:00
Alexey Tsvetkov
4b880f324a Access cache version file in tests using CacheVersionFormat 2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
92d5b93cc7 Move incremental compilation enabled check from CacheFormatVersion to KotlinBuilder 2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
0904b4bae8 Move CacheFormatVersion to separate file 2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
5c9b962567 Create map so it will always be added to maps 2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
a611dd9d25 Minor: remove unused function 2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
b8388ae7ed Minor: remove unused ClassToSources map 2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
fe390a04c5 Create Kotlin incremental caches only on write 2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
c0b208275e Revert removing testDoNotCreateUselessKotlinIncrementalCaches
Removed by mistake in b25dfabbcc
2015-09-25 20:11:56 +03:00
Alexey Tsvetkov
8c7053552b Flush dataManager in KotlinJpsBuildTest 2015-09-25 20:11:55 +03:00
Mikhail Glukhikh
4b9d136ced identityEquals is deprecated 2015-09-25 20:00:54 +03:00
Yan Zhulanow
aada13c91f Deprecate @publicField 2015-09-25 19:51:07 +03:00
Yan Zhulanow
cc2d005984 Make lateinit diagnostics more clear 2015-09-25 19:51:06 +03:00
Dmitry Jemerov
32e6a6e3a1 inspection and quickfix to replace usages of deprecated package facades 2015-09-25 18:29:06 +02:00
Dmitry Jemerov
9de74921ca code review 2015-09-25 18:25:38 +02:00
Dmitry Jemerov
4e7236529c "move assignment to initializer" quickfix for assigning to properties in constructors/init blocks 2015-09-25 18:25:37 +02:00
Dmitry Jemerov
e1acc8744d "introduce backing property" intention 2015-09-25 18:25:37 +02:00
Dmitry Jemerov
dadef12723 backing field migration fixes 2015-09-25 18:25:36 +02:00
Yan Zhulanow
3d65b6fec2 Add extension function for BindingContext 2015-09-25 19:20:21 +03:00
Yan Zhulanow
6db9344659 Fix compiler tests 2015-09-25 19:20:20 +03:00
Yan Zhulanow
35362a0f3b Check 'operator' on next() and hasNext() 2015-09-25 19:20:19 +03:00
Yan Zhulanow
2c7f68ff71 Member and extension functions with 'operator' have now higher priority 2015-09-25 19:20:18 +03:00
Yan Zhulanow
1139a8dd0e Mark builtins and stblib functions with 'operator' 2015-09-25 19:20:18 +03:00
Yan Zhulanow
ce4bcbba6d Simple diagnostic on 'operator' keyword 2015-09-25 19:20:17 +03:00
Yan Zhulanow
43bf87e82d Add diagnostics on convention operator calls without an "operator" modifier on declaration site 2015-09-25 19:19:02 +03:00
Yan Zhulanow
fe744abc3c Mark componentN() in data classes with 'operator' 2015-09-25 19:17:25 +03:00
Stanislav Erokhin
d3b81cf376 Mute assert in ReferenceVariantsHelper for scopes.
Now there are several places, where we can get JetScope and write wrapper by LexicalScope key.
Assertions is minor here, because in worse case we just added some wrong descriptors to completion.
2015-09-25 19:10:04 +03:00
Stanislav Erokhin
37af3d994b Created util function addImportScope and use it in ShadowedDeclarationsFilter 2015-09-25 19:10:04 +03:00
Stanislav Erokhin
8ab4114291 Minor. Fix testdata. 2015-09-25 19:10:03 +03:00
Natalia Ukhorskaya
40554996f8 Minor. Fix file path for windows 2015-09-25 19:10:02 +03:00
Mikhail Glukhikh
0a0bfdacb1 Names containing only '_' are deprecated (declarations, parameters, import aliases, labels, but not backquoted names) 2015-09-25 18:57:58 +03:00
Mikhail Glukhikh
ebfb6c8468 private and override are no more compatible 2015-09-25 18:57:55 +03:00
Mikhail Glukhikh
9ccf1a1729 Partial rollback: 'private' is no more deprecated in interfaces, some tests rolled back accordingly 2015-09-25 18:57:52 +03:00
Denis Zharkov
505cb37052 Generate deprecated flag on getter of const val's 2015-09-25 18:12:45 +03:00
Valentin Kipyatkov
1c6ca9d036 Initial implementation of KT-5955 Completion for override methods
#KT-5955 Fixed
2015-09-25 18:12:18 +03:00
Michael Nedzelsky
15edbbb60c move service declaration to cli 2015-09-25 18:10:58 +03:00
Nikolay Krasko
ec411444d5 Do not substitute version in bootstrap build 2015-09-25 18:07:59 +03:00
Nikolay Krasko
2cf640463c Enable override version filter only for specific branch - allow auto-merge to other branches 2015-09-25 18:07:58 +03:00
Nikolay Krasko
35caa79019 Auto-increment version from script
This allows to have own version system on particular branch. It's planned to be enabled in release branches.
2015-09-25 18:07:58 +03:00
Mikhail Glukhikh
103bb320c8 Do not generate non-function/getter/setter (expression) annotations on anonymous functions 2015-09-25 17:46:38 +03:00
Mikhail Glukhikh
74ba21b40c Extra annotation target test for prefix expression 2015-09-25 17:46:36 +03:00
Mikhail Glukhikh
f06a79d534 KNPE fixed in data class checker together with some ID warnings #KT-9296 Fixed #EA-73584 Fixed 2015-09-25 17:46:33 +03:00
Mikhail Glukhikh
bd7ccc0138 Annotation on a function literal cannot be written to binary if it has FUNCTION target and the literal is inlined 2015-09-25 17:46:30 +03:00
Alexey Sedunov
6b9e2b0bbb Resource Bundles: Enable property key completion in string literals
#KT-6946 Fixed
2015-09-25 17:18:02 +03:00
Alexey Sedunov
594e4e5c31 Resource Bundles: Inspections on invalid property key/resource bundle references
#KT-6946 In Progress
2015-09-25 17:18:01 +03:00
Alexey Sedunov
44fd9d17ed Resource Bundles: Add Rename tests for bundle files and properties
#KT-6946 In Progress
2015-09-25 17:18:00 +03:00
Alexey Sedunov
5af4101f7d Resource Bundles: Implement references on Kotlin string literals
#KT-6946 In Progress
2015-09-25 17:17:59 +03:00
Ilya Chernikov
9c7d6c1649 Fixing KT-9196 (broken kotlin-compiler-embeddable.jar in M13) by excluding org.fusesource.jansi.internal.CLibrary from relocation, adding smoke test for embeddable jar 2015-09-25 16:13:03 +02:00
Natalia Ukhorskaya
3dd076efa8 Minor: extract function 2015-09-25 16:01:37 +03:00
Natalia Ukhorskaya
c872f301ff Fix steping for inline functions with reified parameters 2015-09-25 16:01:36 +03:00
Natalia Ukhorskaya
33b5e6b255 Fix stepping for inline functions inside when, if, try 2015-09-25 16:01:35 +03:00
Michael Nedzelsky
e92f14e49c increment version in KotlinJavaScriptMetaFileIndex in order to force rebuild indexes 2015-09-25 15:14:20 +03:00
Michael Nedzelsky
6013d3a527 code cleanup: fileIndexes 2015-09-25 15:14:15 +03:00
Michael Nedzelsky
b8ab8bcfca check for access to internal elements from another module in jps-plugin
hack for access from tests to internal declarations in production code

fix AbstractCompileKotlinAgainstKotinTest: add information about output directory in order to correct check for internal visibility.
2015-09-25 14:02:29 +03:00
Michael Nedzelsky
0b49195a03 add tests in KotlinJpsTest for check access to internal elements from another module 2015-09-25 14:02:26 +03:00
Michael Nedzelsky
ad274c5137 add tests for incremental compilation with changed internal class 2015-09-25 14:02:21 +03:00
Valentin Kipyatkov
c8a244cc40 Minor corrections on code review 2015-09-25 13:02:47 +03:00
Valentin Kipyatkov
db0578c187 Refactored code 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov
22797114c7 J2K: correct handling of properties with "is" notation 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov
c8b6db4e57 Renamed test data folder 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov
ade9cbcafb Refactoring (+ slightly more correct logic) 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov
c05232bbb7 J2K: generate accessor bodies in expression form if possible 2015-09-25 13:02:46 +03:00
Valentin Kipyatkov
ee5a853faa Generate accessor with delegation to super when it's necessary 2015-09-25 13:02:45 +03:00
Valentin Kipyatkov
b1b5af8e1e More correct detection of super property 2015-09-25 13:02:45 +03:00
Valentin Kipyatkov
8a0cd92aff Minor 2015-09-25 13:02:45 +03:00
Valentin Kipyatkov
e885657894 Minor api refactoring "isVal" -> "isVar" 2015-09-25 13:02:45 +03:00
Valentin Kipyatkov
320102bbdb J2K: get/set-methods converted to properties (but lot of TODOs left) 2015-09-25 13:02:45 +03:00
Denis Zharkov
3f6cadf9b7 Change FUNCTION_EXPRESSION_WITH_NAME severity to ERROR
Also drop deprecation related parts and get rid of usages of this `feature` within testData
2015-09-25 08:29:26 +03:00
Denis Zharkov
1d90b2e1fe Get rid of obsolete syntax in quickfixes changing lambda's signature
- Do not wrap parameters with '()'
- Do not set return type for them
- Fix existing testData
2015-09-25 08:29:26 +03:00
Denis Zharkov
31d2aa23f5 Remove ChangeType quickfix for lamdas with deprecated syntax 2015-09-25 08:29:26 +03:00
Denis Zharkov
60ebc689ad Drop diagnostic reported on lambda's return type
Because it's not allowed syntactically anymore.
Also adjust related methods within JetFunctionNotStubbed
2015-09-25 08:29:26 +03:00
Denis Zharkov
c6377a0664 Drop everything related to lambda syntax deprecation 2015-09-25 08:29:26 +03:00
Denis Zharkov
73799e2c3c Replace deprecated lambda syntax in testData
It's done with similar constructions where possible trying to preserve
intended behavior.
Some usages are removed because they test exactly the feature that
we are going to drop soon.
2015-09-25 08:29:25 +03:00
Denis Zharkov
5f69789636 Stop parsing lambdas with deprecated syntax 2015-09-25 08:29:25 +03:00
Zalim Bashorov
79ac436b9f Add tests for cases when add and remove custom accessors for val with smartcasted usage 2015-09-24 22:50:48 +03:00
Michael Nedzelsky
c6409138d8 Merge pull request #752 from JetBrains/rr/compile-service-3
compile service 3
2015-09-24 16:50:09 +03:00
Valentin Kipyatkov
f27c18b4a2 KT-8979 Completion of non-imported extension with "!" character corrupts code
#KT-8979 Fixed
2015-09-24 16:44:41 +03:00
Stanislav Erokhin
c2b1a5ee6d Removed unnecessary long checks. 2015-09-24 14:32:54 +03:00
Stanislav Erokhin
e4e6a600e1 Add performance hack for unInvalidate Files from stdlib in tests. 2015-09-24 14:32:54 +03:00
Stanislav Erokhin
9cc6d1cf58 Added check to ImportInsertHelperImpl that inserted import successfully imports descriptor 2015-09-24 14:07:51 +03:00
Stanislav Erokhin
88815c40cc Minor. Fix testdata. 2015-09-24 14:07:51 +03:00
Stanislav Erokhin
cdcf9f30b7 Minor. Fix compilation. 2015-09-24 14:07:51 +03:00
Stanislav Erokhin
fc9aa87a05 Report diagnostic on import with explicit import class if class was imported earlier. 2015-09-24 14:07:43 +03:00
Stanislav Erokhin
6c1738e11a Minor. Small refactoring of AllUnderImportsScope 2015-09-24 13:53:56 +03:00
Stanislav Erokhin
85895bec62 Improved error reporting, when we trying import invisible descriptor. 2015-09-24 13:53:56 +03:00
Stanislav Erokhin
d7a14075f1 Removed ImportPackage UI settings 2015-09-24 13:53:56 +03:00
Stanislav Erokhin
1360f3cd43 Fix visibility checker for import. 2015-09-24 13:53:55 +03:00
Michael Bogdanov
e5334ed9b8 Compare arrays via equals (not Arrays.equals) in data classes 2015-09-24 12:00:19 +03:00
Michael Bogdanov
cf57d56ab3 Don't generate private members in interface 2015-09-24 12:00:18 +03:00
Ilya Chernikov
4b1601974f Refactoring parts related to passing services to compiler in daemon, adding uniform support for cancellation check and lookup tracking 2015-09-24 10:44:44 +02:00
Ilya Chernikov
3c16b2de87 Converting KotlinCompilerRunner.java to kotlin - phase 3 - refactoring to more kotlin style 2015-09-24 10:42:54 +02:00
Ilya Chernikov
0047fb1272 Converting KotlinCompilerRunner.java to kotlin - phase 2 - converter + manual fixes 2015-09-24 09:56:26 +02:00
Ilya Chernikov
fffe6dd837 Converting KotlinCompilerRunner.java to kotlin - phase 1 - renaming to .kt to preserve history 2015-09-24 09:56:26 +02:00
Ilya Chernikov
886dc4b438 Refactoring daemon tests for more reusable code, adding instances test, minor fixes and improvements 2015-09-24 09:56:25 +02:00
Ilya Chernikov
c294a682de Utils for checking presense of certain lines in a sequence, using this tool for checking log after daemon builds in tests, fixing explicit daemon shutdown used in the test, some minor fixes 2015-09-24 09:56:24 +02:00
Michael Bogdanov
2e6b56691c Fix for: KT-8089 NoSuchFieldError
#KT-8089 Fixed
2015-09-24 09:36:46 +03:00
Yan Zhulanow
bc727a170b Add 'operator' keyword 2015-09-23 21:25:51 +03:00
Pavel V. Talanov
4a32993cc3 Ant build: apply -Xmultifile-package-facades while building stdlib and reflection jars only 2015-09-23 18:29:13 +03:00
Zalim Bashorov
967c8eae2e Minor: fix testdata files which were accidentally reformatted 2015-09-23 18:18:08 +03:00
Michael Nedzelsky
2c952dcc22 Revert "add isKotlinSourceElement method to Source interface in order to recognize kotlin source elements during compilation"
This reverts commit c342f6870a.
2015-09-23 17:45:47 +03:00
Michael Nedzelsky
031a42ccf4 Revert "add isIncremental method to PackageFragmentDescriptorImpl in order to recognize descriptors from incremental package fragments during compilation"
This reverts commit ddaebd2b27.
2015-09-23 17:45:45 +03:00
Michael Nedzelsky
ef8e7ea0bb Revert "add strict check for internal visibility during compilation"
This reverts commit d1ee58186f.
2015-09-23 17:45:42 +03:00
Michael Nedzelsky
01ece0faa4 Revert "fix tests (internal -> public)"
This reverts commit e86bf03e76.
2015-09-23 17:45:40 +03:00
Michael Nedzelsky
db602df146 Revert "add test for check access to internal elements from another module"
This reverts commit 4d9eaf19c3.
2015-09-23 17:45:38 +03:00
Dmitry Petrov
8595315ba5 - Package facade classes should have ACC_DEPRECATED
- Light classes for package facades should be deprecated
2015-09-23 17:41:13 +03:00
Dmitry Petrov
3cd1c222f0 Generate delegates to multifile class members in package facade classes
(unless using -Xmultifile-package-facades option)
2015-09-23 17:41:13 +03:00
Dmitry Petrov
5cdbdfc2cc - Annotate package facades with java.lang.Deprecated.
- Provide KotlinDelegatedMethod annotation on package facade members.
2015-09-23 17:41:12 +03:00
Mikhail Glukhikh
c4fb6d48c5 Object literals are now classes and expressions simultaneously for the purposes of annotation target checking 2015-09-23 16:47:07 +03:00
Mikhail Glukhikh
dd4601fd08 Function literal is now expression and function simultaneously for purposes of annotation target checking 2015-09-23 16:47:04 +03:00
Mikhail Glukhikh
997e9a7dd7 Multi declaration is now a separate target in KotlinTarget 2015-09-23 16:46:44 +03:00
Mikhail Glukhikh
789f351f6f data modifier is now inapplicable to enum classes, annotations, objects and interfaces #KT-8302 Fixed 2015-09-23 16:33:11 +03:00
Mikhail Glukhikh
315a304c8e New modifier checking strategy: only one error but any number of warnings, a warning can never shadow an error 2015-09-23 16:33:08 +03:00
Mikhail Glukhikh
55c7df8b8d Deprecations: data class should now have at least one primary constructor parameter, parameters should be val / var and not vararg. 2015-09-23 16:33:05 +03:00
Mikhail Glukhikh
3d6253c27f abstract + data and sealed + data are also deprecated 2015-09-23 16:33:02 +03:00
Mikhail Glukhikh
038d955c23 Data classes cannot have class supertypes, a new test, relevant test fixes 2015-09-23 16:33:00 +03:00
Mikhail Glukhikh
58110cd0d1 open + data and inner + data are deprecated, a new test, relevant test fixes 2015-09-23 16:32:57 +03:00
Mikhail Glukhikh
731fdecf06 private / protected / internal modifiers are deprecated in interfaces, relevant tests changed 2015-09-23 16:32:54 +03:00
Denis Zharkov
dcb84a7d0a Make annotations-modifiers private and fix some lost usages
It's needed to prevent usages of them as real annotation/type.
But we can't remove them, because currently some modifiers
are artificially resolved as annotations of those classes.
2015-09-23 12:18:12 +03:00
Denis Zharkov
4a993f517e Drop tailRecursive and it's usage 2015-09-23 12:18:12 +03:00
Denis Zharkov
098f5462eb Drop inlineOptions and fix forgotten usages 2015-09-23 12:18:12 +03:00
Denis Zharkov
67486b867b Get rid of inlineOptions usages in IDE tests 2015-09-23 12:18:12 +03:00
Denis Zharkov
e1e3a6c9ad Introduce const into decompiler and stub builder 2015-09-23 08:20:57 +03:00
Denis Zharkov
c13f0812e3 Temporary workaround for strange JvmName behavior 2015-09-23 08:20:57 +03:00
Denis Zharkov
d937a7cefc Generate field for const-val with same visibility as desciptor
Also add test checking that constant static final fields generated for them
2015-09-23 08:20:57 +03:00
Denis Zharkov
ba6671edb4 Minor. Drop unused constant JetTokens.ANNOTATION_MODIFIERS_KEYWORDS 2015-09-23 08:20:57 +03:00
Denis Zharkov
afd4e644a3 Report warning on usages of non-const vals in places where constants expected 2015-09-23 08:20:57 +03:00
Denis Zharkov
8d13f08271 Load static final fields of appropriate types from Java as const 2015-09-23 08:20:57 +03:00
Denis Zharkov
98dd08109d Serialize/Deserialize const modifier 2015-09-23 08:20:56 +03:00
Denis Zharkov
b2b76d16d0 Add checks for const modifier applicability
1. Must be initialized in-place
2. Can not be open/abstract
3. Can not be an override
4. Can not be delegated
5. Initializer must be a compile-time constant
6. No getters
7. `const` is not applicable to vars or locals
8. `const val` should be whether top-level property or object member
2015-09-23 08:20:56 +03:00
Denis Zharkov
bde58d6eb8 Introduce interface method: VariableDescriptor.isConst
And several default implementations
Also take it into account in renderer
2015-09-23 08:20:56 +03:00
Denis Zharkov
02b64ce1ed Parse const as soft modifier keyword 2015-09-23 08:20:56 +03:00
Denis Zharkov
4a3ac474ca Minor. Rename resolveValueArguments -> resolveAnnotationValueArguments 2015-09-23 08:20:56 +03:00
Denis Zharkov
bafb6cc2f7 Minor. Extract common code in ModifierChecker 2015-09-23 08:20:56 +03:00
Michael Nedzelsky
4d9eaf19c3 add test for check access to internal elements from another module
#KT-9178 Fixed
2015-09-23 07:49:33 +03:00
Michael Nedzelsky
e86bf03e76 fix tests (internal -> public) 2015-09-23 07:49:29 +03:00
Michael Nedzelsky
d1ee58186f add strict check for internal visibility during compilation 2015-09-23 07:49:27 +03:00
Michael Nedzelsky
ddaebd2b27 add isIncremental method to PackageFragmentDescriptorImpl in order to recognize descriptors from incremental package fragments during compilation 2015-09-23 07:49:23 +03:00
Michael Nedzelsky
c342f6870a add isKotlinSourceElement method to Source interface in order to recognize kotlin source elements during compilation 2015-09-23 07:49:21 +03:00
Michael Nedzelsky
bcd85aa30d changes some internal modifiers to public for elements which are used outside their modules 2015-09-23 07:49:17 +03:00
Valentin Kipyatkov
1afdb8d996 No nested classes auto-import 2015-09-23 01:42:19 +03:00
Valentin Kipyatkov
3d129522db Auto-import fix to use dependency rules (as in Java) 2015-09-23 01:42:19 +03:00
Valentin Kipyatkov
8f78b27462 Minor refactoring 2015-09-23 01:42:18 +03:00
Valentin Kipyatkov
232ab33c3a Minor 2015-09-23 01:42:18 +03:00
Valentin Kipyatkov
56b088233a KT-8179 Settings / "Add unambiguous imports on the fly" could work in Kotlin files too
#KT-8179 Fixed
2015-09-23 01:42:18 +03:00
Dmitry Kovanikov
e26fe0b080 Disable completion in repl 2015-09-22 21:11:56 +03:00
Dmitry Kovanikov
87969f1660 Minor: change repl.ideMode property name to kotlin.repl.ideMode 2015-09-22 21:11:55 +03:00
Dmitry Kovanikov
ab06dbfc70 Repl: add test to check multiline support 2015-09-22 21:11:54 +03:00
Dmitry Kovanikov
bfe01cccea Repl: fix bug in handling multiline commands 2015-09-22 21:11:54 +03:00
Alexander Udalov
4ca8a51234 Move Interner from deserialization to util
This class is not used in core and should not end up in kotlin-reflect.jar
2015-09-22 18:22:59 +03:00
Alexander Udalov
1878f892c1 Minor, fix annoying nullability warning 2015-09-22 18:22:58 +03:00
Alexander Udalov
e52a9b9fb8 Rename ClassDataProvider -> ClassDataWithSource 2015-09-22 18:22:58 +03:00
Alexander Udalov
0ef705f073 Minor, convert ClassData and PackageData to Kotlin data classes 2015-09-22 18:22:57 +03:00
Alexander Udalov
78e920f797 Minor, fix trove4j source paths 2015-09-22 18:22:57 +03:00
Alexander Udalov
e7b041456f Add missing module to Kotlin JPS plugin
Since binary version stopped being a simple int and became an instance of the
class BinaryVersion, and since incremental cache loads versions of classes, the
JPS plugin now needs to have the 'deserialization' module which has that class
to avoid ClassNotFoundException.

This fixes CNFE from the bare plugin
2015-09-22 18:22:56 +03:00
Alexander Udalov
f9ba7f6880 Minor, inline ClassData#read & PackageData#read to single usage 2015-09-22 18:22:56 +03:00
Alexander Udalov
4a8d2b73d3 Remove deprecated stuff unused after M13 2015-09-22 18:22:55 +03:00
Alexander Udalov
93b5065cf5 Get rid of SerializationUtil, move methods to DescriptorSerializer 2015-09-22 18:22:55 +03:00
Alexander Udalov
04b8991bdd Minor, move BuiltInsSerializerExtension to module builtins-serializer 2015-09-22 18:22:54 +03:00
Alexander Udalov
7cc416ed12 Minor, rename TRAIT -> INTERFACE, CLASS_OBJECT -> COMPANION_OBJECT 2015-09-22 18:22:54 +03:00
Alexander Udalov
a0fb1a18e3 Minor, delete useless methods from NameResolver 2015-09-22 18:22:54 +03:00
Michael Nedzelsky
34d4d2e7d9 ProtoCompareGenerated: get rid ofusage of internal details of NameResolver 2015-09-22 18:22:53 +03:00
Dmitry Jemerov
9b33721a98 don't try to add auto-import if user closed the project while the popup was displayed (EA-67037 - assert: ComponentManagerImpl.getComponent) 2015-09-22 16:11:38 +02:00
Dmitry Jemerov
7ae5506d99 don't create reports for empty elements (EA-67307 - assert: ProblemDescriptorBase.<init>) 2015-09-22 16:11:37 +02:00
Dmitry Jemerov
c669a06c97 return null instead of asserting on declarations with null name (EA-69471 - assert: JetSourceNavigationHelper.convertPropertyOrFunction) 2015-09-22 16:11:36 +02:00
Dmitry Jemerov
0febe3322b don't register template listener if we don't have an editor (EA-70683 - KNPE: OverrideImplementMethodsHandler.invoke) 2015-09-22 16:11:36 +02:00
Dmitry Jemerov
e7a0f077f0 according to Peter, getting a PCE from indexes is a valid situation, don't log this as an error (EA-73265 - assert: KotlinCopyPasteReferenceProcessor.collectTransferableData) 2015-09-22 16:11:35 +02:00
Dmitry Jemerov
55b422ab9b remove 'public' modifier from default file templates 2015-09-22 16:07:48 +02:00
Dmitry Jemerov
c5309d7955 to avoid deadlock, don't refresh VFS during service initialization, instead refresh asynchronously during plugin initialization 2015-09-22 15:11:42 +02:00
Dmitry Jemerov
51ee1b3e5a do not cache binary contents when trying to check if a .class file is compiled with Kotlin 2015-09-22 15:08:28 +02:00
Zalim Bashorov
98867addc9 Regenerate tests for JS reserved words 2015-09-22 15:00:38 +02:00
Zalim Bashorov
a1979b6eb4 Regenerate tests for JS reserved words when cases changed 2015-09-22 15:00:37 +02:00
Dmitry Jemerov
4ca434da54 remove support for 'trait' keyword 2015-09-22 15:00:24 +02:00
Mikhail Glukhikh
86833c1a74 Migration to new backing field syntax 2015-09-22 10:15:52 +03:00
Alexey Sedunov
b4efe33efa IDEA 142.4859.6: Update LineNumberTestGenerated test data (due to IDEA's ASM upgrade to 5.0.4 which supports multiline labels) 2015-09-21 18:07:46 +03:00
Alexey Sedunov
8603a36404 IDEA 142.4859.6: Invalidate library cache in setUp() to prevent access to
ClsFiles invalidated by the previous test
2015-09-21 18:07:44 +03:00
Alexey Sedunov
a892d3f995 IDEA 142.4859.6: Update dependencies and fix compilation 2015-09-21 18:07:43 +03:00
Dmitry Petrov
39e0b3ab92 fix testData related to JvmName retention 2015-09-21 17:33:06 +03:00
Mikhail Glukhikh
d337283b52 "field": more accurate creation of synthetic field 2015-09-21 15:48:14 +03:00
Mikhail Glukhikh
831df27cac "field": refactoring, isBackingFieldReference, referencedProperty 2015-09-21 15:48:11 +03:00
Mikhail Glukhikh
ad302fcfba "field": control of accessor parameter name shadowing, test 2015-09-21 15:48:08 +03:00
Mikhail Glukhikh
4f3e3610a0 NPE fixed inside three implementations of LexicalScope.printStructure 2015-09-21 15:48:06 +03:00
Mikhail Glukhikh
c24156ae84 "field": backing field usage deprecated warning, relevant diagnostics tests changed 2015-09-21 15:48:03 +03:00
Mikhail Glukhikh
a1e3471d92 "field": deprecated warnings introduced, compiler tests migrated to the new syntax 2015-09-21 15:48:00 +03:00
Mikhail Glukhikh
028e0ec59a "field": JS translation 2015-09-21 15:47:57 +03:00
Mikhail Glukhikh
094c6cebc3 "field": highlighting fix, including color schemes and example 2015-09-21 15:47:55 +03:00
Mikhail Glukhikh
9939f96c09 "field" reassignment: fix and test 2015-09-21 15:47:52 +03:00
Mikhail Glukhikh
9f640b00d9 "field": synthetic variable creation in accessors, codegen changed accordingly, a set of tests, relevant code fix (j2k) 2015-09-21 15:47:49 +03:00
Pavel V. Talanov
6282a16013 Minor: remove duplicate registering of module name 2015-09-21 14:41:38 +03:00
Dmitry Kovanikov
e4f44d7754 [cli-repl] Small refactoring
Add `flushHistory` to ReplCommandReader
Pass `WhatNextAfterOneLine` to `readLine`
2015-09-21 14:41:37 +03:00
Dmitry Kovanikov
8aa701ec2d [ide-console] Minor: highlight error if its range offsets are equal 2015-09-21 14:41:37 +03:00
Dmitry Kovanikov
cc2e320228 [cli-repl] More accurate line breaks handling 2015-09-21 14:41:36 +03:00
Dmitry Kovanikov
18304c7d7b [cli-repl] Create wrapper for console reader 2015-09-21 14:41:35 +03:00
Dmitry Kovanikov
4aa5a90370 [cli-repl] Minor: change API to support ABI reporting 2015-09-21 14:41:35 +03:00
Dmitry Kovanikov
ad49272b3b [ide-console] Minor: change pathSeparator variable 2015-09-21 14:41:34 +03:00
Pavel V. Talanov
30d675d49f Repl: fix paths on windows 2015-09-21 14:41:34 +03:00
Pavel V. Talanov
8a944e099e Minor: use proper utility in ReplErrorLogger 2015-09-21 14:41:33 +03:00
Dmitry Kovanikov
3f44fe5955 [cli-repl] Optimize System.in to send "change indicator" message only when readLine is called 2015-09-21 14:41:32 +03:00
Dmitry Kovanikov
1f4fab0047 [ide-console] Add all paths of compiled module (production, test) 2015-09-21 14:41:32 +03:00
Dmitry Kovanikov
ac6a9d95af [test] Fix testData for AbstractReplInterpreterTest 2015-09-21 14:41:31 +03:00
Dmitry Kovanikov
9bf0c8453d [cli-repl][ide-console] Add logging of internal errors
Rename `jvmStatic` to `@JvmStatic`
2015-09-21 14:41:30 +03:00
Dmitry Kovanikov
38285496cb [ide-console] Different refactoring
No more redundant trims and adding of line breaks
Remove concurrent map from editors
Rename IconPack to IconWithTooltip
Some minor changes
2015-09-21 14:41:30 +03:00
Dmitry Kovanikov
bd52462420 [ide-console] Add tooltips to all icons 2015-09-21 14:41:29 +03:00
Dmitry Kovanikov
b4224bf9f3 [ide-console][cli-repl] Add more icons for readLine commands 2015-09-21 14:41:29 +03:00
Dmitry Kovanikov
724b208a5d [test] Add readLine() tests 2015-09-21 14:41:28 +03:00
Dmitry Kovanikov
42c0396308 [cli-repl] Support readLine() during repl session 2015-09-21 14:41:27 +03:00
Dmitry Kovanikov
00a117f089 [test] Add tests on simple commands 2015-09-21 14:41:27 +03:00
Dmitry Kovanikov
6d8c6857b8 [ide-console] Add folding to history commands 2015-09-21 14:41:26 +03:00
Dmitry Kovanikov
48866fbeeb [ide-console] Remove INCOMPLETE support from ide console 2015-09-21 14:41:25 +03:00
Dmitry Kovanikov
fcc5fa13f3 [ide-console] Move warning messages about compilation inside consoleView 2015-09-21 14:41:25 +03:00
Dmitry Kovanikov
058b539004 [ide-console][cli-repl] Decorations for smooth console view
Icons on history commands
Linebreaks between `command-result` blocks
Exceptions stacktrace and icons
Bold invitation
2015-09-21 14:41:24 +03:00
Dmitry Kovanikov
3271fae7ac [ide-console] Show warning notification after Build and Restart action in case of failed compilation 2015-09-21 14:41:24 +03:00
Dmitry Kovanikov
43f3c9d603 [ide-console] Disable setting of moduleInfo to console editor JetFile 2015-09-21 14:41:23 +03:00
Dmitry Kovanikov
740f311af6 [test] Fix testOnRunPossibility 2015-09-21 14:41:22 +03:00
Dmitry Kovanikov
3152792860 [ide-console][bug-fixes] Disable process on closed dialog window
Fix history bugs (lost completion focus, occasional flush)
Faster incomplete icon change
Correct console window title
Other small gui decorations
2015-09-21 14:41:22 +03:00
Dmitry Kovanikov
b19010184a [ide-console] String constants small refactoring 2015-09-21 14:41:21 +03:00
Dmitry Kovanikov
27e015c406 [ide-console] Add 'Build and restart' button on console toolbar; 'build and restart' warning notification for outdated classes with action link 2015-09-21 14:41:20 +03:00
Dmitry Kovanikov
5548647fd3 [ide-console] Choose module popup dialog 2015-09-21 14:41:20 +03:00
Dmitry Kovanikov
a17363459a [cli-repl][ide-console] Show runtime errors in IDE console 2015-09-21 14:41:19 +03:00
Dmitry Kovanikov
e23441907c [cli-repl][ide-console] Correct escaping 2015-09-21 14:41:19 +03:00
Dmitry Kovanikov
e4ffe8b145 [ide-console] Load repl with module and its dependencies classpath 2015-09-21 14:41:18 +03:00
Dmitry Kovanikov
cb5ff094bf [ide-console] Highlight repl process output
Add icons on gutter
Send messages to process in xml
2015-09-21 14:41:17 +03:00
Dmitry Kovanikov
cb1756f5fa [cli-repl] Error render and XML-interop with IDE console 2015-09-21 14:41:17 +03:00
Dmitry Kovanikov
a11f411f7d Add kotlin console repl 2015-09-21 14:41:16 +03:00
Dmitry Petrov
80cbee83ee JvmName should have @Retention(AnnotationRetention.BINARY)
(TODO: fix JVM BE)
2015-09-21 14:24:09 +03:00
Dmitry Petrov
da026f1480 Report errors for annotations with BINARY or RUNTIME retention on file classes. 2015-09-21 12:11:53 +03:00
Dmitry Petrov
eba9f0f0ad Change JvmName retention to SOURCE 2015-09-21 12:10:46 +03:00
Dmitry Petrov
7f4ae52517 Generate annotations for single-file classes. 2015-09-21 12:10:40 +03:00
12009 changed files with 281869 additions and 206127 deletions

View File

@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ArtifactManager">
<artifact name="KotlinAndroidExtensions">
<output-path>$PROJECT_DIR$/out/artifacts/KotlinAndroidExtensions</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="lib">
<element id="archive" name="kotlin-android-extensions.jar">
@@ -15,7 +20,6 @@
<element id="archive" name="android-compiler-plugin.jar">
<element id="module-output" name="android-compiler-plugin" />
</element>
<element id="file-copy" path="$PROJECT_DIR$/dist/kotlinc/lib/kotlin-runtime.jar" />
</element>
</root>
</artifact>

View File

@@ -21,6 +21,8 @@
<element id="file-copy" path="$PROJECT_DIR$/resources/kotlinManifest.properties" />
<element id="module-output" name="kotlinr" />
<element id="module-output" name="rmi-interface" />
<element id="module-output" name="deserialization" />
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/native-platform-uberjar.jar" path-in-jar="/" />
</root>
</artifact>
</component>

View File

@@ -45,7 +45,7 @@
<element id="module-output" name="idea-js" />
<element id="module-output" name="container" />
<element id="module-output" name="rmi-interface" />
<element id="module-output" name="kotlinr" />
<element id="module-output" name="idea-repl" />
</element>
<element id="library" level="project" name="javax.inject" />
<element id="directory" name="jps">

View File

@@ -274,7 +274,7 @@
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="jet">
<codeStyleSettings language="kotlin">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />

3
.idea/compiler.xml generated
View File

@@ -5,6 +5,7 @@
<option name="BUILD_PROCESS_HEAP_SIZE" value="2000" />
<excludeFromCompile>
<directory url="file://$PROJECT_DIR$/core/reflection.jvm" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/core/runtime.jvm" includeSubdirectories="true" />
</excludeFromCompile>
<resourceExtensions />
<wildcardResourcePatterns>
@@ -26,4 +27,4 @@
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_STRING" value="-target 1.6" />
</component>
</project>
</project>

View File

@@ -17,6 +17,7 @@
<w>redeclarations</w>
<w>subclassed</w>
<w>subgraph</w>
<w>substep</w>
</words>
</dictionary>
</component>

View File

@@ -9,6 +9,7 @@
<w>inserter</w>
<w>negatable</w>
<w>pparent</w>
<w>precheck</w>
<w>prioritizer</w>
<w>processings</w>
<w>rbrace</w>
@@ -17,6 +18,7 @@
<w>rparenth</w>
<w>selectioner</w>
<w>unpluralize</w>
<w>weighers</w>
</words>
</dictionary>
</component>

View File

@@ -408,7 +408,6 @@
<inspection_tool class="UnnecessaryUnboxing" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UseOfPropertiesAsHashtable" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UtilityClassWithPublicConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="VolatileLongOrDoubleField" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="WaitNotInLoop" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="WaitNotInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="WaitWhileHoldingTwoLocks" enabled="true" level="WARNING" enabled_by_default="true" />

7
.idea/kotlinc.xml generated
View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinCommonCompilerArguments">
<option name="suppressWarnings" value="true" />
</component>
</project>

View File

@@ -5,6 +5,7 @@
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/junit/lib/idea-junit.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/junit/lib/resources_en.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>

View File

@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="native-platform-uberjar">
<CLASSES>
<root url="jar://$PROJECT_DIR$/dependencies/native-platform-uberjar.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@@ -6,6 +6,8 @@
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/testng/lib/testng-plugin.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/testng/lib/testng.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/testng/lib/jcommander.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/testng/lib/resources_en.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>

View File

@@ -8,10 +8,10 @@
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/trove4j_src.jar!/core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/trove4j_src.jar!/test/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/trove4j_src.jar!/util/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/trove4j_src.jar!/generated/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/src/trove4j_src.jar!/core/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/src/trove4j_src.jar!/generated/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/src/trove4j_src.jar!/test/src" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/src/trove4j_src.jar!/util/src" />
</SOURCES>
</library>
</component>

2
.idea/modules.xml generated
View File

@@ -19,6 +19,7 @@
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli-common/cli-common.iml" filepath="$PROJECT_DIR$/compiler/cli/cli-common/cli-common.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli-runner/cli-runner.iml" filepath="$PROJECT_DIR$/compiler/cli/cli-runner/cli-runner.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/compiler/tests/compiler-tests.iml" filepath="$PROJECT_DIR$/compiler/tests/compiler-tests.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/compiler/conditional-preprocessor/conditional-preprocessor.iml" filepath="$PROJECT_DIR$/compiler/conditional-preprocessor/conditional-preprocessor.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/compiler/container/container.iml" filepath="$PROJECT_DIR$/compiler/container/container.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/core/descriptor.loader.java/descriptor.loader.java.iml" filepath="$PROJECT_DIR$/core/descriptor.loader.java/descriptor.loader.java.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/core/descriptors/descriptors.iml" filepath="$PROJECT_DIR$/core/descriptors/descriptors.iml" group="core" />
@@ -36,6 +37,7 @@
<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-js/idea-js.iml" filepath="$PROJECT_DIR$/idea/idea-js/idea-js.iml" group="ide" />
<module fileurl="file://$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" filepath="$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" />
<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" />

View File

@@ -6,7 +6,7 @@
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="MAIN_CLASS_NAME" value="org.jetbrains.kotlin.generators.tests.TestsPackage" />
<option name="MAIN_CLASS_NAME" value="org.jetbrains.kotlin.generators.tests.GenerateTestsKt" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />

View File

@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA" type="Application" factoryName="Application">
<configuration default="false" name="IDEA" type="Application" factoryName="Application" singleton="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=450m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config-idea -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Dkotlin.internal.mode.enabled=true -Didea.additional.classpath=../idea-kotlin-runtime/kotlin-runtime.jar,../idea-kotlin-runtime/kotlin-reflect.jar" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="Application" factoryName="Application">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="Application" factoryName="Application" singleton="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config-idea -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Didea.ProcessCanceledException=disabled -Dkotlin.internal.mode.enabled=true -Didea.additional.classpath=../idea-kotlin-runtime/kotlin-runtime.jar,../idea-kotlin-runtime/kotlin-reflect.jar" />

View File

@@ -47,4 +47,4 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
</module>

View File

@@ -9,16 +9,18 @@ Welcome to [Kotlin](http://kotlinlang.org/)! Some handy links:
* [Kotlin Site](http://kotlinlang.org/)
* [Getting Started Guide](http://kotlinlang.org/docs/tutorials/getting-started.html)
* [Try Kotlin](http://try.kotlinlang.org/)
* [API](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/index.html)
* [Kotlin Standard Library](http://kotlinlang.org/api/latest/jvm/stdlib/index.html)
* [Issue Tracker](http://youtrack.jetbrains.com/issues/KT)
* [Forum](http://devnet.jetbrains.net/community/kotlin?view=discussions)
* [Kotlin Blog](http://blog.jetbrains.com/kotlin/)
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
* [Public Slack channel](http://kotlinslackin.herokuapp.com/)
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
## Editing Kotlin
* [Kotlin IntelliJ IDEA Plugin](http://hadihariri.com/2012/02/17/the-kotlin-journey-part-i-getting-things-set-up/)
* [Kotlin Eclipse Plugin](http://kotlinlang.org/docs/tutorials/getting-started-eclipse.html)
* [Kotlin TextMate Bundle](https://github.com/k33g/kotlin-textmate-bundle#readme)
## Building
@@ -60,7 +62,7 @@ To keep the plugin version in sync with the rest of the team and our [Continuous
you should install the according to the [instructions below](#plugin-for-contributors).
If you want to have an IntelliJ IDEA installation without the Kotlin plugin which is separate to your default IntelliJ IDEA installation which has the Kotlin
plugin [see this document](http://devnet.jetbrains.net/docs/DOC-181) which describes how to have mutliple IntelliJ IDEA installations using different configurations and plugin directories.
plugin [see this document](http://devnet.jetbrains.net/docs/DOC-181) which describes how to have multiple IntelliJ IDEA installations using different configurations and plugin directories.
From this root project there are Run/Debug Configurations for running IDEA or the Compiler Tests for example; so if you want to try out the latest and greatest IDEA plugin
@@ -99,15 +101,22 @@ Then update the list of plugins in "Browse Repositories", you'll see two version
# Contributing
We love contributions! There's [lots to do on Kotlin](http://youtrack.jetbrains.com/issues/KT) and on the [standard library](https://youtrack.jetbrains.com/issues/KT?q=Subtask+of%3A+KT-2554+%23Unresolved) so why not chat with us on the [forum](http://devnet.jetbrains.net/community/kotlin?view=discussions) about what you're interested in doing?
We love contributions! There's [lots to do on Kotlin](http://youtrack.jetbrains.com/issues/KT) and on the
[standard library](https://youtrack.jetbrains.com/issues/KT?q=Subtask+of%3A+KT-2554+%23Unresolved) so why not chat with us
about what you're interested in doing? Please join the #kontributors channel in [our Slack chat](http://kotlinslackin.herokuapp.com/)
and let us know about your plans.
If you want to find some issues to start off with, try [this query](https://youtrack.jetbrains.com/issues?q=tag%3A+%7BUp+For+Grabs%7D+%23Unresolved) which should find all issues that marked as "up-for-grabs".
Currently only committers can assign issues to themselves so just add a comment if you're starting work on it.
A nice gentle way to contribute would be to review the [API docs](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/index.html) and find classes or functions which are not documented very well and submit a patch.
A nice gentle way to contribute would be to review the [standard library docs](http://kotlinlang.org/api/latest/jvm/stdlib/index.html)
and find classes or functions which are not documented very well and submit a patch.
In particular it'd be great if all functions included a nice example of how to use it such as for the <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#filter(kotlin.Function1)">filter()</a> function on Collection. This is implemented using the <a href="https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/src/kotlin/IterablesLazy.kt#L17">@includeFunctionBody</a> macro to include code from a test function. This serves as a double win; the API gets better documented with nice examples to help new users and the code gets more test coverage.
In particular it'd be great if all functions included a nice example of how to use it such as for the
<a href="http://kotlinlang.org/api/latest/jvm/stdlib/kotlin/hash-map-of.html">hashMapOf()</a> function.
This is implemented using the <a href=https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/src/kotlin/collections/Maps.kt#L53">@sample</a>
macro to include code from a test function. This serves as a double win; the API gets better documented with nice examples to help new users and the code gets more test coverage.
Also the [JavaScript translation](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) could really use your help. See the [JavaScript contribution section](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) for more details.

View File

@@ -1,9 +0,0 @@
<root>
<item
name='com.android.tools.idea.gradle.output.parser.PatternAwareOutputParser boolean parse(java.lang.String, com.android.tools.idea.gradle.output.parser.OutputLineReader, java.util.List&lt;com.android.tools.idea.gradle.output.GradleMessage&gt;)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun parse(line: String, reader: OutputLineReader, messages: MutableList&lt;GradleMessage&gt;): Boolean&quot;"/>
</annotation>
</item>
</root>

View File

@@ -19,13 +19,6 @@
name='com.intellij.codeInsight.editorActions.CopyPastePostProcessor T extractTransferableData(java.awt.datatransfer.Transferable) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.codeInsight.editorActions.CopyPastePostProcessor java.util.List&lt;T&gt; collectTransferableData(com.intellij.psi.PsiFile, com.intellij.openapi.editor.Editor, int[], int[])'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun collectTransferableData(file: PsiFile, editor: Editor, startOffsets: IntArray, endOffsets: IntArray): List&lt;T&gt;&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.editorActions.CopyPastePostProcessor java.util.List&lt;T&gt; collectTransferableData(com.intellij.psi.PsiFile, com.intellij.openapi.editor.Editor, int[], int[]) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -42,12 +35,6 @@
name='com.intellij.codeInsight.editorActions.CopyPastePostProcessor java.util.List&lt;T&gt; collectTransferableData(com.intellij.psi.PsiFile, com.intellij.openapi.editor.Editor, int[], int[]) 3'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.codeInsight.editorActions.CopyPastePostProcessor java.util.List&lt;T&gt; extractTransferableData(java.awt.datatransfer.Transferable)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun extractTransferableData(content: Transferable): List&lt;T&gt;&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.editorActions.CopyPastePostProcessor java.util.List&lt;T&gt; extractTransferableData(java.awt.datatransfer.Transferable) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -171,13 +158,6 @@
<item name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandler boolean canSelect(com.intellij.psi.PsiElement) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandler java.util.List&lt;com.intellij.openapi.util.TextRange&gt; select(com.intellij.psi.PsiElement, java.lang.CharSequence, int, com.intellij.openapi.editor.Editor)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List&lt;TextRange&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandler java.util.List&lt;com.intellij.openapi.util.TextRange&gt; select(com.intellij.psi.PsiElement, java.lang.CharSequence, int, com.intellij.openapi.editor.Editor) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -210,13 +190,6 @@
name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase java.util.List&lt;com.intellij.openapi.util.TextRange&gt; expandToWholeLine(java.lang.CharSequence, com.intellij.openapi.util.TextRange, boolean) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase java.util.List&lt;com.intellij.openapi.util.TextRange&gt; select(com.intellij.psi.PsiElement, java.lang.CharSequence, int, com.intellij.openapi.editor.Editor)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List&lt;TextRange&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase java.util.List&lt;com.intellij.openapi.util.TextRange&gt; select(com.intellij.psi.PsiElement, java.lang.CharSequence, int, com.intellij.openapi.editor.Editor) 3'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -1,10 +1,4 @@
<root>
<item
name='com.intellij.codeInsight.intention.IntentionAction boolean isAvailable(com.intellij.openapi.project.Project, com.intellij.openapi.editor.Editor, com.intellij.psi.PsiFile)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun isAvailable(project: Project, editor: Editor, file: PsiFile): Boolean&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.intention.PsiElementBaseIntentionAction boolean isAvailable(com.intellij.openapi.project.Project, com.intellij.openapi.editor.Editor, com.intellij.psi.PsiElement) 1'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -93,12 +93,6 @@
name='com.intellij.codeInsight.lookup.LookupElementDecorator void renderElement(com.intellij.codeInsight.lookup.LookupElementPresentation) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.codeInsight.lookup.LookupElementRenderer void renderElement(T, com.intellij.codeInsight.lookup.LookupElementPresentation)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun renderElement(element: T?, presentation: LookupElementPresentation): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.lookup.LookupElementRenderer void renderElement(T, com.intellij.codeInsight.lookup.LookupElementPresentation) 1'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -3,12 +3,6 @@
name='com.intellij.codeInsight.unwrap.RangeSplitter java.util.List&lt;com.intellij.openapi.util.TextRange&gt; split(com.intellij.openapi.util.TextRange, java.util.List&lt;com.intellij.openapi.util.TextRange&gt;)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.codeInsight.unwrap.ScopeHighlighter ScopeHighlighter(com.intellij.openapi.editor.Editor, com.intellij.util.NotNullFunction&lt;com.intellij.psi.PsiElement,com.intellij.openapi.util.TextRange&gt;)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun ScopeHighlighter(editor: Editor, ranger: NotNullFunction&lt;PsiElement, TextRange&gt;?)&quot;"/>
</annotation>
</item>
<item
name='com.intellij.codeInsight.unwrap.ScopeHighlighter void highlight(com.intellij.psi.PsiElement, java.util.List&lt;com.intellij.psi.PsiElement&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -1,9 +1,4 @@
<root>
<item name='com.intellij.codeInspection.InspectionToolProvider java.lang.Class[] getInspectionClasses()'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun getInspectionClasses(): Array&lt;Class&lt;out Any?&gt;&gt;&quot;"/>
</annotation>
</item>
<item name='com.intellij.codeInspection.SuppressIntentionAction EMPTY_ARRAY'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>

View File

@@ -1,10 +1,4 @@
<root>
<item
name='com.intellij.debugger.actions.JvmSmartStepIntoHandler java.util.List&lt;com.intellij.debugger.actions.SmartStepTarget&gt; findSmartStepTargets(com.intellij.debugger.SourcePosition)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun findSmartStepTargets(position: SourcePosition): List&lt;SmartStepTarget&gt;&quot;"/>
</annotation>
</item>
<item
name='com.intellij.debugger.actions.JvmSmartStepIntoHandler java.util.List&lt;com.intellij.debugger.actions.SmartStepTarget&gt; findSmartStepTargets(com.intellij.debugger.SourcePosition) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -2,13 +2,6 @@
<item name='com.intellij.debugger.engine.DebugProcessImpl com.intellij.debugger.jdi.VirtualMachineProxyImpl getVirtualMachineProxy()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.debugger.engine.FrameExtraVariablesProvider java.util.Set&lt;com.intellij.debugger.engine.evaluation.TextWithImports&gt; collectVariables(com.intellij.debugger.SourcePosition, com.intellij.debugger.engine.evaluation.EvaluationContext, java.util.Set&lt;java.lang.String&gt;)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun collectVariables(sourcePosition: SourcePosition?, evalContext: EvaluationContext?, alreadyCollected: Set&lt;String&gt;?): Set&lt;TextWithImports&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.debugger.engine.MethodFilter boolean locationMatches(com.intellij.debugger.engine.DebugProcessImpl, com.sun.jdi.Location) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -8,23 +8,7 @@
<item name='com.intellij.ide.hierarchy.HierarchyBrowserBaseEx myBuilders'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='com.intellij.ide.hierarchy.HierarchyBrowserBaseEx void createTrees(java.util.Map&lt;java.lang.String,javax.swing.JTree&gt;)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun createTrees(trees: MutableMap&lt;String, JTree&gt;): Unit&quot;"/>
</annotation>
</item>
<item name='com.intellij.ide.hierarchy.HierarchyBrowserBaseEx void prependActions(com.intellij.openapi.actionSystem.DefaultActionGroup)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun prependActions(actionGroup: DefaultActionGroup): Unit&quot;"/>
</annotation>
</item>
<item name='com.intellij.ide.hierarchy.HierarchyNodeDescriptor myHighlightedText'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.ide.hierarchy.HierarchyProvider com.intellij.ide.hierarchy.HierarchyBrowser createHierarchyBrowser(com.intellij.psi.PsiElement)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun createHierarchyBrowser(target: PsiElement): HierarchyBrowser&quot;"/>
</annotation>
</item>
</root>

View File

@@ -1,8 +0,0 @@
<root>
<item
name='com.intellij.ide.hierarchy.type.TypeHierarchyBrowser void prependActions(com.intellij.openapi.actionSystem.DefaultActionGroup)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun prependActions(actionGroup: DefaultActionGroup): Unit&quot;"/>
</annotation>
</item>
</root>

View File

@@ -1,8 +0,0 @@
<root>
<item
name='com.intellij.ide.util.treeView.smartTree.NodeProvider java.util.Collection&lt;T&gt; provideNodes(com.intellij.ide.util.treeView.smartTree.TreeElement)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun provideNodes(node: TreeElement): Collection&lt;T&gt;&quot;"/>
</annotation>
</item>
</root>

View File

@@ -3,22 +3,7 @@
name='com.intellij.openapi.util.Conditions com.intellij.openapi.util.Condition&lt;T&gt; or(com.intellij.openapi.util.Condition&lt;T&gt;, com.intellij.openapi.util.Condition&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='com.intellij.openapi.util.Key T get(com.intellij.openapi.util.UserDataHolder, T)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun get(holder: UserDataHolder?, defaultValue: T): T&quot;"/>
</annotation>
</item>
<item name='com.intellij.openapi.util.Key com.intellij.openapi.util.Key&lt;T&gt; create(java.lang.String)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='com.intellij.openapi.util.Pair A getFirst()'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun getFirst(): A&quot;"/>
</annotation>
</item>
<item name='com.intellij.openapi.util.Pair B getSecond()'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun getSecond(): B&quot;"/>
</annotation>
</item>
</root>

View File

@@ -1,10 +1,4 @@
<root>
<item
name='com.intellij.platform.ProjectTemplatesFactory com.intellij.platform.ProjectTemplate[] createTemplates(java.lang.String, com.intellij.ide.util.projectWizard.WizardContext)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun createTemplates(group: String, context: WizardContext?): Array&lt;out ProjectTemplate&gt;&quot;"/>
</annotation>
</item>
<item
name='com.intellij.platform.ProjectTemplatesFactory com.intellij.platform.ProjectTemplate[] createTemplates(java.lang.String, com.intellij.ide.util.projectWizard.WizardContext) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -19,26 +19,13 @@
name='com.intellij.psi.search.searches.OverridingMethodsSearch com.intellij.util.Query&lt;com.intellij.psi.PsiMethod&gt; search(com.intellij.psi.PsiMethod, com.intellij.psi.search.SearchScope, boolean)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.psi.search.searches.ReferencesSearch com.intellij.util.Query&lt;com.intellij.psi.PsiReference&gt; search(com.intellij.psi.PsiElement)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun search(element: PsiElement): Query&lt;PsiReference&gt;&quot;"/>
</annotation>
</item>
<item
name='com.intellij.psi.search.searches.ReferencesSearch com.intellij.util.Query&lt;com.intellij.psi.PsiReference&gt; search(com.intellij.psi.PsiElement, com.intellij.psi.search.SearchScope)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun search(element: PsiElement, searchScope: SearchScope): Query&lt;PsiReference&gt;&quot;"/>
</annotation>
</item>
<item
name='com.intellij.psi.search.searches.ReferencesSearch com.intellij.util.Query&lt;com.intellij.psi.PsiReference&gt; search(com.intellij.psi.PsiElement, com.intellij.psi.search.SearchScope, boolean)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun search(element: PsiElement, searchScope: SearchScope, ignoreAccessScope: Boolean): Query&lt;PsiReference&gt;&quot;"/>
</annotation>
</item>
<item
name='com.intellij.psi.search.searches.ReferencesSearch com.intellij.util.Query&lt;com.intellij.psi.PsiReference&gt; search(com.intellij.psi.search.searches.ReferencesSearch.SearchParameters)'>

View File

@@ -1,10 +1,4 @@
<root>
<item
name='com.intellij.refactoring.BaseRefactoringProcessor boolean preprocessUsages(com.intellij.openapi.util.Ref&lt;com.intellij.usageView.UsageInfo[]&gt;)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun preprocessUsages(refUsages: Ref&lt;Array&lt;UsageInfo&gt;&gt;): Boolean&quot;"/>
</annotation>
</item>
<item name='com.intellij.refactoring.BaseRefactoringProcessor myProject'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>

View File

@@ -7,13 +7,6 @@
name='com.intellij.refactoring.move.MoveHandlerDelegate boolean isValidTarget(com.intellij.psi.PsiElement, com.intellij.psi.PsiElement[]) 1'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.refactoring.move.MoveHandlerDelegate boolean tryToMove(com.intellij.psi.PsiElement, com.intellij.openapi.project.Project, com.intellij.openapi.actionSystem.DataContext, com.intellij.psi.PsiReference, com.intellij.openapi.editor.Editor)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun tryToMove(element: PsiElement, project: Project, dataContext: DataContext?, reference: PsiReference?, editor: Editor?): Boolean&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.move.MoveHandlerDelegate com.intellij.psi.PsiElement[] adjustForMove(com.intellij.openapi.project.Project, com.intellij.psi.PsiElement[], com.intellij.psi.PsiElement) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -1,11 +1,4 @@
<root>
<item
name='com.intellij.refactoring.move.moveFilesOrDirectories.MoveFileHandler java.util.List&lt;com.intellij.usageView.UsageInfo&gt; findUsages(com.intellij.psi.PsiFile, com.intellij.psi.PsiDirectory, boolean, boolean)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun findUsages(psiFile: PsiFile, newParent: PsiDirectory, searchInComments: Boolean, searchInNonJavaFiles: Boolean): List&lt;UsageInfo&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.move.moveFilesOrDirectories.MoveFileHandler void prepareMovedFile(com.intellij.psi.PsiFile, com.intellij.psi.PsiDirectory, java.util.Map&lt;com.intellij.psi.PsiElement,com.intellij.psi.PsiElement&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -1,11 +1,4 @@
<root>
<item
name='com.intellij.refactoring.rename.RenamePsiElementProcessor void findCollisions(com.intellij.psi.PsiElement, java.lang.String, java.util.Map&lt;? extends com.intellij.psi.PsiElement,java.lang.String&gt;, java.util.List&lt;com.intellij.usageView.UsageInfo&gt;)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun findCollisions(element: PsiElement?, newName: String?, allRenames: Map&lt;out PsiElement?, String&gt;, result: MutableList&lt;UsageInfo&gt;): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.rename.RenamePsiElementProcessor void findCollisions(com.intellij.psi.PsiElement, java.lang.String, java.util.Map&lt;? extends com.intellij.psi.PsiElement,java.lang.String&gt;, java.util.List&lt;com.intellij.usageView.UsageInfo&gt;) 2'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -22,13 +15,6 @@
name='com.intellij.refactoring.rename.RenamePsiElementProcessor void findExistingNameConflicts(com.intellij.psi.PsiElement, java.lang.String, com.intellij.util.containers.MultiMap&lt;com.intellij.psi.PsiElement,java.lang.String&gt;, java.util.Map&lt;com.intellij.psi.PsiElement,java.lang.String&gt;) 2'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='com.intellij.refactoring.rename.RenamePsiElementProcessor void prepareRenaming(com.intellij.psi.PsiElement, java.lang.String, java.util.Map&lt;com.intellij.psi.PsiElement,java.lang.String&gt;, com.intellij.psi.search.SearchScope)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun prepareRenaming(element: PsiElement?, newName: String?, allRenames: MutableMap&lt;PsiElement, String&gt;, scope: SearchScope): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.rename.RenamePsiElementProcessor void prepareRenaming(com.intellij.psi.PsiElement, java.lang.String, java.util.Map&lt;com.intellij.psi.PsiElement,java.lang.String&gt;, com.intellij.psi.search.SearchScope) 2'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -1,98 +0,0 @@
<root>
<item
name='com.intellij.refactoring.safeDelete.JavaSafeDeleteDelegate void createUsageInfoForParameter(com.intellij.psi.PsiReference, java.util.List&lt;com.intellij.usageView.UsageInfo&gt;, com.intellij.psi.PsiParameter, com.intellij.psi.PsiMethod)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun createUsageInfoForParameter(reference: PsiReference, usages: MutableList&lt;UsageInfo&gt;, parameter: PsiParameter, method: PsiMethod): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.JavaSafeDeleteProcessor java.util.Collection&lt;? extends com.intellij.psi.PsiElement&gt; getElementsToSearch(com.intellij.psi.PsiElement, com.intellij.openapi.module.Module, java.util.Collection&lt;com.intellij.psi.PsiElement&gt;)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun getElementsToSearch(element: PsiElement, module: Module?, allElementsToDelete: Collection&lt;PsiElement&gt;): Collection&lt;out PsiElement&gt;?&quot;"/>
</annotation>
</item>
<item name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate boolean handlesElement(com.intellij.psi.PsiElement)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun handlesElement(element: PsiElement): Boolean&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate boolean isToSearchForTextOccurrences(com.intellij.psi.PsiElement)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun isToSearchForTextOccurrences(element: PsiElement): Boolean&quot;"/>
</annotation>
</item>
<item name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate boolean isToSearchInComments(com.intellij.psi.PsiElement)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun isToSearchInComments(element: PsiElement): Boolean&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate com.intellij.refactoring.safeDelete.NonCodeUsageSearchInfo findUsages(com.intellij.psi.PsiElement, com.intellij.psi.PsiElement[], java.util.List&lt;com.intellij.usageView.UsageInfo&gt;)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun findUsages(element: PsiElement, allElementsToDelete: Array&lt;out PsiElement&gt;, result: MutableList&lt;UsageInfo&gt;): NonCodeUsageSearchInfo?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate com.intellij.usageView.UsageInfo[] preprocessUsages(com.intellij.openapi.project.Project, com.intellij.usageView.UsageInfo[])'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun preprocessUsages(project: Project, usages: Array&lt;out UsageInfo&gt;): Array&lt;UsageInfo&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate java.util.Collection&lt;? extends com.intellij.psi.PsiElement&gt; getElementsToSearch(com.intellij.psi.PsiElement, java.util.Collection&lt;com.intellij.psi.PsiElement&gt;)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun getElementsToSearch(element: PsiElement, allElementsToDelete: Collection&lt;PsiElement&gt;): Collection&lt;out PsiElement&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate java.util.Collection&lt;com.intellij.psi.PsiElement&gt; getAdditionalElementsToDelete(com.intellij.psi.PsiElement, java.util.Collection&lt;com.intellij.psi.PsiElement&gt;, boolean)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun getAdditionalElementsToDelete(element: PsiElement, allElementsToDelete: Collection&lt;PsiElement&gt;, askUser: Boolean): MutableCollection&lt;PsiElement&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate java.util.Collection&lt;java.lang.String&gt; findConflicts(com.intellij.psi.PsiElement, com.intellij.psi.PsiElement[])'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun findConflicts(element: PsiElement, allElementsToDelete: Array&lt;out PsiElement&gt;): MutableCollection&lt;String&gt;?&quot;"/>
</annotation>
</item>
<item name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate void prepareForDeletion(com.intellij.psi.PsiElement)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun prepareForDeletion(element: PsiElement): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate void setToSearchForTextOccurrences(com.intellij.psi.PsiElement, boolean)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun setToSearchForTextOccurrences(element: PsiElement, enabled: Boolean): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegate void setToSearchInComments(com.intellij.psi.PsiElement, boolean)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun setToSearchInComments(element: PsiElement, enabled: Boolean): Unit&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegateBase java.util.Collection&lt;? extends com.intellij.psi.PsiElement&gt; getElementsToSearch(com.intellij.psi.PsiElement, com.intellij.openapi.module.Module, java.util.Collection&lt;com.intellij.psi.PsiElement&gt;)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun getElementsToSearch(element: PsiElement, module: Module?, allElementsToDelete: Collection&lt;PsiElement&gt;): Collection&lt;out PsiElement&gt;?&quot;"/>
</annotation>
</item>
<item
name='com.intellij.refactoring.safeDelete.SafeDeleteProcessorDelegateBase java.util.Collection&lt;? extends com.intellij.psi.PsiElement&gt; getElementsToSearch(com.intellij.psi.PsiElement, java.util.Collection&lt;com.intellij.psi.PsiElement&gt;)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value"
val="&quot;fun getElementsToSearch(element: PsiElement, allElementsToDelete: Collection&lt;PsiElement&gt;): Collection&lt;out PsiElement&gt;?&quot;"/>
</annotation>
</item>
</root>

View File

@@ -6,11 +6,6 @@
name='com.intellij.testFramework.fixtures.CodeInsightTestFixture com.intellij.openapi.vfs.VirtualFile copyDirectoryToProject(java.lang.String, java.lang.String)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='com.intellij.testFramework.fixtures.CodeInsightTestFixture void assertPreferredCompletionItems(int, java.lang.String...)'>
<annotation name='jet.runtime.typeinfo.KotlinSignature'>
<val name="value" val="&quot;fun assertPreferredCompletionItems(selected: Int, vararg expected: String)&quot;"/>
</annotation>
</item>
<item name='com.intellij.testFramework.fixtures.IdeaProjectTestFixture com.intellij.openapi.project.Project getProject()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>

View File

@@ -1,8 +0,0 @@
<root>
<item
name='com.intellij.ui.classFilter.DebuggerClassFilterProvider java.util.List&lt;com.intellij.ui.classFilter.ClassFilter&gt; getFilters()'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value" val="&quot;fun getFilters(): List&lt;ClassFilter&gt;?&quot;"/>
</annotation>
</item>
</root>

View File

@@ -1,9 +0,0 @@
<root>
<item
name='com.intellij.xdebugger.settings.XDebuggerSettings java.util.Collection&lt;? extends com.intellij.openapi.options.Configurable&gt; createConfigurables(com.intellij.xdebugger.settings.DebuggerSettingsCategory)'>
<annotation name='kotlin.jvm.KotlinSignature'>
<val name="value"
val="&quot;fun createConfigurables(category: DebuggerSettingsCategory): Collection&lt;out Configurable?&gt;&quot;"/>
</annotation>
</item>
</root>

View File

@@ -52,7 +52,7 @@ public class Kotlin2JsTask : KotlinCompilerBaseTask() {
// TODO: write test
library?.let {
args.add("-library-files")
args.add(it.list().map { File(it).canonicalPath }.join(separator = ","))
args.add(it.list().joinToString(separator = ",") { File(it).canonicalPath })
}
outputPrefix?.let {

View File

@@ -23,19 +23,11 @@ import java.io.File.pathSeparator
public class Kotlin2JvmTask : KotlinCompilerBaseTask() {
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
public var externalAnnotations: Path? = null
public var includeRuntime: Boolean = true
public var moduleName: String? = null
private var compileClasspath: Path? = null
public fun createExternalAnnotations(): Path {
if (externalAnnotations == null) {
externalAnnotations = Path(getProject())
}
return externalAnnotations!!.createPath()
}
public fun setClasspath(classpath: Path) {
if (compileClasspath == null) {
compileClasspath = classpath
@@ -62,12 +54,7 @@ public class Kotlin2JvmTask : KotlinCompilerBaseTask() {
compileClasspath?.let {
args.add("-classpath")
args.add(it.list().join(pathSeparator))
}
externalAnnotations?.let {
args.add("-annotations")
args.add(it.list().join(pathSeparator))
args.add(it.list().joinToString(pathSeparator))
}

View File

@@ -1,165 +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.ant;
import kotlin.KotlinPackage;
import kotlin.jvm.functions.Function1;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.MagicNames;
import org.apache.tools.ant.taskdefs.Javac;
import org.apache.tools.ant.taskdefs.compilers.Javac13;
import org.apache.tools.ant.taskdefs.condition.AntVersion;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.apache.tools.ant.Project.MSG_WARN;
public class KotlinCompilerAdapter extends Javac13 {
private static final List<String> KOTLIN_EXTENSIONS = Arrays.asList("kt", "kts");
private Path externalAnnotations;
private String moduleName;
public List<Commandline.Argument> additionalArguments = new ArrayList<Commandline.Argument>(0);
public void setExternalAnnotations(Path externalAnnotations) {
this.externalAnnotations = externalAnnotations;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public Path createExternalAnnotations() {
if (externalAnnotations == null) {
externalAnnotations = new Path(getProject());
}
return externalAnnotations.createPath();
}
public Commandline.Argument createCompilerArg() {
Commandline.Argument argument = new Commandline.Argument();
additionalArguments.add(argument);
return argument;
}
@Override
public String[] getSupportedFileExtensions() {
List<String> result = KotlinPackage.plus(Arrays.asList(super.getSupportedFileExtensions()), KOTLIN_EXTENSIONS);
//noinspection SSBasedInspection
return result.toArray(new String[result.size()]);
}
@Override
public boolean execute() throws BuildException {
Javac javac = getJavac();
checkAntVersion();
Kotlin2JvmTask kotlinc = new Kotlin2JvmTask();
kotlinc.setFailOnError(javac.getFailonerror());
kotlinc.setOutput(javac.getDestdir());
Path classpath = javac.getClasspath();
if (classpath != null) {
kotlinc.setClasspath(classpath);
}
// We use the provided src dir instead of compileList, because the latter is insane:
// it is constructed only of sources which are newer than classes with the same name
kotlinc.setSrc(javac.getSrcdir());
kotlinc.setExternalAnnotations(externalAnnotations);
if (moduleName == null) {
moduleName = AntPackage.getDefaultModuleName(javac);
}
kotlinc.setModuleName(moduleName);
kotlinc.getAdditionalArguments().addAll(additionalArguments);
// Javac13#execute passes everything in compileList to javac, which doesn't recognize .kt files
File[] compileListForJavac = filterOutKotlinSources(compileList);
boolean hasKotlinFilesInSources = compileListForJavac.length < compileList.length;
if (hasKotlinFilesInSources) {
kotlinc.execute();
if (!Integer.valueOf(0).equals(kotlinc.getExitCode())) {
// Don't run javac if failOnError = false and there were errors on Kotlin sources
return false;
}
}
else {
// This is needed for addRuntimeToJavacClasspath, where kotlinc arguments will be used.
kotlinc.fillArguments();
}
javac.log("Running javac...");
compileList = compileListForJavac;
addRuntimeToJavacClasspath(kotlinc);
return compileList.length == 0 || super.execute();
}
private void addRuntimeToJavacClasspath(@NotNull Kotlin2JvmTask kotlinc) {
for (String arg : kotlinc.getArgs()) {
// If "-no-stdlib" was specified explicitly, probably the user also wanted the javac classpath to not have it
if ("-no-stdlib".equals(arg)) return;
}
if (compileClasspath == null) {
compileClasspath = new Path(getProject());
}
compileClasspath.add(new Path(getProject(), KotlinAntTaskUtil.INSTANCE$.getRuntimeJar().getAbsolutePath()));
}
private void checkAntVersion() {
AntVersion checkVersion = new AntVersion();
checkVersion.setAtLeast("1.8.2");
if (!checkVersion.eval()) {
getJavac().log("<withKotlin> task requires Ant of version at least 1.8.2 to operate reliably. " +
"Please upgrade or, as a workaround, make sure you have at least one Java source and " +
"the output directory is clean before running this task. " +
"You have: " + getProject().getProperty(MagicNames.ANT_VERSION), MSG_WARN);
}
}
@NotNull
private static File[] filterOutKotlinSources(@NotNull File[] files) {
List<File> nonKotlinSources = KotlinPackage.filterNot(files, new Function1<File, Boolean>() {
@Override
public Boolean invoke(File file) {
for (String extension : KOTLIN_EXTENSIONS) {
if (file.getPath().endsWith("." + extension)) return true;
}
return false;
}
});
return nonKotlinSources.toArray(new File[nonKotlinSources.size()]);
}
}

View File

@@ -0,0 +1,131 @@
/*
* 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.ant
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.MagicNames
import org.apache.tools.ant.Project.MSG_WARN
import org.apache.tools.ant.taskdefs.compilers.Javac13
import org.apache.tools.ant.taskdefs.condition.AntVersion
import org.apache.tools.ant.types.Commandline
import org.apache.tools.ant.types.Path
import java.io.File
import java.util.*
class KotlinCompilerAdapter : Javac13() {
var moduleName: String? = null
var additionalArguments: MutableList<Commandline.Argument> = ArrayList(0)
fun createCompilerArg(): Commandline.Argument {
val argument = Commandline.Argument()
additionalArguments.add(argument)
return argument
}
override fun getSupportedFileExtensions(): Array<String> {
return super.getSupportedFileExtensions() + KOTLIN_EXTENSIONS
}
@Throws(BuildException::class)
override fun execute(): Boolean {
val javac = javac
checkAntVersion()
val kotlinc = Kotlin2JvmTask()
kotlinc.failOnError = javac.failonerror
kotlinc.output = javac.destdir
val classpath = javac.classpath
if (classpath != null) {
kotlinc.setClasspath(classpath)
}
// We use the provided src dir instead of compileList, because the latter is insane:
// it is constructed only of sources which are newer than classes with the same name
kotlinc.src = javac.srcdir
if (moduleName == null) {
moduleName = javac.defaultModuleName
}
kotlinc.moduleName = moduleName
kotlinc.additionalArguments.addAll(additionalArguments)
// Javac13#execute passes everything in compileList to javac, which doesn't recognize .kt files
val compileListForJavac = filterOutKotlinSources(compileList)
val hasKotlinFilesInSources = compileListForJavac.size() < compileList.size()
if (hasKotlinFilesInSources) {
kotlinc.execute()
if (kotlinc.exitCode != 0) {
// Don't run javac if failOnError = false and there were errors on Kotlin sources
return false
}
}
else {
// This is needed for addRuntimeToJavacClasspath, where kotlinc arguments will be used.
kotlinc.fillArguments()
}
javac.log("Running javac...")
compileList = compileListForJavac
addRuntimeToJavacClasspath(kotlinc)
return compileList.isEmpty() || super.execute()
}
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 (compileClasspath == null) {
compileClasspath = Path(getProject())
}
compileClasspath.add(Path(getProject(), KotlinAntTaskUtil.runtimeJar.absolutePath))
}
private fun checkAntVersion() {
val checkVersion = AntVersion()
checkVersion.atLeast = "1.8.2"
if (!checkVersion.eval()) {
javac.log("<withKotlin> task requires Ant of version at least 1.8.2 to operate reliably. " +
"Please upgrade or, as a workaround, make sure you have at least one Java source and " +
"the output directory is clean before running this task. " +
"You have: " + getProject().getProperty(MagicNames.ANT_VERSION), MSG_WARN)
}
}
companion object {
private val KOTLIN_EXTENSIONS = Arrays.asList("kt", "kts")
private fun filterOutKotlinSources(files: Array<File>): Array<File> {
return files.filterNot {
for (extension in KOTLIN_EXTENSIONS) {
if (it.path.endsWith("." + extension)) return@filterNot true
}
false
}.toTypedArray()
}
}
}

View File

@@ -27,7 +27,7 @@ import java.io.PrintStream
public abstract class KotlinCompilerBaseTask : Task() {
protected abstract val compilerFqName: String
protected val args: MutableList<String> = arrayListOf()
public val args: MutableList<String> = arrayListOf()
public var src: Path? = null
public var output: File? = null
@@ -40,7 +40,7 @@ public abstract class KotlinCompilerBaseTask : Task() {
public val additionalArguments: MutableList<Commandline.Argument> = arrayListOf()
internal var exitCode: Int? = null
public var exitCode: Int? = null
public fun createSrc(): Path {
val srcPath = src

View File

@@ -1,6 +1,4 @@
<project name="Kotlin" default="dist" xmlns:if="ant:if" xmlns:unless="ant:unless">
<include file="jslib_files.xml" />
<property file="resources/kotlinManifest.properties"/>
<!-- Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build -->
@@ -16,6 +14,7 @@
<property name="bootstrap.reflect" value="${bootstrap.compiler.home}/lib/kotlin-reflect.jar"/>
<property name="output" value="${basedir}/dist"/>
<property name="intermediate-sources" value="out/src" />
<property name="kotlin-home" value="${output}/kotlinc"/>
<property name="build.number" value="snapshot"/>
<property name="bootstrap.build.no.tests" value="false"/>
@@ -26,8 +25,6 @@
<property name="java.target" value="1.6"/>
<property name="external.annotations.path" value="${basedir}/annotations"/>
<property name="dependencies.dir" value="${basedir}/dependencies"/>
<condition property="bootstrap.or.local.build" value="true">
@@ -39,6 +36,8 @@
</or>
</condition>
<include file="jslib_files.xml" />
<!--
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,
@@ -86,14 +85,14 @@
<include name="compiler/builtins-serializer/src"/>
<include name="compiler/cli/src"/>
<include name="compiler/cli/cli-common/src"/>
<include name="compiler/rmi/rmi-server/src"/>
<include name="compiler/rmi/rmi-interface/src"/>
<include name="compiler/conditional-preprocessor/src/"/>
<include name="compiler/container/src"/>
<include name="compiler/frontend/src"/>
<include name="compiler/frontend.java/src"/>
<include name="compiler/light-classes/src"/>
<include name="compiler/plugin-api/src"/>
<include name="plugins/annotation-collector/src"/>
<include name="compiler/rmi/rmi-server/src"/>
<include name="compiler/rmi/rmi-interface/src"/>
<include name="compiler/serialization/src"/>
<include name="compiler/util/src"/>
<include name="js/js.dart-ast/src"/>
@@ -102,6 +101,7 @@
<include name="js/js.inliner/src"/>
<include name="js/js.parser/src"/>
<include name="js/js.serializer/src"/>
<include name="plugins/annotation-collector/src"/>
</dirset>
<property name="idea.out" value="${basedir}/out/production"/>
@@ -117,6 +117,7 @@
<include name="backend-common/**"/>
<include name="cli/**"/>
<include name="cli-common/**"/>
<include name="conditional-preprocessor/**"/>
<include name="rmi-server/**"/>
<include name="rmi-interface/**"/>
<include name="util/**"/>
@@ -202,6 +203,7 @@
<fileset dir="compiler/builtins-serializer/src"/>
<fileset dir="compiler/cli/src"/>
<fileset dir="compiler/cli/cli-common/src"/>
<fileset dir="compiler/conditional-preprocessor/src"/>
<fileset dir="compiler/rmi/rmi-server/src"/>
<fileset dir="compiler/rmi/rmi-interface/src"/>
<fileset dir="compiler/container/src"/>
@@ -304,6 +306,8 @@
<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="${output}/${compiled.builtins.js}">
<src>
<fileset refid="kotlin.builtin.files"/>
@@ -446,7 +450,7 @@
</assertions>
<arg value="-cp"/>
<arg value="${bootstrap.compiler.home}/lib/kotlin-compiler.jar"/>
<arg value="org.jetbrains.kotlin.serialization.builtins.BuiltinsPackage"/>
<arg value="org.jetbrains.kotlin.serialization.builtins.RunKt"/>
<arg value="${output}/builtins"/>
<arg value="core/builtins/native"/>
<arg value="core/builtins/src"/>
@@ -464,8 +468,10 @@
<include name="kotlin/**"/>
<exclude name="kotlin/internal/**"/>
</fileset>
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/frontend.java/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/backend/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/cli/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/resources" includes="kotlinManifest.properties"/>
<fileset dir="idea/src">
@@ -476,7 +482,7 @@
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar" excludes="util.jar"/>
<zipfileset src="${idea.sdk}/lib/jna-utils.jar"/>
<zipfileset src="${idea.sdk}/lib/jna-platform.jar"/>
<zipfileset src="${idea.sdk}/lib/oromatcher.jar"/>
<zipfileset src="${idea.sdk}/jps/jps-model.jar"/>
<zipfileset src="${dependencies.dir}/jline.jar"/>
@@ -522,7 +528,7 @@
<javac2 destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<withKotlin externalannotations="${external.annotations.path}" modulename="kotlin-compiler"/>
<withKotlin modulename="kotlin-compiler"/>
<skip pattern="kotlin/jvm/internal/.*"/>
<src refid="compilerSources.path"/>
<classpath refid="classpath"/>
@@ -546,11 +552,21 @@
<proguard configuration="${basedir}/compiler/compiler.pro"/>
</sequential>
<jar jarfile="${output}/kotlin-compiler-for-maven.jar">
<jar jarfile="${output}/kotlin-compiler-for-maven.jar" duplicate="preserve">
<patternset id="lib.metainf.patternset">
<include name="**"/>
<exclude name="META-INF/build.txt"/>
<exclude name="META-INF/MANIFEST.MF"/>
</patternset>
<!-- TODO: don't include both to the jar: it's impossible to test changes to core in the local maven build without bootstrap -->
<zipfileset src="${kotlin-home}/lib/kotlin-compiler.jar" includes="**"/>
<zipfileset src="${bootstrap.runtime}" includes="**" />
<zipfileset src="${bootstrap.reflect}" includes="**" />
<zipfileset src="${bootstrap.runtime}">
<patternset refid="lib.metainf.patternset"/>
</zipfileset>
<zipfileset src="${bootstrap.reflect}">
<patternset refid="lib.metainf.patternset"/>
</zipfileset>
<manifest>
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
@@ -575,11 +591,13 @@
<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>
</kotlinc>
<jar destfile="${kotlin-home}/lib/kotlinr.jar">
<fileset dir="${output}/classes/kotlinr"/>
<zipfileset src="${dependencies.dir}/native-platform-uberjar.jar" includes="**" />
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
</jar>
</target>
@@ -611,7 +629,7 @@
<cleandir dir="${output}/classes/ant"/>
<javac2 destdir="${output}/classes/ant" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<withKotlin externalannotations="${external.annotations.path}" modulename="kotlin-ant-tools"/>
<withKotlin modulename="kotlin-ant-tools"/>
<skip pattern="kotlin/jvm/internal/.*"/>
<src>
<dirset dir="${basedir}/ant">
@@ -671,6 +689,7 @@
<macrodef name="new-kotlinc">
<attribute name="output"/>
<attribute name="moduleName"/>
<attribute name="additionalOptions" default=""/>
<element name="src"/>
<element name="class-path"/>
@@ -703,7 +722,7 @@
<arg value="-d"/>
<arg value="@{output}"/>
<arg value="-no-stdlib"/>
<arg value="-Xmultifile-package-facades"/>
<arg line="@{additionalOptions}"/>
<arg value="-classpath"/>
<arg value="${toString:classpath.path}"/>
<arg value="-module-name"/>
@@ -722,6 +741,29 @@
</sequential>
</macrodef>
<macrodef name="kotlin-pp">
<attribute name="src"/>
<attribute name="output"/>
<attribute name="profile"/>
<sequential>
<java classname="org.jetbrains.kotlin.preloading.Preloader" failonerror="true" fork="true" maxmemory="${max.heap.size.for.forked.jvm}">
<classpath>
<pathelement location="${kotlin-home}/lib/kotlin-preloader.jar"/>
</classpath>
<assertions>
<enable/>
</assertions>
<arg value="-cp"/>
<arg value="${kotlin-home}/lib/kotlin-compiler.jar"/>
<arg value="org.jetbrains.kotlin.preprocessor.PreprocessorCLI"/>
<arg value="@{src}"/>
<arg value="@{output}"/>
<arg value="@{profile}"/>
</java>
</sequential>
</macrodef>
<target name="builtins">
<new-kotlinc output="${output}/classes/builtins" moduleName="kotlin-builtins">
<src>
@@ -817,6 +859,7 @@
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-reflect-before-jarjar.jar" implementation-title="${manifest.impl.title.kotlin.jvm.reflect}">
<jar-content>
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="META-INF/services/**"/>
<fileset dir="${output}/classes/reflection"/>
<fileset dir="${output}/classes/core"/>
<zipfileset src="${protobuf-lite.jar}"/>
@@ -917,7 +960,7 @@
<javac2 destdir="${output}/classes/idea-analysis" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<withKotlin externalannotations="${external.annotations.path}" modulename="kotlin-for-upsource"/>
<withKotlin modulename="kotlin-for-upsource"/>
<skip pattern="kotlin/jvm/internal/.*"/>
<src>
<dirset dir="${basedir}/idea/ide-common" includes="src"/>
@@ -941,8 +984,10 @@
<include name="kotlin/**"/>
<exclude name="kotlin/internal/**"/>
</fileset>
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/frontend.java/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/backend/src" includes="META-INF/services/**"/>
<fileset dir="${basedir}/compiler/cli/src" includes="META-INF/services/**"/>
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
<zipgroupfileset file="${kotlin-home}/lib/kotlin-runtime.jar"/>

View File

@@ -22,7 +22,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.jetbrains.kotlin.utils.UtilsPackage;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import java.util.ArrayList;
import java.util.List;
@@ -90,7 +90,7 @@ public class AntRunner {
Thread.sleep(20000);
}
catch (InterruptedException e) {
throw UtilsPackage.rethrow(e);
throw ExceptionUtilsKt.rethrow(e);
}
return false;
}

View File

@@ -23,16 +23,16 @@ 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.OutputUtilsPackage;
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
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.generators.tests.generator.TestGeneratorUtil;
import org.jetbrains.kotlin.idea.JetFileType;
import org.jetbrains.kotlin.psi.JetFile;
import org.jetbrains.kotlin.idea.KotlinFileType;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.test.ConfigurationKind;
import org.jetbrains.kotlin.test.JetTestUtils;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestJdkKind;
import org.jetbrains.kotlin.utils.Printer;
import org.junit.Assert;
@@ -133,7 +133,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
private class FilesWriter {
private final boolean isFullJdk;
public List<JetFile> files = new ArrayList<JetFile>();
public List<KtFile> files = new ArrayList<KtFile>();
private KotlinCoreEnvironment environment;
private FilesWriter(boolean isFullJdk) {
@@ -143,12 +143,10 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
private KotlinCoreEnvironment createEnvironment(boolean isFullJdk) {
return isFullJdk ?
JetTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
myTestRootDisposable, ConfigurationKind.ALL, TestJdkKind.FULL_JDK
) :
JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(
myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS
);
KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable);
}
public boolean shouldWriteFilesOnDisk() {
@@ -163,11 +161,11 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
public void writeFilesOnDisk() {
writeFiles(files);
files = new ArrayList<JetFile>();
files = new ArrayList<KtFile>();
environment = createEnvironment(isFullJdk);
}
private void writeFiles(List<JetFile> filesToCompile) {
private void writeFiles(List<KtFile> filesToCompile) {
System.out.println("Generating " + filesToCompile.size() + " files...");
OutputFileCollection outputFiles;
try {
@@ -184,7 +182,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
}
Assert.assertTrue("Cannot create directory for compiled files", outputDir.exists());
OutputUtilsPackage.writeAllTo(outputFiles, outputDir);
OutputUtilsKt.writeAllTo(outputFiles, outputDir);
}
}
@@ -209,7 +207,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
processFiles(printer, listFiles, holderFull, holderMock);
}
}
else if (!FileUtilRt.getExtension(file.getName()).equals(JetFileType.INSTANCE.getDefaultExtension())) {
else if (!FileUtilRt.getExtension(file.getName()).equals(KotlinFileType.INSTANCE.getDefaultExtension())) {
// skip non kotlin files
}
else {

View File

@@ -21,24 +21,23 @@ 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.BridgesPackage;
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.CallResolverUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
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.types.JetType;
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.JetTypeChecker;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
import java.util.*;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
public class CodegenUtil {
private CodegenUtil() {
@@ -51,9 +50,9 @@ public class CodegenUtil {
@NotNull ClassifierDescriptor returnedClassifier,
@NotNull ClassifierDescriptor... valueParameterClassifiers
) {
Collection<FunctionDescriptor> functions = owner.getDefaultType().getMemberScope().getFunctions(name, NoLookupLocation.FROM_BACKEND);
Collection<FunctionDescriptor> functions = owner.getDefaultType().getMemberScope().getContributedFunctions(name, NoLookupLocation.FROM_BACKEND);
for (FunctionDescriptor function : functions) {
if (!CallResolverUtilPackage.isOrOverridesSynthesized(function)
if (!CallResolverUtilKt.isOrOverridesSynthesized(function)
&& function.getTypeParameters().isEmpty()
&& valueParameterClassesMatch(function.getValueParameters(), Arrays.asList(valueParameterClassifiers))
&& rawTypeMatches(function.getReturnType(), returnedClassifier)) {
@@ -64,10 +63,10 @@ public class CodegenUtil {
}
@Nullable
public static PropertyDescriptor getDelegatePropertyIfAny(JetExpression expression, ClassDescriptor classDescriptor, BindingContext bindingContext) {
public static PropertyDescriptor getDelegatePropertyIfAny(KtExpression expression, ClassDescriptor classDescriptor, BindingContext bindingContext) {
PropertyDescriptor propertyDescriptor = null;
if (expression instanceof JetSimpleNameExpression) {
ResolvedCall<?> call = CallUtilPackage.getResolvedCall(expression, bindingContext);
if (expression instanceof KtSimpleNameExpression) {
ResolvedCall<?> call = CallUtilKt.getResolvedCall(expression, bindingContext);
if (call != null) {
CallableDescriptor callResultingDescriptor = call.getResultingDescriptor();
if (callResultingDescriptor instanceof ValueParameterDescriptor) {
@@ -96,11 +95,11 @@ public class CodegenUtil {
@NotNull
public static Map<FunctionDescriptor, FunctionDescriptor> getTraitMethods(ClassDescriptor descriptor) {
Map<FunctionDescriptor, FunctionDescriptor> result = new LinkedHashMap<FunctionDescriptor, FunctionDescriptor>();
for (DeclarationDescriptor declaration : descriptor.getDefaultType().getMemberScope().getAllDescriptors()) {
for (DeclarationDescriptor declaration : DescriptorUtils.getAllDescriptors(descriptor.getDefaultType().getMemberScope())) {
if (!(declaration instanceof CallableMemberDescriptor)) continue;
CallableMemberDescriptor inheritedMember = (CallableMemberDescriptor) declaration;
CallableMemberDescriptor traitMember = BridgesPackage.findTraitImplementation(inheritedMember);
CallableMemberDescriptor traitMember = ImplKt.findTraitImplementation(inheritedMember);
if (traitMember == null) continue;
assert traitMember.getModality() != Modality.ABSTRACT : "Cannot delegate to abstract trait method: " + inheritedMember;
@@ -141,8 +140,8 @@ public class CodegenUtil {
}
@NotNull
public static ClassDescriptor getSuperClassByDelegationSpecifier(@NotNull JetDelegationSpecifier specifier, @NotNull BindingContext bindingContext) {
JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
public static ClassDescriptor getSuperClassByDelegationSpecifier(@NotNull KtDelegationSpecifier 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();
@@ -165,29 +164,27 @@ public class CodegenUtil {
return true;
}
private static boolean rawTypeMatches(JetType type, ClassifierDescriptor classifier) {
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();
JetType nullableString = TypeUtils.makeNullable(getBuiltIns(functionDescriptor).getStringType());
KotlinType nullableString = TypeUtils.makeNullable(DescriptorUtilsKt.getBuiltIns(functionDescriptor).getStringType());
return DescriptorUtils.ENUM_VALUE_OF.equals(functionDescriptor.getName())
&& methodTypeParameters.size() == 1
&& JetTypeChecker.DEFAULT.isSubtypeOf(methodTypeParameters.get(0).getType(), nullableString);
&& KotlinTypeChecker.DEFAULT.isSubtypeOf(methodTypeParameters.get(0).getType(), nullableString);
}
public static boolean isEnumValuesMethod(@NotNull FunctionDescriptor functionDescriptor) {
List<ValueParameterDescriptor> methodTypeParameters = functionDescriptor.getValueParameters();
return DescriptorUtils.ENUM_VALUES.equals(functionDescriptor.getName())
&& methodTypeParameters.isEmpty();
public static boolean isEnumValuesProperty(@NotNull VariableDescriptor propertyDescriptor) {
return DescriptorUtils.ENUM_VALUES.equals(propertyDescriptor.getName());
}
@Nullable
public static Integer getLineNumberForElement(@NotNull PsiElement statement, boolean markEndOffset) {
PsiFile file = statement.getContainingFile();
if (file instanceof JetFile) {
if (PsiPackage.getDoNotAnalyze((JetFile) file) != null) {
if (file instanceof KtFile) {
if (KtPsiFactoryKt.getDoNotAnalyze((KtFile) file) != null) {
return null;
}
}

View File

@@ -22,7 +22,7 @@ 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.JetType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.isDynamic
import org.jetbrains.kotlin.utils.keysToMapExceptNulls
import java.util.Comparator
@@ -38,15 +38,15 @@ public object CodegenUtilKt {
public fun getDelegates(
descriptor: ClassDescriptor,
toTrait: ClassDescriptor,
delegateExpressionType: JetType? = null
delegateExpressionType: KotlinType? = null
): Map<CallableMemberDescriptor, CallableDescriptor> {
if (delegateExpressionType?.isDynamic() ?: false) return mapOf();
return descriptor.getDefaultType().getMemberScope().getDescriptors().asSequence()
return descriptor.getDefaultType().getMemberScope().getContributedDescriptors().asSequence()
.filterIsInstance<CallableMemberDescriptor>()
.filter { it.getKind() == CallableMemberDescriptor.Kind.DELEGATION }
.toList()
.sortBy(MemberComparator.INSTANCE as Comparator<CallableMemberDescriptor>) // Workaround for KT-6030
.asIterable()
.sortedWith(MemberComparator.INSTANCE)
.keysToMapExceptNulls {
delegatingMember ->
@@ -58,7 +58,7 @@ public object CodegenUtilKt {
val name = overriddenDescriptor.getName()
// this is the actual member of delegateExpressionType that we are delegating to
(scope.getFunctions(name, NoLookupLocation.FROM_BACKEND) + scope.getProperties(name, NoLookupLocation.FROM_BACKEND))
(scope.getContributedFunctions(name, NoLookupLocation.FROM_BACKEND) + scope.getContributedVariables(name, NoLookupLocation.FROM_BACKEND))
.first {
(listOf(it) + DescriptorUtils.getAllOverriddenDescriptors(it)).map { it.getOriginal() }.contains(overriddenDescriptor.getOriginal())
}

View File

@@ -22,34 +22,33 @@ 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.JetClass;
import org.jetbrains.kotlin.psi.JetClassOrObject;
import org.jetbrains.kotlin.psi.JetParameter;
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;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
/**
* 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 JetClassOrObject declaration;
private final KtClassOrObject declaration;
private final BindingContext bindingContext;
private final ClassDescriptor classDescriptor;
private final KotlinBuiltIns builtIns;
public DataClassMethodGenerator(JetClassOrObject declaration, BindingContext bindingContext) {
public DataClassMethodGenerator(KtClassOrObject declaration, BindingContext bindingContext) {
this.declaration = declaration;
this.bindingContext = bindingContext;
this.classDescriptor = BindingContextUtils.getNotNull(bindingContext, BindingContext.CLASS, declaration);
this.builtIns = getBuiltIns(classDescriptor);
this.builtIns = DescriptorUtilsKt.getBuiltIns(classDescriptor);
}
public void generate() {
@@ -67,7 +66,7 @@ public abstract class DataClassMethodGenerator {
protected abstract void generateComponentFunction(@NotNull FunctionDescriptor function, @NotNull ValueParameterDescriptor parameter);
protected abstract void generateCopyFunction(@NotNull FunctionDescriptor function, @NotNull List<JetParameter> constructorParameters);
protected abstract void generateCopyFunction(@NotNull FunctionDescriptor function, @NotNull List<KtParameter> constructorParameters);
protected abstract void generateToStringMethod(@NotNull FunctionDescriptor function, @NotNull List<PropertyDescriptor> properties);
@@ -94,7 +93,7 @@ public abstract class DataClassMethodGenerator {
}
}
private void generateCopyFunctionForDataClasses(List<JetParameter> constructorParameters) {
private void generateCopyFunctionForDataClasses(List<KtParameter> constructorParameters) {
FunctionDescriptor copyFunction = bindingContext.get(BindingContext.DATA_CLASS_COPY_FUNCTION, classDescriptor);
if (copyFunction != null) {
generateCopyFunction(copyFunction, constructorParameters);
@@ -124,7 +123,7 @@ public abstract class DataClassMethodGenerator {
private List<PropertyDescriptor> getDataProperties() {
List<PropertyDescriptor> result = Lists.newArrayList();
for (JetParameter parameter : getPrimaryConstructorParameters()) {
for (KtParameter parameter : getPrimaryConstructorParameters()) {
if (parameter.hasValOrVar()) {
result.add(bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter));
}
@@ -133,8 +132,8 @@ public abstract class DataClassMethodGenerator {
}
@NotNull
private List<JetParameter> getPrimaryConstructorParameters() {
if (declaration instanceof JetClass) {
private List<KtParameter> getPrimaryConstructorParameters() {
if (declaration instanceof KtClass) {
return declaration.getPrimaryConstructorParameters();
}
return Collections.emptyList();

View File

@@ -69,7 +69,7 @@ public fun <Function : FunctionHandle, Signature> generateBridges(
return bridgesToGenerate.map { Bridge(it, method) }.toSet()
}
private fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function): MutableSet<Function> {
public fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function): MutableSet<Function> {
val collector = object : DFS.NodeHandlerWithListResult<Function, Function>() {
override fun afterChildren(current: Function) {
if (current.isDeclaration) {
@@ -86,7 +86,7 @@ private fun <Function : FunctionHandle> findAllReachableDeclarations(function: F
* Given a concrete function, finds an implementation (a concrete declaration) of this function in the supertypes.
* The implementation is guaranteed to exist because if it wouldn't, the given function would've been abstract
*/
private fun <Function : FunctionHandle> findConcreteSuperDeclaration(function: Function): Function {
public fun <Function : FunctionHandle> findConcreteSuperDeclaration(function: Function): Function {
require(!function.isAbstract, { "Only concrete functions have implementations: $function" })
if (function.isDeclaration) return function

View File

@@ -47,7 +47,7 @@ public fun <Signature> generateBridgesForFunctionDescriptor(
* can generate a bridge near an implementation (of course, in case it has a super-declaration with a different signature). Ultimately this
* eases the process of determining what bridges are already generated in our supertypes and need to be inherited, not regenerated.
*/
private data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : FunctionHandle {
public data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : FunctionHandle {
private val overridden = descriptor.getOverriddenDescriptors().map { DescriptorBasedFunctionHandle(it.getOriginal()) }
override val isDeclaration: Boolean =
@@ -56,7 +56,7 @@ private data class DescriptorBasedFunctionHandle(val descriptor: FunctionDescrip
override val isAbstract: Boolean =
descriptor.getModality() == Modality.ABSTRACT ||
DescriptorUtils.isTrait(descriptor.getContainingDeclaration())
DescriptorUtils.isInterface(descriptor.getContainingDeclaration())
override fun getOverridden() = overridden
}
@@ -74,7 +74,7 @@ public fun findTraitImplementation(descriptor: CallableMemberDescriptor): Callab
val implementation = findImplementationFromInterface(descriptor) ?: return null
val immediateConcreteSuper = firstSuperMethodFromKotlin(descriptor, implementation) ?: return null
if (!DescriptorUtils.isTrait(immediateConcreteSuper.getContainingDeclaration())) {
if (!DescriptorUtils.isInterface(immediateConcreteSuper.getContainingDeclaration())) {
// If this implementation is already generated into the superclass, we need not generate it again, it'll be inherited
return null
}

View File

@@ -33,8 +33,6 @@ public interface OutputFile {
public val sourceFiles: List<File>
public fun asByteArray(): ByteArray
public fun asText(): String
override fun toString() = "$relativePath (compiled from $sourceFiles)"
}
public class SimpleOutputFile(
@@ -44,4 +42,6 @@ public class SimpleOutputFile(
) : OutputFile {
override fun asByteArray(): ByteArray = content.toByteArray()
override fun asText(): String = content
override fun toString() = "$relativePath (compiled from $sourceFiles)"
}

View File

@@ -22,6 +22,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil;
import org.jetbrains.kotlin.codegen.inline.SMAPBuilder;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.*;

View File

@@ -19,12 +19,12 @@ package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
import org.jetbrains.kotlin.psi.JetSuperExpression;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
public interface AccessorForCallableDescriptor<T extends CallableMemberDescriptor> {
@NotNull
T getCalleeDescriptor();
@Nullable
JetSuperExpression getSuperCallExpression();
ClassDescriptor getSuperCallTarget();
}

View File

@@ -18,14 +18,13 @@ package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.JetSuperExpression
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.types.KotlinType
public class AccessorForConstructorDescriptor(
private val calleeDescriptor: ConstructorDescriptor,
containingDeclaration: DeclarationDescriptor,
private val superCallExpression: JetSuperExpression?
private val superCallTarget: ClassDescriptor?
) : AbstractAccessorForFunctionDescriptor(containingDeclaration, Name.special("<init>")),
ConstructorDescriptor,
AccessorForCallableDescriptor<ConstructorDescriptor> {
@@ -35,9 +34,9 @@ public class AccessorForConstructorDescriptor(
override fun isPrimary(): Boolean = false
override fun getReturnType(): JetType = super.getReturnType()!!
override fun getReturnType(): KotlinType = super.getReturnType()!!
override fun getSuperCallExpression(): JetSuperExpression? = superCallExpression
override fun getSuperCallTarget(): ClassDescriptor? = superCallTarget
init {
initialize(
@@ -47,7 +46,7 @@ public class AccessorForConstructorDescriptor(
copyValueParameters(calleeDescriptor),
calleeDescriptor.returnType,
Modality.FINAL,
Visibilities.INTERNAL
Visibilities.LOCAL
)
}
}

View File

@@ -20,34 +20,33 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.JetSuperExpression;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDescriptor implements AccessorForCallableDescriptor<FunctionDescriptor> {
private final FunctionDescriptor calleeDescriptor;
private final JetSuperExpression superCallExpression;
private final ClassDescriptor superCallTarget;
public AccessorForFunctionDescriptor(
@NotNull FunctionDescriptor descriptor,
@NotNull DeclarationDescriptor containingDeclaration,
int index,
@Nullable JetSuperExpression superCallExpression
@Nullable ClassDescriptor superCallTarget,
@NotNull String nameSuffix
) {
super(containingDeclaration,
Name.identifier("access$" + (descriptor instanceof ConstructorDescriptor ? "init" : descriptor.getName()) + "$" + index));
Name.identifier("access$" + nameSuffix));
this.calleeDescriptor = descriptor;
this.superCallExpression = superCallExpression;
this.superCallTarget = superCallTarget;
initialize(DescriptorUtils.getReceiverParameterType(descriptor.getExtensionReceiverParameter()),
descriptor instanceof ConstructorDescriptor || AnnotationsPackage.isPlatformStaticInObjectOrClass(descriptor)
descriptor instanceof ConstructorDescriptor || AnnotationUtilKt.isPlatformStaticInObjectOrClass(descriptor)
? null
: descriptor.getDispatchReceiverParameter(),
copyTypeParameters(descriptor),
copyValueParameters(descriptor),
descriptor.getReturnType(),
Modality.FINAL,
Visibilities.INTERNAL);
Visibilities.LOCAL);
}
@NotNull
@@ -57,7 +56,7 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe
}
@Override
public JetSuperExpression getSuperCallExpression() {
return superCallExpression;
public ClassDescriptor getSuperCallTarget() {
return superCallTarget;
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
import org.jetbrains.kotlin.psi.KtSuperExpression
import org.jetbrains.kotlin.types.KotlinType
abstract class AccessorForPropertyBackingField(property: PropertyDescriptor,
type: KotlinType,
receiverType: KotlinType?,
dispatchReceiver: ReceiverParameterDescriptor?,
containingDeclaration: DeclarationDescriptor,
suffix: String
) : AccessorForPropertyDescriptor(property, type, receiverType, dispatchReceiver, containingDeclaration, null, suffix)

View File

@@ -0,0 +1,28 @@
/*
* 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
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.resolve.DescriptorUtils
class AccessorForPropertyBackingFieldFromLocal(property: PropertyDescriptor,
containingDeclaration: DeclarationDescriptor,
nameSuffix: String
) : AccessorForPropertyBackingField(property, property.type,
DescriptorUtils.getReceiverParameterType(property.extensionReceiverParameter),
property.dispatchReceiverParameter, containingDeclaration, nameSuffix)

View File

@@ -0,0 +1,27 @@
/*
* 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
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.types.KotlinType
class AccessorForPropertyBackingFieldInClassCompanion(property: PropertyDescriptor,
containingDeclaration: DeclarationDescriptor,
delegationType: KotlinType?,
nameSuffix: String
) : AccessorForPropertyBackingField(property, delegationType ?: property.type, null, null, containingDeclaration, nameSuffix)

View File

@@ -1,34 +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;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
import org.jetbrains.kotlin.types.JetType;
public class AccessorForPropertyBackingFieldInOuterClass extends AccessorForPropertyDescriptor {
public AccessorForPropertyBackingFieldInOuterClass(
@NotNull PropertyDescriptor property,
@NotNull DeclarationDescriptor containingDeclaration,
int index,
@Nullable JetType delegationType
) {
super(property, delegationType != null ? delegationType : property.getType(), null, null, containingDeclaration, index, null);
}
}

View File

@@ -25,51 +25,79 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl;
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl;
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.JetSuperExpression;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.KotlinType;
import java.util.Collections;
public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implements AccessorForCallableDescriptor<PropertyDescriptor> {
private final PropertyDescriptor calleeDescriptor;
private final int accessorIndex;
private final JetSuperExpression superCallExpression;
private final ClassDescriptor superCallTarget;
@NotNull private final String nameSuffix;
private final boolean withSyntheticGetterAccessor;
private final boolean withSyntheticSetterAccessor;
public AccessorForPropertyDescriptor(
@NotNull PropertyDescriptor property,
@NotNull DeclarationDescriptor containingDeclaration,
int index,
@Nullable JetSuperExpression superCallExpression
@Nullable ClassDescriptor superCallTarget,
@NotNull String nameSuffix,
boolean getterAccessorRequired,
boolean setterAccessorRequired
) {
this(property, property.getType(), DescriptorUtils.getReceiverParameterType(property.getExtensionReceiverParameter()),
property.getDispatchReceiverParameter(), containingDeclaration, index, superCallExpression);
property.getDispatchReceiverParameter(), containingDeclaration, superCallTarget, nameSuffix,
getterAccessorRequired, setterAccessorRequired);
}
protected AccessorForPropertyDescriptor(
@NotNull PropertyDescriptor original,
@NotNull JetType propertyType,
@Nullable JetType receiverType,
@NotNull KotlinType propertyType,
@Nullable KotlinType receiverType,
@Nullable ReceiverParameterDescriptor dispatchReceiverParameter,
@NotNull DeclarationDescriptor containingDeclaration,
int index,
@Nullable JetSuperExpression superCallExpression
@Nullable ClassDescriptor superCallTarget,
@NotNull String nameSuffix
) {
super(containingDeclaration, null, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
original.isVar(), Name.identifier("access$" + getIndexedAccessorSuffix(original, index)),
Kind.DECLARATION, SourceElement.NO_SOURCE, false);
this(original, propertyType, receiverType, dispatchReceiverParameter, containingDeclaration, superCallTarget, nameSuffix, true, true);
}
protected AccessorForPropertyDescriptor(
@NotNull PropertyDescriptor original,
@NotNull KotlinType propertyType,
@Nullable KotlinType receiverType,
@Nullable ReceiverParameterDescriptor dispatchReceiverParameter,
@NotNull DeclarationDescriptor containingDeclaration,
@Nullable ClassDescriptor superCallTarget,
@NotNull String nameSuffix,
boolean getterAccessorRequired,
boolean setterAccessorRequired
) {
super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
original.isVar(), Name.identifier("access$" + nameSuffix),
Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false);
this.calleeDescriptor = original;
this.accessorIndex = index;
this.superCallExpression = superCallExpression;
this.superCallTarget = superCallTarget;
this.nameSuffix = nameSuffix;
setType(propertyType, Collections.<TypeParameterDescriptorImpl>emptyList(), dispatchReceiverParameter, receiverType);
initialize(new Getter(this), new Setter(this));
this.withSyntheticGetterAccessor = getterAccessorRequired;
this.withSyntheticSetterAccessor = setterAccessorRequired;
PropertyGetterDescriptorImpl getterDescriptor =
getterAccessorRequired ? new Getter(this) : (PropertyGetterDescriptorImpl) original.getGetter();
PropertySetterDescriptor setterDescriptor =
setterAccessorRequired ? new Setter(this) : original.getSetter();
initialize(getterDescriptor, setterDescriptor);
}
public static class Getter extends PropertyGetterDescriptorImpl implements AccessorForCallableDescriptor<PropertyGetterDescriptor> {
public Getter(AccessorForPropertyDescriptor property) {
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
false, false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
super(property, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
false, false,
/* isExternal = */ false,
Kind.DECLARATION, null, SourceElement.NO_SOURCE);
initialize(property.getType());
}
@@ -80,17 +108,20 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getCalleeDescriptor().getGetter();
}
@Nullable
@Override
public JetSuperExpression getSuperCallExpression() {
return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallExpression();
@Nullable
public ClassDescriptor getSuperCallTarget() {
return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallTarget();
}
}
public static class Setter extends PropertySetterDescriptorImpl implements AccessorForCallableDescriptor<PropertySetterDescriptor>{
public Setter(AccessorForPropertyDescriptor property) {
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
false, false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
super(property, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
false, false,
/* isExternal = */ false,
Kind.DECLARATION, null, SourceElement.NO_SOURCE);
initializeDefault();
}
@@ -101,10 +132,10 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getCalleeDescriptor().getSetter();
}
@Nullable
@Override
public JetSuperExpression getSuperCallExpression() {
return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallExpression();
@Nullable
public ClassDescriptor getSuperCallTarget() {
return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallTarget();
}
}
@@ -115,17 +146,20 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
}
@Override
public JetSuperExpression getSuperCallExpression() {
return superCallExpression;
public ClassDescriptor getSuperCallTarget() {
return superCallTarget;
}
@NotNull
public String getIndexedAccessorSuffix() {
return getIndexedAccessorSuffix(calleeDescriptor, accessorIndex);
public String getAccessorSuffix() {
return nameSuffix;
}
@NotNull
private static String getIndexedAccessorSuffix(@NotNull PropertyDescriptor original, int index) {
return original.getName() + "$" + index;
public boolean isWithSyntheticGetterAccessor() {
return withSyntheticGetterAccessor;
}
public boolean isWithSyntheticSetterAccessor() {
return withSyntheticSetterAccessor;
}
}

View File

@@ -22,23 +22,19 @@ import org.jetbrains.kotlin.codegen.annotation.WrappedAnnotated;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.*;
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.resolve.AnnotationChecker;
import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.constants.StringValue;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.types.Flexibility;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.TypesPackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.org.objectweb.asm.*;
import java.lang.annotation.*;
import java.util.*;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getClassObjectType;
public abstract class AnnotationCodegen {
public static final class JvmFlagAnnotation {
@@ -66,9 +62,7 @@ public abstract class AnnotationCodegen {
public static final List<JvmFlagAnnotation> METHOD_FLAGS = Arrays.asList(
new JvmFlagAnnotation("kotlin.jvm.Strictfp", Opcodes.ACC_STRICT),
new JvmFlagAnnotation("kotlin.jvm.Synchronized", Opcodes.ACC_SYNCHRONIZED),
new JvmFlagAnnotation("kotlin.jvm.native", Opcodes.ACC_NATIVE),
new JvmFlagAnnotation("kotlin.external", Opcodes.ACC_NATIVE)
new JvmFlagAnnotation("kotlin.jvm.Synchronized", Opcodes.ACC_SYNCHRONIZED)
);
private static final AnnotationVisitor NO_ANNOTATION_VISITOR = new AnnotationVisitor(Opcodes.ASM5) {};
@@ -105,6 +99,16 @@ public abstract class AnnotationCodegen {
// Skip if the target is not the same
if (allowedTarget != null && annotationTarget != null && allowedTarget != annotationTarget) continue;
Set<KotlinTarget> applicableTargets = AnnotationChecker.applicableTargetSet(annotation);
if (annotated instanceof AnonymousFunctionDescriptor
&& !applicableTargets.contains(KotlinTarget.FUNCTION)
&& !applicableTargets.contains(KotlinTarget.PROPERTY_GETTER)
&& !applicableTargets.contains(KotlinTarget.PROPERTY_SETTER)) {
assert (applicableTargets.contains(KotlinTarget.EXPRESSION)) :
"Inconsistent target list for lambda annotation: " + applicableTargets + " on " + annotated;
continue;
}
String descriptor = genAnnotation(annotation);
if (descriptor != null) {
annotationDescriptorsAlreadyPresent.add(descriptor);
@@ -153,7 +157,7 @@ public abstract class AnnotationCodegen {
return false;
}
private void generateNullabilityAnnotation(@Nullable JetType type, @NotNull Set<String> annotationDescriptorsAlreadyPresent) {
private void generateNullabilityAnnotation(@Nullable KotlinType type, @NotNull Set<String> annotationDescriptorsAlreadyPresent) {
if (type == null) return;
if (isBareTypeParameterWithNullableUpperBound(type)) {
@@ -164,9 +168,9 @@ public abstract class AnnotationCodegen {
return;
}
if (TypesPackage.isFlexible(type)) {
if (FlexibleTypesKt.isFlexible(type)) {
// A flexible type whose lower bound in not-null and upper bound is nullable, should not be annotated
Flexibility flexibility = TypesPackage.flexibility(type);
Flexibility flexibility = FlexibleTypesKt.flexibility(type);
if (!TypeUtils.isNullableType(flexibility.getLowerBound()) && TypeUtils.isNullableType(flexibility.getUpperBound())) {
AnnotationDescriptor notNull = type.getAnnotations().findAnnotation(JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION);
@@ -234,7 +238,7 @@ public abstract class AnnotationCodegen {
}
private void generateDocumentedAnnotation(@NotNull ClassDescriptor classDescriptor, @NotNull Set<String> annotationDescriptorsAlreadyPresent) {
boolean documented = DescriptorUtilPackage.isDocumentedAnnotation(classDescriptor);
boolean documented = DescriptorUtilsKt.isDocumentedAnnotation(classDescriptor);
if (!documented) return;
String descriptor = Type.getType(Documented.class).getDescriptor();
if (!annotationDescriptorsAlreadyPresent.add(descriptor)) return;
@@ -249,12 +253,12 @@ public abstract class AnnotationCodegen {
}
}
private static boolean isBareTypeParameterWithNullableUpperBound(@NotNull JetType type) {
private static boolean isBareTypeParameterWithNullableUpperBound(@NotNull KotlinType type) {
ClassifierDescriptor classifier = type.getConstructor().getDeclarationDescriptor();
return !type.isMarkedNullable() && classifier instanceof TypeParameterDescriptor && TypeUtils.hasNullableSuperType(type);
}
public void generateAnnotationDefaultValue(@NotNull ConstantValue<?> value, @NotNull JetType expectedType) {
public void generateAnnotationDefaultValue(@NotNull ConstantValue<?> value, @NotNull KotlinType expectedType) {
AnnotationVisitor visitor = visitAnnotation(null, false); // Parameters are unimportant
genCompileTimeValue(null, value, visitor);
visitor.visitEnd();
@@ -385,7 +389,15 @@ public abstract class AnnotationCodegen {
}
private Void visitUnsupportedValue(ConstantValue<?> value) {
throw new IllegalStateException("Don't know how to compile annotation value " + 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);
}
}
};
@@ -414,7 +426,7 @@ public abstract class AnnotationCodegen {
for (ConstantValue<?> value : values) {
if (value instanceof EnumValue) {
ClassDescriptor enumEntry = ((EnumValue) value).getValue();
JetType classObjectType = getClassObjectType(enumEntry);
KotlinType classObjectType = DescriptorUtilsKt.getClassObjectType(enumEntry);
if (classObjectType != null) {
if ("java/lang/annotation/ElementType".equals(typeMapper.mapType(classObjectType).getInternalName())) {
result.add(ElementType.valueOf(enumEntry.getName().asString()));
@@ -431,7 +443,7 @@ public abstract class AnnotationCodegen {
@NotNull
private RetentionPolicy getRetentionPolicy(@NotNull Annotated descriptor) {
KotlinRetention retention = DescriptorUtilPackage.getAnnotationRetention(descriptor);
KotlinRetention retention = DescriptorUtilsKt.getAnnotationRetention(descriptor);
if (retention != null) {
return annotationRetentionMap.get(retention);
}
@@ -442,7 +454,7 @@ public abstract class AnnotationCodegen {
ConstantValue<?> compileTimeConstant = valueArguments.iterator().next();
if (compileTimeConstant instanceof EnumValue) {
ClassDescriptor enumEntry = ((EnumValue) compileTimeConstant).getValue();
JetType classObjectType = getClassObjectType(enumEntry);
KotlinType classObjectType = DescriptorUtilsKt.getClassObjectType(enumEntry);
if (classObjectType != null) {
if ("java/lang/annotation/RetentionPolicy".equals(typeMapper.mapType(classObjectType).getInternalName())) {
return RetentionPolicy.valueOf(enumEntry.getName().asString());

View File

@@ -1,86 +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;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.VarargValueArgument;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public abstract class ArgumentGenerator {
/**
* @return a {@code List} of bit masks of default arguments that should be passed as last arguments to $default method, if there were
* any default arguments, or an empty {@code List} if there were none
* @see kotlin.reflect.jvm.internal.KCallableImpl#callBy(Map...)
*/
@NotNull
public List<Integer> generate(@NotNull List<ResolvedValueArgument> valueArguments) {
List<Integer> masks = new ArrayList<Integer>(1);
int mask = 0;
int n = valueArguments.size();
for (int i = 0; i < n; i++) {
if (i != 0 && i % Integer.SIZE == 0) {
masks.add(mask);
mask = 0;
}
ResolvedValueArgument argument = valueArguments.get(i);
if (argument instanceof ExpressionValueArgument) {
generateExpression(i, (ExpressionValueArgument) argument);
}
else if (argument instanceof DefaultValueArgument) {
mask |= 1 << (i % Integer.SIZE);
generateDefault(i, (DefaultValueArgument) argument);
}
else if (argument instanceof VarargValueArgument) {
generateVararg(i, (VarargValueArgument) argument);
}
else {
generateOther(i, argument);
}
}
if (mask == 0 && masks.isEmpty()) {
return Collections.emptyList();
}
masks.add(mask);
return masks;
}
protected void generateExpression(int i, @NotNull ExpressionValueArgument argument) {
throw new UnsupportedOperationException("Unsupported expression value argument #" + i + ": " + argument);
}
protected void generateDefault(int i, @NotNull DefaultValueArgument argument) {
throw new UnsupportedOperationException("Unsupported default value argument #" + i + ": " + argument);
}
protected void generateVararg(int i, @NotNull VarargValueArgument argument) {
throw new UnsupportedOperationException("Unsupported vararg value argument #" + i + ": " + argument);
}
@SuppressWarnings("MethodMayBeStatic") // is supposed to be overridden
protected void generateOther(int i, @NotNull ResolvedValueArgument argument) {
throw new UnsupportedOperationException("Unsupported value argument #" + i + ": " + argument);
}
}

View File

@@ -0,0 +1,98 @@
/*
* 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
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument
import org.jetbrains.kotlin.resolve.calls.model.VarargValueArgument
import org.jetbrains.kotlin.utils.mapToIndex
class ArgumentAndDeclIndex(val arg: ResolvedValueArgument, val declIndex: Int)
abstract class ArgumentGenerator {
/**
* @return a `List` of bit masks of default arguments that should be passed as last arguments to $default method, if there were
* any default arguments, or an empty `List` if there were none
*
* @see kotlin.reflect.jvm.internal.KCallableImpl.callBy
*/
open fun generate(valueArgumentsByIndex: List<ResolvedValueArgument>, actualArgs: List<ResolvedValueArgument>): DefaultCallMask {
assert(valueArgumentsByIndex.size() == actualArgs.size()) {
"Value arguments collection should have same size, but ${valueArgumentsByIndex.size()} != ${actualArgs.size()}"
}
val arg2Index = valueArgumentsByIndex.mapToIndex()
val actualArgsWithDeclIndex = actualArgs.filter { it !is DefaultValueArgument }.map {
ArgumentAndDeclIndex(it, arg2Index[it]!!)
}.toArrayList()
valueArgumentsByIndex.withIndex().forEach {
if (it.value is DefaultValueArgument) {
actualArgsWithDeclIndex.add(it.index, ArgumentAndDeclIndex(it.value, it.index))
}
}
val masks = DefaultCallMask(valueArgumentsByIndex.size())
for (argumentWithDeclIndex in actualArgsWithDeclIndex) {
val argument = argumentWithDeclIndex.arg
val declIndex = argumentWithDeclIndex.declIndex
when (argument) {
is ExpressionValueArgument -> {
generateExpression(declIndex, argument)
}
is DefaultValueArgument -> {
masks.mark(declIndex)
generateDefault(declIndex, argument)
}
is VarargValueArgument -> {
generateVararg(declIndex, argument)
}
else -> {
generateOther(declIndex, argument)
}
}
}
reorderArgumentsIfNeeded(actualArgsWithDeclIndex)
return masks
}
protected open fun generateExpression(i: Int, argument: ExpressionValueArgument) {
throw UnsupportedOperationException("Unsupported expression value argument #$i: $argument")
}
protected open fun generateDefault(i: Int, argument: DefaultValueArgument) {
throw UnsupportedOperationException("Unsupported default value argument #$i: $argument")
}
protected open fun generateVararg(i: Int, argument: VarargValueArgument) {
throw UnsupportedOperationException("Unsupported vararg value argument #$i: $argument")
}
protected open fun generateOther(i: Int, argument: ResolvedValueArgument) {
throw UnsupportedOperationException("Unsupported value argument #$i: $argument")
}
protected open fun reorderArgumentsIfNeeded(args: List<ArgumentAndDeclIndex>) {
throw UnsupportedOperationException("Unsupported operation")
}
}

View File

@@ -18,6 +18,7 @@ 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;
@@ -29,26 +30,29 @@ import org.jetbrains.kotlin.builtins.PrimitiveType;
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods;
import org.jetbrains.kotlin.codegen.serialization.JvmStringTable;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.load.java.JavaVisibilities;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.resolve.DeprecationUtilKt;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolverKt;
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
import org.jetbrains.kotlin.resolve.jvm.JvmPackage;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
import org.jetbrains.kotlin.serialization.jvm.BitEncoding;
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypesPackage;
import org.jetbrains.kotlin.types.FlexibleTypesKt;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.org.objectweb.asm.*;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import org.jetbrains.org.objectweb.asm.commons.Method;
@@ -60,10 +64,11 @@ import java.util.Set;
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isBoolean;
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isPrimitiveClass;
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isInterface;
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass;
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface;
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.KOTLIN_SYNTHETIC_CLASS;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.annotations.AnnotationUtilKt.hasJvmFieldAnnotation;
import static org.jetbrains.kotlin.types.TypeUtils.isNullableType;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
@@ -164,18 +169,18 @@ public class AsmUtil {
public static boolean isAbstractMethod(FunctionDescriptor functionDescriptor, OwnerKind kind) {
return (functionDescriptor.getModality() == Modality.ABSTRACT
|| isInterface(functionDescriptor.getContainingDeclaration()))
|| isJvmInterface(functionDescriptor.getContainingDeclaration()))
&& !isStaticMethod(kind, functionDescriptor);
}
public static boolean isStaticMethod(OwnerKind kind, CallableMemberDescriptor functionDescriptor) {
return isStaticKind(kind) ||
JetTypeMapper.isStaticAccessor(functionDescriptor) ||
AnnotationsPackage.isPlatformStaticInObjectOrClass(functionDescriptor);
AnnotationUtilKt.isPlatformStaticInObjectOrClass(functionDescriptor);
}
public static boolean isStaticKind(OwnerKind kind) {
return kind == OwnerKind.PACKAGE || kind == OwnerKind.TRAIT_IMPL;
return kind == OwnerKind.PACKAGE || kind == OwnerKind.DEFAULT_IMPLS;
}
public static int getMethodAsmFlags(FunctionDescriptor functionDescriptor, OwnerKind kind) {
@@ -187,7 +192,11 @@ public class AsmUtil {
}
}
if (AnnotationsPackage.isPlatformStaticInCompanionObject(functionDescriptor)) {
if (functionDescriptor.getOriginal().isExternal()) {
flags |= Opcodes.ACC_NATIVE;
}
if (AnnotationUtilKt.isPlatformStaticInCompanionObject(functionDescriptor)) {
// Native method will be a member of the class, the companion object method will be delegated to it
flags &= ~Opcodes.ACC_NATIVE;
}
@@ -208,7 +217,8 @@ public class AsmUtil {
flags |= ACC_ABSTRACT;
}
if (JetTypeMapper.isAccessor(functionDescriptor)) {
if (JetTypeMapper.isAccessor(functionDescriptor)
|| AnnotationUtilKt.hasJvmSyntheticAnnotation(functionDescriptor)) {
flags |= ACC_SYNTHETIC;
}
@@ -219,9 +229,9 @@ public class AsmUtil {
int flags = getVisibilityAccessFlag(functionDescriptor);
flags |= getVarargsFlag(functionDescriptor);
flags |= getDeprecatedAccessFlag(functionDescriptor);
if (DescriptorUtilPackage.isAnnotatedAsHidden(functionDescriptor)
if (DeprecationUtilKt.isAnnotatedAsHidden(functionDescriptor)
|| functionDescriptor instanceof PropertyAccessorDescriptor
&& DescriptorUtilPackage.isAnnotatedAsHidden(((PropertyAccessorDescriptor) functionDescriptor).getCorrespondingProperty())) {
&& DeprecationUtilKt.isAnnotatedAsHidden(((PropertyAccessorDescriptor) functionDescriptor).getCorrespondingProperty())) {
flags |= ACC_SYNTHETIC;
}
return flags;
@@ -233,9 +243,13 @@ public class AsmUtil {
if (specialCase != null) {
return specialCase;
}
Integer defaultMapping = visibilityToAccessFlag.get(descriptor.getVisibility());
return getDefaultVisibilityFlag(descriptor.getVisibility());
}
public static int getDefaultVisibilityFlag(@NotNull Visibility visibility) {
Integer defaultMapping = visibilityToAccessFlag.get(visibility);
if (defaultMapping == null) {
throw new IllegalStateException(descriptor.getVisibility() + " is not a valid visibility in backend: " + descriptor);
throw new IllegalStateException(visibility + " is not a valid visibility in backend");
}
return defaultMapping;
}
@@ -288,6 +302,9 @@ public class AsmUtil {
public static int getDeprecatedAccessFlag(@NotNull MemberDescriptor descriptor) {
if (descriptor instanceof PropertyAccessorDescriptor) {
if (((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty().isConst()) {
return ACC_DEPRECATED;
}
return KotlinBuiltIns.isDeprecated(descriptor)
? ACC_DEPRECATED
: getDeprecatedAccessFlag(((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty());
@@ -310,11 +327,11 @@ public class AsmUtil {
@Nullable
private static Integer specialCaseVisibility(@NotNull MemberDescriptor memberDescriptor) {
DeclarationDescriptor containingDeclaration = memberDescriptor.getContainingDeclaration();
if (isInterface(containingDeclaration)) {
return ACC_PUBLIC;
Visibility memberVisibility = memberDescriptor.getVisibility();
if (isJvmInterface(containingDeclaration)) {
return memberVisibility == Visibilities.PRIVATE ? NO_FLAG_PACKAGE_PRIVATE : ACC_PUBLIC;
}
Visibility memberVisibility = memberDescriptor.getVisibility();
if (memberVisibility == Visibilities.LOCAL && memberDescriptor instanceof CallableMemberDescriptor) {
return ACC_PUBLIC;
}
@@ -324,7 +341,7 @@ public class AsmUtil {
}
if (memberDescriptor instanceof ConstructorDescriptor && isAnonymousObject(memberDescriptor.getContainingDeclaration())) {
return NO_FLAG_PACKAGE_PRIVATE;
return getVisibilityAccessFlagForAnonymous((ClassDescriptor) memberDescriptor.getContainingDeclaration());
}
if (memberDescriptor instanceof SyntheticJavaPropertyDescriptor) {
@@ -343,7 +360,7 @@ public class AsmUtil {
if (memberDescriptor instanceof CallableDescriptor && memberVisibility == Visibilities.PROTECTED) {
for (CallableDescriptor overridden : DescriptorUtils.getAllOverriddenDescriptors((CallableDescriptor) memberDescriptor)) {
if (isInterface(overridden.getContainingDeclaration())) {
if (isJvmInterface(overridden.getContainingDeclaration())) {
return ACC_PUBLIC;
}
}
@@ -355,7 +372,7 @@ public class AsmUtil {
// the following code is only for PRIVATE visibility of member
if (memberDescriptor instanceof ConstructorDescriptor) {
if (isNonCompanionObject(containingDeclaration) || isEnumEntry(containingDeclaration)) {
if (isEnumEntry(containingDeclaration)) {
return NO_FLAG_PACKAGE_PRIVATE;
}
if (isEnumClass(containingDeclaration)) {
@@ -365,9 +382,11 @@ public class AsmUtil {
}
}
if (containingDeclaration instanceof PackageFragmentDescriptor) {
return ACC_PUBLIC;
if (memberDescriptor instanceof PropertyDescriptor &&
((PropertyDescriptor) memberDescriptor).isConst() || hasJvmFieldAnnotation(memberDescriptor)) {
return null;
}
return null;
}
@@ -413,7 +432,7 @@ public class AsmUtil {
allFields.add(Pair.create(CAPTURED_THIS_FIELD, typeMapper.mapType(captureThis)));
}
JetType captureReceiverType = closure.getCaptureReceiverType();
KotlinType captureReceiverType = closure.getCaptureReceiverType();
if (captureReceiverType != null) {
allFields.add(Pair.create(CAPTURED_RECEIVER_FIELD, typeMapper.mapType(captureReceiverType)));
}
@@ -539,7 +558,7 @@ public class AsmUtil {
right.put(rightType, v);
genAreEqualCall(v);
if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
if (opToken == KtTokens.EXCLEQ || opToken == KtTokens.EXCLEQEQEQ) {
genInvertBoolean(v);
}
return Unit.INSTANCE$;
@@ -619,7 +638,7 @@ public class AsmUtil {
@NotNull CallableDescriptor parameter,
@NotNull String name
) {
JetType type = parameter.getReturnType();
KotlinType type = parameter.getReturnType();
if (type == null || isNullableType(type)) return;
int index = frameMap.getIndex(parameter);
@@ -647,14 +666,14 @@ public class AsmUtil {
@NotNull String assertMethodToCall
) {
// Assertions are generated elsewhere for platform types
if (JvmPackage.getPLATFORM_TYPES()) return false;
if (JavaDescriptorResolverKt.getPLATFORM_TYPES()) return false;
if (!state.isCallAssertionsEnabled()) return false;
if (!isDeclaredInJava(descriptor)) return false;
JetType type = descriptor.getReturnType();
if (type == null || isNullableType(TypesPackage.lowerIfFlexible(type))) return false;
KotlinType type = descriptor.getReturnType();
if (type == null || isNullableType(FlexibleTypesKt.lowerIfFlexible(type))) return false;
Type asmType = state.getTypeMapper().mapReturnType(descriptor);
if (asmType.getSort() == Type.OBJECT || asmType.getSort() == Type.ARRAY) {
@@ -735,7 +754,10 @@ public class AsmUtil {
return false;
}
return isNonCompanionObject(propertyDescriptor.getContainingDeclaration()) || isPropertyWithBackingFieldInOuterClass(propertyDescriptor);
DeclarationDescriptor container = propertyDescriptor.getContainingDeclaration();
return isNonCompanionObject(container) ||
isPropertyWithBackingFieldInOuterClass(propertyDescriptor) ||
(isCompanionObject(container) && isInterface(container.getContainingDeclaration()));
}
public static boolean isPropertyWithBackingFieldInOuterClass(@NotNull PropertyDescriptor propertyDescriptor) {
@@ -769,7 +791,7 @@ public class AsmUtil {
DeclarationDescriptor propertyContainer = propertyDescriptor.getContainingDeclaration();
return !propertyDescriptor.isVar()
&& !isExtensionProperty
&& isCompanionObject(propertyContainer) && isTrait(propertyContainer.getContainingDeclaration())
&& isCompanionObject(propertyContainer) && isInterface(propertyContainer.getContainingDeclaration())
&& areBothAccessorDefault(propertyDescriptor)
&& getVisibilityForSpecialPropertyBackingField(propertyDescriptor, false) == ACC_PUBLIC;
}
@@ -813,7 +835,10 @@ public class AsmUtil {
}
public static void dup(@NotNull InstructionAdapter v, @NotNull Type type) {
int size = type.getSize();
dup(v, type.getSize());
}
private static void dup(@NotNull InstructionAdapter v, int size) {
if (size == 2) {
v.dup2();
}
@@ -825,17 +850,63 @@ public class AsmUtil {
}
}
public static void writeKotlinSyntheticClassAnnotation(@NotNull ClassBuilder v, @NotNull KotlinSyntheticClass.Kind kind) {
AnnotationVisitor av = v.newAnnotation(Type.getObjectType(KotlinSyntheticClass.CLASS_NAME.getInternalName()).getDescriptor(), true);
public static void dup(@NotNull InstructionAdapter v, @NotNull Type topOfStack, @NotNull Type afterTop) {
if (topOfStack.getSize() == 0 && afterTop.getSize() == 0) {
return;
}
if (topOfStack.getSize() == 0) {
dup(v, afterTop);
}
else if (afterTop.getSize() == 0) {
dup(v, topOfStack);
}
else if (afterTop.getSize() == 1) {
if (topOfStack.getSize() == 1) {
dup(v, 2);
}
else {
v.dup2X1();
v.pop2();
v.dupX2();
v.dupX2();
v.pop();
v.dup2X1();
}
}
else {
//Note: it's possible to write dup3 and dup4
throw new UnsupportedOperationException("Don't know how generate dup3/dup4 for: " + topOfStack + " and " + afterTop);
}
}
public static void writeKotlinSyntheticClassAnnotation(@NotNull ClassBuilder v, @NotNull GenerationState state) {
AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(KOTLIN_SYNTHETIC_CLASS), true);
JvmCodegenUtil.writeAbiVersion(av);
av.visitEnum(
JvmAnnotationNames.KIND_FIELD_NAME,
Type.getObjectType(KotlinSyntheticClass.KIND_INTERNAL_NAME).getDescriptor(),
kind.toString()
);
JvmCodegenUtil.writeModuleName(av, state);
av.visitEnd();
}
public static void writeAnnotationData(
@NotNull AnnotationVisitor av,
@NotNull DescriptorSerializer serializer,
@NotNull MessageLite message
) {
byte[] bytes = serializer.serialize(message);
JvmCodegenUtil.writeAbiVersion(av);
AnnotationVisitor data = av.visitArray(JvmAnnotationNames.DATA_FIELD_NAME);
for (String string : BitEncoding.encodeBytes(bytes)) {
data.visit(null, string);
}
data.visitEnd();
AnnotationVisitor strings = av.visitArray(JvmAnnotationNames.STRINGS_FIELD_NAME);
for (String string : ((JvmStringTable) serializer.getStringTable()).getStrings()) {
strings.visit(null, string);
}
strings.visitEnd();
}
@NotNull
public static String asmDescByFqNameWithoutInnerClasses(@NotNull FqName fqName) {
return asmTypeByFqNameWithoutInnerClasses(fqName).getDescriptor();
@@ -858,6 +929,17 @@ public class AsmUtil {
return JvmClassName.byFqNameWithoutInnerClasses(fqName).getInternalName();
}
@NotNull
public static String getSimpleInternalName(@NotNull String internalName) {
int lastSlash = internalName.lastIndexOf('/');
if (lastSlash >= 0) {
return internalName.substring(lastSlash + 1);
}
else {
return internalName;
}
}
public static void putJavaLangClassInstance(@NotNull InstructionAdapter v, @NotNull Type type) {
if (isPrimitive(type)) {
v.getstatic(boxType(type).getInternalName(), "TYPE", "Ljava/lang/Class;");
@@ -868,17 +950,16 @@ public class AsmUtil {
}
public static void wrapJavaClassIntoKClass(@NotNull InstructionAdapter v) {
v.invokestatic(REFLECTION, "foreignKotlinClass", Type.getMethodDescriptor(K_CLASS_TYPE, getType(Class.class)), false);
v.invokestatic(REFLECTION, "getOrCreateKotlinClass", Type.getMethodDescriptor(K_CLASS_TYPE, getType(Class.class)), false);
}
public static void wrapJavaClassesIntoKClasses(@NotNull InstructionAdapter v) {
v.invokestatic(REFLECTION, "foreignKotlinClasses", Type.getMethodDescriptor(K_CLASS_ARRAY_TYPE, getType(Class[].class)), false);
v.invokestatic(REFLECTION, "getOrCreateKotlinClasses", Type.getMethodDescriptor(K_CLASS_ARRAY_TYPE, getType(Class[].class)), false);
}
public static int getReceiverIndex(@NotNull CodegenContext context, @NotNull CallableMemberDescriptor descriptor) {
OwnerKind kind = context.getContextKind();
//Trait always should have this descriptor
return kind != OwnerKind.TRAIT_IMPL && isStaticMethod(kind, descriptor) ? 0 : 1;
return kind != OwnerKind.DEFAULT_IMPLS && isStaticMethod(kind, descriptor) ? 0 : 1;
}
}

View File

@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.codegen
import com.intellij.psi.tree.IElementType
import org.jetbrains.kotlin.codegen.pseudoInsns.fakeAlwaysFalseIfeq
import org.jetbrains.kotlin.codegen.pseudoInsns.fakeAlwaysTrueIfeq
import org.jetbrains.kotlin.lexer.JetTokens
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes.*
import org.jetbrains.org.objectweb.asm.Type
@@ -214,7 +214,7 @@ class NumberCompare(
override fun patchOpcode(opcode: Int, v: InstructionAdapter): Int {
when (operandType) {
Type.FLOAT_TYPE, Type.DOUBLE_TYPE -> {
if (opToken == JetTokens.GT || opToken == JetTokens.GTEQ) {
if (opToken == KtTokens.GT || opToken == KtTokens.GTEQ) {
v.cmpl(operandType)
}
else {
@@ -234,12 +234,12 @@ class NumberCompare(
companion object {
fun getNumberCompareOpcode(opToken: IElementType): Int {
return when (opToken) {
JetTokens.EQEQ, JetTokens.EQEQEQ -> IFNE
JetTokens.EXCLEQ, JetTokens.EXCLEQEQEQ -> IFEQ
JetTokens.GT -> IFLE
JetTokens.GTEQ -> IFLT
JetTokens.LT -> IFGE
JetTokens.LTEQ -> IFGT
KtTokens.EQEQ, KtTokens.EQEQEQ -> IFNE
KtTokens.EXCLEQ, KtTokens.EXCLEQEQEQ -> IFEQ
KtTokens.GT -> IFLE
KtTokens.GTEQ -> IFLT
KtTokens.LT -> IFGE
KtTokens.LTEQ -> IFGT
else -> {
throw UnsupportedOperationException("Don't know how to generate this condJump: " + opToken)
}
@@ -258,8 +258,8 @@ class ObjectCompare(
companion object {
fun getObjectCompareOpcode(opToken: IElementType): Int {
return when (opToken) {
JetTokens.EQEQEQ -> IF_ACMPNE
JetTokens.EXCLEQEQEQ -> IF_ACMPEQ
KtTokens.EQEQEQ -> IF_ACMPNE
KtTokens.EXCLEQEQEQ -> IF_ACMPEQ
else -> throw UnsupportedOperationException("don't know how to generate this condjump")
}
}

View File

@@ -18,12 +18,9 @@ package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
import org.jetbrains.kotlin.psi.JetExpression;
import org.jetbrains.kotlin.psi.KtExpression;
import org.jetbrains.kotlin.psi.ValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.VarargValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.*;
import org.jetbrains.org.objectweb.asm.Type;
import java.util.List;
@@ -51,13 +48,17 @@ public class CallBasedArgumentGenerator extends ArgumentGenerator {
"Value parameters and their types mismatch in sizes: " + valueParameters.size() + " != " + valueParameterTypes.size();
}
@NotNull
@Override
public List<Integer> generate(@NotNull List<ResolvedValueArgument> valueArguments) {
boolean shouldMarkLineNumbers = codegen.isShouldMarkLineNumbers();
codegen.setShouldMarkLineNumbers(false);
List<Integer> masks = super.generate(valueArguments);
codegen.setShouldMarkLineNumbers(shouldMarkLineNumbers);
public DefaultCallMask generate(
@NotNull List<? extends ResolvedValueArgument> valueArgumentsByIndex,
@NotNull List<? extends ResolvedValueArgument> valueArgs
) {
boolean shouldMarkLineNumbers = this.codegen.isShouldMarkLineNumbers();
this.codegen.setShouldMarkLineNumbers(false);
DefaultCallMask masks = super.generate(valueArgumentsByIndex, valueArgs);
this.codegen.setShouldMarkLineNumbers(shouldMarkLineNumbers);
return masks;
}
@@ -67,9 +68,9 @@ public class CallBasedArgumentGenerator extends ArgumentGenerator {
Type type = valueParameterTypes.get(i);
ValueArgument valueArgument = argument.getValueArgument();
assert valueArgument != null;
JetExpression argumentExpression = valueArgument.getArgumentExpression();
KtExpression argumentExpression = valueArgument.getArgumentExpression();
assert argumentExpression != null : valueArgument.asElement().getText();
callGenerator.genValueAndPut(parameter, argumentExpression, type);
callGenerator.genValueAndPut(parameter, argumentExpression, type, i);
}
@Override
@@ -77,7 +78,7 @@ public class CallBasedArgumentGenerator extends ArgumentGenerator {
ValueParameterDescriptor parameter = valueParameters.get(i);
Type type = valueParameterTypes.get(i);
pushDefaultValueOnStack(type, codegen.v);
callGenerator.afterParameterPut(type, null, parameter);
callGenerator.afterParameterPut(type, null, parameter, i);
}
@Override
@@ -85,6 +86,11 @@ public class CallBasedArgumentGenerator extends ArgumentGenerator {
ValueParameterDescriptor parameter = valueParameters.get(i);
Type type = valueParameterTypes.get(i);
codegen.genVarargs(argument, parameter.getType());
callGenerator.afterParameterPut(type, null, parameter);
callGenerator.afterParameterPut(type, null, parameter, i);
}
@Override
protected void reorderArgumentsIfNeeded(@NotNull List<? extends ArgumentAndDeclIndex> actualArgsWithDeclIndex) {
callGenerator.reorderArgumentsIfNeeded(actualArgsWithDeclIndex, valueParameterTypes);
}
}

View File

@@ -1,124 +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;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
import org.jetbrains.kotlin.psi.JetExpression;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.org.objectweb.asm.Type;
public abstract class CallGenerator {
static class DefaultCallGenerator extends CallGenerator {
private final ExpressionCodegen codegen;
public DefaultCallGenerator(ExpressionCodegen codegen) {
this.codegen = codegen;
}
@Override
public void genCallInner(
@NotNull Callable callableMethod,
ResolvedCall<?> resolvedCall,
boolean callDefault,
@NotNull ExpressionCodegen codegen
) {
if (!callDefault) {
callableMethod.genInvokeInstruction(codegen.v);
}
else {
((CallableMethod)callableMethod).genInvokeDefaultInstruction(codegen.v);
}
}
@Override
public void genCallWithoutAssertions(
@NotNull CallableMethod method, @NotNull ExpressionCodegen codegen
) {
method.genInvokeInstruction(codegen.v);
}
@Override
public void afterParameterPut(@NotNull Type type, StackValue stackValue, @NotNull ValueParameterDescriptor valueParameterDescriptor) {
}
@Override
public void putHiddenParams() {
}
@Override
public void genValueAndPut(
@NotNull ValueParameterDescriptor valueParameterDescriptor,
@NotNull JetExpression argumentExpression,
@NotNull Type parameterType
) {
StackValue value = codegen.gen(argumentExpression);
value.put(parameterType, codegen.v);
}
@Override
public void putCapturedValueOnStack(
@NotNull StackValue stackValue, @NotNull Type valueType, int paramIndex
) {
stackValue.put(stackValue.type, codegen.v);
}
@Override
public void putValueIfNeeded(
@Nullable ValueParameterDescriptor valueParameterDescriptor, @NotNull Type parameterType, @NotNull StackValue value
) {
value.put(value.type, codegen.v);
}
}
public void genCall(@NotNull Callable callableMethod, @Nullable ResolvedCall<?> resolvedCall, boolean callDefault, @NotNull ExpressionCodegen codegen) {
if (resolvedCall != null) {
JetExpression calleeExpression = resolvedCall.getCall().getCalleeExpression();
if (calleeExpression != null) {
codegen.markStartLineNumber(calleeExpression);
}
}
genCallInner(callableMethod, resolvedCall, callDefault, codegen);
}
public abstract void genCallInner(@NotNull Callable callableMethod, @Nullable ResolvedCall<?> resolvedCall, boolean callDefault, @NotNull ExpressionCodegen codegen);
public abstract void genCallWithoutAssertions(@NotNull CallableMethod callableMethod, @NotNull ExpressionCodegen codegen);
public abstract void afterParameterPut(@NotNull Type type, StackValue stackValue, @NotNull ValueParameterDescriptor valueParameterDescriptor);
public abstract void genValueAndPut(
@NotNull ValueParameterDescriptor valueParameterDescriptor,
@NotNull JetExpression argumentExpression,
@NotNull Type parameterType
);
public abstract void putValueIfNeeded(@Nullable ValueParameterDescriptor valueParameterDescriptor, @NotNull Type parameterType, @NotNull StackValue value);
public abstract void putCapturedValueOnStack(
@NotNull StackValue stackValue,
@NotNull Type valueType, int paramIndex
);
public abstract void putHiddenParams();
}

View File

@@ -0,0 +1,137 @@
/*
* 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
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.org.objectweb.asm.Type
abstract class CallGenerator {
internal class DefaultCallGenerator(private val codegen: ExpressionCodegen) : CallGenerator() {
override fun genCallInner(
callableMethod: Callable,
resolvedCall: ResolvedCall<*>?,
callDefault: Boolean,
codegen: ExpressionCodegen) {
if (!callDefault) {
callableMethod.genInvokeInstruction(codegen.v)
}
else {
(callableMethod as CallableMethod).genInvokeDefaultInstruction(codegen.v)
}
}
override fun genCallWithoutAssertions(
callableMethod: CallableMethod, codegen: ExpressionCodegen) {
callableMethod.genInvokeInstruction(codegen.v)
}
override fun afterParameterPut(
type: Type,
stackValue: StackValue?,
valueParameterDescriptor: ValueParameterDescriptor,
parameterIndex: Int) {
}
override fun putHiddenParams() {
}
override fun genValueAndPut(
valueParameterDescriptor: ValueParameterDescriptor,
argumentExpression: KtExpression,
parameterType: Type,
parameterIndex: Int) {
val value = codegen.gen(argumentExpression)
value.put(parameterType, codegen.v)
}
override fun putCapturedValueOnStack(
stackValue: StackValue, valueType: Type, paramIndex: Int) {
stackValue.put(stackValue.type, codegen.v)
}
override fun putValueIfNeeded(
valueParameterDescriptor: ValueParameterDescriptor?, parameterType: Type, value: StackValue) {
value.put(value.type, codegen.v)
}
override fun reorderArgumentsIfNeeded(actualArgsWithDeclIndex: List<ArgumentAndDeclIndex>, valueParameterTypes: List<Type>) {
val mark = codegen.myFrameMap.mark()
val reordered = actualArgsWithDeclIndex.withIndex().dropWhile {
it.value.declIndex == it.index
}
reordered.reversed().map {
val argumentAndDeclIndex = it.value
val type = valueParameterTypes.get(argumentAndDeclIndex.declIndex)
val stackValue = StackValue.local(codegen.frameMap.enterTemp(type), type)
stackValue.store(StackValue.onStack(type), codegen.v)
Pair(argumentAndDeclIndex.declIndex, stackValue)
}.sortedBy {
it.first
}.forEach {
it.second.put(valueParameterTypes.get(it.first), codegen.v)
}
mark.dropTo()
}
}
fun genCall(callableMethod: Callable, resolvedCall: ResolvedCall<*>?, callDefault: Boolean, codegen: ExpressionCodegen) {
if (resolvedCall != null) {
val calleeExpression = resolvedCall.call.calleeExpression
if (calleeExpression != null) {
codegen.markStartLineNumber(calleeExpression)
}
}
genCallInner(callableMethod, resolvedCall, callDefault, codegen)
}
abstract fun genCallInner(callableMethod: Callable, resolvedCall: ResolvedCall<*>?, callDefault: Boolean, codegen: ExpressionCodegen)
abstract fun genCallWithoutAssertions(callableMethod: CallableMethod, codegen: ExpressionCodegen)
abstract fun afterParameterPut(
type: Type,
stackValue: StackValue?,
valueParameterDescriptor: ValueParameterDescriptor,
parameterIndex: Int)
abstract fun genValueAndPut(
valueParameterDescriptor: ValueParameterDescriptor,
argumentExpression: KtExpression,
parameterType: Type,
parameterIndex: Int)
abstract fun putValueIfNeeded(
valueParameterDescriptor: ValueParameterDescriptor?,
parameterType: Type,
value: StackValue)
abstract fun putCapturedValueOnStack(
stackValue: StackValue,
valueType: Type, paramIndex: Int)
abstract fun putHiddenParams()
abstract fun reorderArgumentsIfNeeded(actualArgsWithDeclIndex: List<ArgumentAndDeclIndex>, valueParameterTypes: List<Type>)
}

View File

@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.bridges.BridgesPackage;
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
import org.jetbrains.kotlin.codegen.context.ClassContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.descriptors.*;
@@ -31,13 +31,13 @@ import java.util.List;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedSubclass;
public abstract class ClassBodyCodegen extends MemberCodegen<JetClassOrObject> {
protected final JetClassOrObject myClass;
public abstract class ClassBodyCodegen extends MemberCodegen<KtClassOrObject> {
protected final KtClassOrObject myClass;
protected final OwnerKind kind;
protected final ClassDescriptor descriptor;
protected ClassBodyCodegen(
@NotNull JetClassOrObject myClass,
@NotNull KtClassOrObject myClass,
@NotNull ClassContext context,
@NotNull ClassBuilder v,
@NotNull GenerationState state,
@@ -51,27 +51,39 @@ public abstract class ClassBodyCodegen extends MemberCodegen<JetClassOrObject> {
@Override
protected void generateBody() {
if (kind != OwnerKind.TRAIT_IMPL) {
if (kind != OwnerKind.DEFAULT_IMPLS) {
//generate nested classes first and only then generate class body. It necessary to access to nested CodegenContexts
for (JetDeclaration declaration : myClass.getDeclarations()) {
for (KtDeclaration declaration : myClass.getDeclarations()) {
if (shouldProcessFirst(declaration)) {
generateDeclaration(declaration);
}
}
}
for (JetDeclaration declaration : myClass.getDeclarations()) {
for (KtDeclaration declaration : myClass.getDeclarations()) {
if (!shouldProcessFirst(declaration)) {
generateDeclaration(declaration);
}
}
if (!DescriptorUtils.isTrait(descriptor)) {
for (DeclarationDescriptor memberDescriptor : descriptor.getDefaultType().getMemberScope().getAllDescriptors()) {
if (memberDescriptor instanceof FunctionDescriptor) {
FunctionDescriptor member = (FunctionDescriptor) memberDescriptor;
if (!member.getKind().isReal() && BridgesPackage.findTraitImplementation(member) == null) {
functionCodegen.generateBridges(member);
if (!DescriptorUtils.isInterface(descriptor)) {
for (DeclarationDescriptor memberDescriptor : DescriptorUtils.getAllDescriptors(descriptor.getDefaultType().getMemberScope())) {
if (memberDescriptor instanceof CallableMemberDescriptor) {
CallableMemberDescriptor member = (CallableMemberDescriptor) memberDescriptor;
if (!member.getKind().isReal() && ImplKt.findTraitImplementation(member) == null) {
if (member instanceof FunctionDescriptor) {
functionCodegen.generateBridges((FunctionDescriptor) member);
}
else if (member instanceof PropertyDescriptor) {
PropertyGetterDescriptor getter = ((PropertyDescriptor) member).getGetter();
if (getter != null) {
functionCodegen.generateBridges(getter);
}
PropertySetterDescriptor setter = ((PropertyDescriptor) member).getSetter();
if (setter != null) {
functionCodegen.generateBridges(setter);
}
}
}
}
}
@@ -80,27 +92,26 @@ public abstract class ClassBodyCodegen extends MemberCodegen<JetClassOrObject> {
generatePrimaryConstructorProperties();
}
private static boolean shouldProcessFirst(JetDeclaration declaration) {
return !(declaration instanceof JetProperty || declaration instanceof JetNamedFunction);
private static boolean shouldProcessFirst(KtDeclaration declaration) {
return !(declaration instanceof KtProperty || declaration instanceof KtNamedFunction);
}
protected void generateDeclaration(JetDeclaration declaration) {
if (declaration instanceof JetProperty || declaration instanceof JetNamedFunction) {
protected void generateDeclaration(KtDeclaration declaration) {
if (declaration instanceof KtProperty || declaration instanceof KtNamedFunction) {
genFunctionOrProperty(declaration);
}
else if (declaration instanceof JetClassOrObject) {
if (declaration instanceof JetEnumEntry && !enumEntryNeedSubclass(bindingContext, (JetEnumEntry) declaration)) {
else if (declaration instanceof KtClassOrObject) {
if (declaration instanceof KtEnumEntry && !enumEntryNeedSubclass(bindingContext, (KtEnumEntry) declaration)) {
return;
}
genClassOrObject((JetClassOrObject) declaration);
genClassOrObject((KtClassOrObject) declaration);
}
}
private void generatePrimaryConstructorProperties() {
boolean isAnnotation = descriptor.getKind() == ClassKind.ANNOTATION_CLASS;
for (JetParameter p : getPrimaryConstructorParameters()) {
for (KtParameter p : getPrimaryConstructorParameters()) {
if (p.hasValOrVar()) {
PropertyDescriptor propertyDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, p);
if (propertyDescriptor != null) {
@@ -116,9 +127,9 @@ public abstract class ClassBodyCodegen extends MemberCodegen<JetClassOrObject> {
}
@NotNull
protected List<JetParameter> getPrimaryConstructorParameters() {
if (myClass instanceof JetClass) {
return ((JetClass) myClass).getPrimaryConstructorParameters();
protected List<KtParameter> getPrimaryConstructorParameters() {
if (myClass instanceof KtClass) {
return ((KtClass) myClass).getPrimaryConstructorParameters();
}
return Collections.emptyList();
}

View File

@@ -20,6 +20,7 @@ import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.ClassVisitor;

View File

@@ -22,7 +22,7 @@ import com.intellij.psi.PsiFile;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.io.DataOutputStream;
import kotlin.KotlinPackage;
import kotlin.CollectionsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
import org.jetbrains.kotlin.load.kotlin.PackageParts;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.JetFile;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.serialization.jvm.JvmPackageTable;
import org.jetbrains.org.objectweb.asm.Type;
@@ -85,9 +85,6 @@ public class ClassFileFactory implements OutputFileCollection {
if (!isDone) {
isDone = true;
Collection<PackageCodegen> packageCodegens = package2codegen.values();
for (PackageCodegen codegen : packageCodegens) {
codegen.done();
}
Collection<MultifileClassCodegen> multifileClassCodegens = multifileClass2codegen.values();
for (MultifileClassCodegen codegen : multifileClassCodegens) {
codegen.done();
@@ -114,13 +111,13 @@ public class ClassFileFactory implements OutputFileCollection {
sourceFiles.addAll(toIoFilesIgnoringNonPhysical(PackagePartClassUtils.getFilesWithCallables(codegen.getFiles())));
}
for (PackageParts part : CodegenPackage.addCompiledPartsAndSort(parts, state)) {
for (PackageParts part : ClassFileUtilsKt.addCompiledPartsAndSort(parts, state)) {
PackageParts.Companion.serialize(part, builder);
}
if (builder.getPackagePartsCount() != 0) {
state.getProgress().reportOutput(sourceFiles, new File(outputFilePath));
generators.put(outputFilePath, new OutAndSourceFileList(KotlinPackage.toList(sourceFiles)) {
generators.put(outputFilePath, new OutAndSourceFileList(CollectionsKt.toList(sourceFiles)) {
@Override
public byte[] asBytes(ClassBuilderFactory factory) {
try {
@@ -226,7 +223,7 @@ public class ClassFileFactory implements OutputFileCollection {
}
@NotNull
public PackageCodegen forPackage(@NotNull FqName fqName, @NotNull Collection<JetFile> files) {
public PackageCodegen forPackage(@NotNull FqName fqName, @NotNull Collection<KtFile> files) {
assert !isDone : "Already done!";
PackageCodegen codegen = package2codegen.get(fqName);
if (codegen == null) {
@@ -238,7 +235,7 @@ public class ClassFileFactory implements OutputFileCollection {
}
@NotNull
public MultifileClassCodegen forMultifileClass(@NotNull FqName facadeFqName, @NotNull Collection<JetFile> files) {
public MultifileClassCodegen forMultifileClass(@NotNull FqName facadeFqName, @NotNull Collection<KtFile> files) {
assert !isDone : "Already done!";
MultifileClassCodegen codegen = multifileClass2codegen.get(facadeFqName);
if (codegen == null) {
@@ -337,14 +334,14 @@ public class ClassFileFactory implements OutputFileCollection {
public abstract String asText(ClassBuilderFactory factory);
}
public void removeInlinedClasses(Set<String> classNamesToRemove) {
public void removeClasses(Set<String> classNamesToRemove) {
for (String classInternalName : classNamesToRemove) {
generators.remove(classInternalName + ".class");
}
}
@TestOnly
public List<JetFile> getInputFiles() {
public List<KtFile> getInputFiles() {
return state.getFiles();
}
}

View File

@@ -31,7 +31,7 @@ public abstract class ClassNameCollectionClassBuilderFactory(
protected abstract fun handleClashingNames(internalName: String, origin: JvmDeclarationOrigin)
override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassNameCollectionClassBuilder {
override fun newClassBuilder(origin: JvmDeclarationOrigin): DelegatingClassBuilder {
return ClassNameCollectionClassBuilder(origin, delegate.newClassBuilder(origin))
}

View File

@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.codegen;
import com.google.common.collect.Lists;
import com.intellij.util.ArrayUtil;
import kotlin.KotlinPackage;
import kotlin.CollectionsKt;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
@@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
import org.jetbrains.kotlin.codegen.context.ClosureContext;
import org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializerExtension;
import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
@@ -34,20 +35,18 @@ import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
import org.jetbrains.kotlin.psi.JetElement;
import org.jetbrains.kotlin.psi.KtElement;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.scopes.JetScope;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
import org.jetbrains.kotlin.serialization.ProtoBuf;
import org.jetbrains.kotlin.serialization.SerializationUtil;
import org.jetbrains.kotlin.serialization.StringTable;
import org.jetbrains.kotlin.serialization.deserialization.NameResolver;
import org.jetbrains.kotlin.serialization.jvm.BitEncoding;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.expressions.OperatorConventions;
import org.jetbrains.kotlin.utils.UtilsPackage;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
import org.jetbrains.kotlin.util.OperatorNameConventions;
import org.jetbrains.kotlin.utils.FunctionsKt;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.Type;
@@ -61,37 +60,33 @@ import java.util.List;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.codegen.ExpressionCodegen.generateClassLiteralReference;
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConst;
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.writeModuleName;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLOSURE;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass;
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.OtherOrigin;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class ClosureCodegen extends MemberCodegen<JetElement> {
public class ClosureCodegen extends MemberCodegen<KtElement> {
private final FunctionDescriptor funDescriptor;
private final ClassDescriptor classDescriptor;
private final SamType samType;
private final JetType superClassType;
private final List<JetType> superInterfaceTypes;
private final KotlinType superClassType;
private final List<KotlinType> superInterfaceTypes;
private final FunctionDescriptor functionReferenceTarget;
private final FunctionGenerationStrategy strategy;
private final CalculatedClosure closure;
private final Type asmType;
private final int visibilityFlag;
private final KotlinSyntheticClass.Kind syntheticClassKind;
private Method constructor;
private Type superClassAsmType;
public ClosureCodegen(
@NotNull GenerationState state,
@NotNull JetElement element,
@NotNull KtElement element,
@Nullable SamType samType,
@NotNull ClosureContext context,
@NotNull KotlinSyntheticClass.Kind syntheticClassKind,
@Nullable FunctionDescriptor functionReferenceTarget,
@NotNull FunctionGenerationStrategy strategy,
@NotNull MemberCodegen<?> parentCodegen,
@@ -102,17 +97,16 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
this.funDescriptor = context.getFunctionDescriptor();
this.classDescriptor = context.getContextDescriptor();
this.samType = samType;
this.syntheticClassKind = syntheticClassKind;
this.functionReferenceTarget = functionReferenceTarget;
this.strategy = strategy;
if (samType == null) {
this.superInterfaceTypes = new ArrayList<JetType>();
this.superInterfaceTypes = new ArrayList<KotlinType>();
JetType superClassType = null;
for (JetType supertype : classDescriptor.getTypeConstructor().getSupertypes()) {
KotlinType superClassType = null;
for (KotlinType supertype : classDescriptor.getTypeConstructor().getSupertypes()) {
ClassifierDescriptor classifier = supertype.getConstructor().getDeclarationDescriptor();
if (DescriptorUtils.isTrait(classifier)) {
if (DescriptorUtils.isInterface(classifier)) {
superInterfaceTypes.add(supertype);
}
else {
@@ -126,7 +120,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
}
else {
this.superInterfaceTypes = Collections.singletonList(samType.getType());
this.superClassType = getBuiltIns(funDescriptor).getAnyType();
this.superClassType = DescriptorUtilsKt.getBuiltIns(funDescriptor).getAnyType();
}
this.closure = bindingContext.get(CLOSURE, classDescriptor);
@@ -148,7 +142,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
sw.writeSuperclassEnd();
String[] superInterfaceAsmTypes = new String[superInterfaceTypes.size()];
for (int i = 0; i < superInterfaceTypes.size(); i++) {
JetType superInterfaceType = superInterfaceTypes.get(i);
KotlinType superInterfaceType = superInterfaceTypes.get(i);
sw.writeInterface();
superInterfaceAsmTypes[i] = typeMapper.mapSupertype(superInterfaceType, sw).getInternalName();
sw.writeInterfaceEnd();
@@ -189,7 +183,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
typeMapper.mapSignature(funDescriptor).getAsmMethod()
);
functionCodegen.generateMethod(OtherOrigin(element, funDescriptor), funDescriptor, strategy);
functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), funDescriptor, strategy);
//TODO: rewrite cause ugly hack
if (samType != null) {
@@ -200,8 +194,8 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
descriptorForBridges
.initialize(null, erasedInterfaceFunction.getDispatchReceiverParameter(), erasedInterfaceFunction.getTypeParameters(),
erasedInterfaceFunction.getValueParameters(), erasedInterfaceFunction.getReturnType(), Modality.OPEN,
erasedInterfaceFunction.getVisibility());
erasedInterfaceFunction.getValueParameters(), erasedInterfaceFunction.getReturnType(),
Modality.OPEN, erasedInterfaceFunction.getVisibility());
descriptorForBridges.addOverriddenDescriptor(erasedInterfaceFunction);
functionCodegen.generateBridges(descriptorForBridges);
@@ -211,38 +205,33 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
generateFunctionReferenceMethods(functionReferenceTarget);
}
this.constructor = generateConstructor();
if (isConst(closure)) {
generateConstInstance(asmType, asmType, UtilsPackage.<InstructionAdapter>doNothing());
}
genClosureFields(closure, v, typeMapper);
functionCodegen.generateDefaultIfNeeded(
context.intoFunction(funDescriptor), funDescriptor, context.getContextKind(), DefaultParameterValueLoader.DEFAULT, null
);
this.constructor = generateConstructor();
if (isConst(closure)) {
generateConstInstance(asmType, asmType, FunctionsKt.<InstructionAdapter>doNothing());
}
genClosureFields(closure, v, typeMapper);
}
@Override
protected void generateKotlinAnnotation() {
writeKotlinSyntheticClassAnnotation(v, syntheticClassKind);
writeKotlinSyntheticClassAnnotation(v, state);
DescriptorSerializer serializer =
DescriptorSerializer.createTopLevel(new JvmSerializerExtension(v.getSerializationBindings(), typeMapper));
DescriptorSerializer.createForLambda(
new JvmSerializerExtension(v.getSerializationBindings(), typeMapper, state.getUseTypeTableInSerializer())
);
ProtoBuf.Callable callableProto = serializer.callableProto(funDescriptor).build();
ProtoBuf.Function functionProto = serializer.functionProto(funDescriptor).build();
StringTable strings = serializer.getStringTable();
NameResolver nameResolver = new NameResolver(strings.serializeSimpleNames(), strings.serializeQualifiedNames());
AnnotationVisitor av = v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_CALLABLE), true);
JvmCodegenUtil.writeAbiVersion(av);
AnnotationVisitor array = av.visitArray(JvmAnnotationNames.DATA_FIELD_NAME);
for (String string : BitEncoding.encodeBytes(SerializationUtil.serializeCallableData(nameResolver, callableProto))) {
array.visit(null, string);
}
array.visitEnd();
AnnotationVisitor av = v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_FUNCTION), true);
writeAnnotationData(av, serializer, functionProto);
writeModuleName(av, state);
av.visitEnd();
}
@@ -271,7 +260,9 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
}
if (functionReferenceTarget != null) {
v.invokestatic(REFLECTION, "function", Type.getMethodDescriptor(K_FUNCTION, FUNCTION_REFERENCE), false);
if (!"true".equalsIgnoreCase(System.getProperty("kotlin.jvm.optimize.callable.references"))) {
v.invokestatic(REFLECTION, "function", Type.getMethodDescriptor(K_FUNCTION, FUNCTION_REFERENCE), false);
}
}
return Unit.INSTANCE$;
@@ -284,7 +275,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
if (bridge.equals(delegate)) return;
MethodVisitor mv =
v.newMethod(OtherOrigin(element, funDescriptor), ACC_PUBLIC | ACC_BRIDGE,
v.newMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), ACC_PUBLIC | ACC_BRIDGE,
bridge.getName(), bridge.getDescriptor(), null, ArrayUtil.EMPTY_STRING_ARRAY);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
@@ -292,14 +283,14 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);
ImplementationBodyCodegen.markLineNumberForSyntheticFunction(DescriptorUtils.getParentOfType(funDescriptor, ClassDescriptor.class), iv);
MemberCodegen.markLineNumberForSyntheticFunction(DescriptorUtils.getParentOfType(funDescriptor, ClassDescriptor.class), iv);
iv.load(0, asmType);
Type[] myParameterTypes = bridge.getArgumentTypes();
List<ParameterDescriptor> calleeParameters = KotlinPackage.plus(
UtilsPackage.<ParameterDescriptor>singletonOrEmptyList(funDescriptor.getExtensionReceiverParameter()),
List<ParameterDescriptor> calleeParameters = CollectionsKt.<ParameterDescriptor>plus(
org.jetbrains.kotlin.utils.CollectionsKt.<ParameterDescriptor>singletonOrEmptyList(funDescriptor.getExtensionReceiverParameter()),
funDescriptor.getValueParameters()
);
@@ -329,7 +320,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
if (generateBody) {
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);
generateCallableReferenceDeclarationContainer(iv, descriptor, typeMapper);
generateCallableReferenceDeclarationContainer(iv, descriptor, state);
iv.areturn(K_DECLARATION_CONTAINER_TYPE);
FunctionCodegen.endVisit(iv, "function reference getOwner", element);
}
@@ -363,24 +354,24 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
public static void generateCallableReferenceDeclarationContainer(
@NotNull InstructionAdapter iv,
@NotNull CallableDescriptor descriptor,
@NotNull JetTypeMapper typeMapper
@NotNull GenerationState state
) {
DeclarationDescriptor container = descriptor.getContainingDeclaration();
if (container instanceof ClassDescriptor) {
// TODO: getDefaultType() here is wrong and won't work for arrays
StackValue value = generateClassLiteralReference(typeMapper, ((ClassDescriptor) container).getDefaultType());
StackValue value = generateClassLiteralReference(state.getTypeMapper(), ((ClassDescriptor) container).getDefaultType());
value.put(K_CLASS_TYPE, iv);
}
else if (container instanceof PackageFragmentDescriptor) {
String packageClassInternalName = PackageClassUtils.getPackageClassInternalName(
((PackageFragmentDescriptor) container).getFqName()
);
iv.getstatic(packageClassInternalName, JvmAbi.KOTLIN_PACKAGE_FIELD_NAME, K_PACKAGE_TYPE.getDescriptor());
iv.aconst(state.getTypeMapper().mapOwner(descriptor));
iv.aconst(state.getModuleName());
iv.invokestatic(REFLECTION, "getOrCreateKotlinPackage",
Type.getMethodDescriptor(K_DECLARATION_CONTAINER_TYPE, getType(Class.class), getType(String.class)), false);
}
else if (container instanceof ScriptDescriptor) {
// TODO: correct container for scripts (KScript?)
StackValue value = generateClassLiteralReference(
typeMapper, ((ScriptDescriptor) container).getClassDescriptor().getDefaultType()
state.getTypeMapper(), ((ScriptDescriptor) container).getClassDescriptor().getDefaultType()
);
value.put(K_CLASS_TYPE, iv);
}
@@ -396,8 +387,8 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
Type[] argTypes = fieldListToTypeArray(args);
Method constructor = new Method("<init>", Type.VOID_TYPE, argTypes);
MethodVisitor mv = v.newMethod(OtherOrigin(element, funDescriptor), visibilityFlag, "<init>", constructor.getDescriptor(), null,
ArrayUtil.EMPTY_STRING_ARRAY);
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), visibilityFlag, "<init>", constructor.getDescriptor(), null,
ArrayUtil.EMPTY_STRING_ARRAY);
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);
@@ -440,7 +431,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
Type type = typeMapper.mapType(captureThis);
args.add(FieldInfo.createForHiddenField(ownerType, type, CAPTURED_THIS_FIELD));
}
JetType captureReceiverType = closure.getCaptureReceiverType();
KotlinType captureReceiverType = closure.getCaptureReceiverType();
if (captureReceiverType != null) {
args.add(FieldInfo.createForHiddenField(ownerType, typeMapper.mapType(captureReceiverType), CAPTURED_RECEIVER_FIELD));
}
@@ -454,7 +445,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
: typeMapper.mapType((VariableDescriptor) descriptor);
args.add(FieldInfo.createForHiddenField(ownerType, type, "$" + descriptor.getName().asString()));
}
else if (DescriptorUtils.isLocalFunction(descriptor)) {
else if (ExpressionTypingUtils.isLocalFunction(descriptor)) {
Type classType = asmTypeForAnonymousClass(bindingContext, (FunctionDescriptor) descriptor);
args.add(FieldInfo.createForHiddenField(ownerType, classType, "$" + descriptor.getName().asString()));
}
@@ -477,9 +468,9 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
public static FunctionDescriptor getErasedInvokeFunction(@NotNull FunctionDescriptor elementDescriptor) {
int arity = elementDescriptor.getValueParameters().size();
ClassDescriptor elementClass = elementDescriptor.getExtensionReceiverParameter() == null
? getBuiltIns(elementDescriptor).getFunction(arity)
: getBuiltIns(elementDescriptor).getExtensionFunction(arity);
JetScope scope = elementClass.getDefaultType().getMemberScope();
return scope.getFunctions(OperatorConventions.INVOKE, NoLookupLocation.FROM_BACKEND).iterator().next();
? DescriptorUtilsKt.getBuiltIns(elementDescriptor).getFunction(arity)
: DescriptorUtilsKt.getBuiltIns(elementDescriptor).getExtensionFunction(arity);
MemberScope scope = elementClass.getDefaultType().getMemberScope();
return scope.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND).iterator().next();
}
}

View File

@@ -19,16 +19,9 @@ package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.fileClasses.JvmFileClassInfo
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider
import org.jetbrains.kotlin.psi.JetFile
import org.jetbrains.kotlin.psi.KtFile
public class CodegenFileClassesProvider(private val packageFacadesAsMultifileClasses: Boolean) : JvmFileClassesProvider {
override public fun getFileClassInfo(file: JetFile): JvmFileClassInfo {
val fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(file)
if (packageFacadesAsMultifileClasses && !fileClassInfo.isMultifileClass) {
return JvmFileClassUtil.getMultifilePackageFacadePartInfo(file)
}
else {
return fileClassInfo
}
}
public class CodegenFileClassesProvider : JvmFileClassesProvider {
override public fun getFileClassInfo(file: KtFile): JvmFileClassInfo =
JvmFileClassUtil.getFileClassInfoNoResolve(file)
}

View File

@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.*;
public class CodegenStatementVisitor extends JetVisitor<StackValue, StackValue> {
public class CodegenStatementVisitor extends KtVisitor<StackValue, StackValue> {
private final ExpressionCodegen codegen;
public CodegenStatementVisitor(ExpressionCodegen codegen) {
@@ -27,38 +27,38 @@ public class CodegenStatementVisitor extends JetVisitor<StackValue, StackValue>
}
@Override
public StackValue visitJetElement(@NotNull JetElement element, StackValue receiver) {
public StackValue visitKtElement(@NotNull KtElement element, StackValue receiver) {
return element.accept(codegen, receiver);
}
@Override
public StackValue visitIfExpression(@NotNull JetIfExpression expression, StackValue receiver) {
public StackValue visitIfExpression(@NotNull KtIfExpression expression, StackValue receiver) {
return codegen.generateIfExpression(expression, true);
}
@Override
public StackValue visitTryExpression(@NotNull JetTryExpression expression, StackValue data) {
public StackValue visitTryExpression(@NotNull KtTryExpression expression, StackValue data) {
return codegen.generateTryExpression(expression, true);
}
@Override
public StackValue visitNamedFunction(@NotNull JetNamedFunction function, StackValue data) {
public StackValue visitNamedFunction(@NotNull KtNamedFunction function, StackValue data) {
return codegen.visitNamedFunction(function, data, true);
}
@Override
public StackValue visitWhenExpression(@NotNull JetWhenExpression expression, StackValue data) {
public StackValue visitWhenExpression(@NotNull KtWhenExpression expression, StackValue data) {
return codegen.generateWhenExpression(expression, true);
}
@Override
public StackValue visitBlockExpression(@NotNull JetBlockExpression expression, StackValue data) {
public StackValue visitBlockExpression(@NotNull KtBlockExpression expression, StackValue data) {
return codegen.generateBlock(expression, true);
}
@Override
public StackValue visitLabeledExpression(@NotNull JetLabeledExpression expression, StackValue receiver) {
JetExpression baseExpression = expression.getBaseExpression();
public StackValue visitLabeledExpression(@NotNull KtLabeledExpression expression, StackValue receiver) {
KtExpression baseExpression = expression.getBaseExpression();
assert baseExpression != null : "Label expression should have base one: " + expression.getText();
return baseExpression.accept(this, receiver);
}

View File

@@ -20,7 +20,9 @@ import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.codegen.MutableClassDescriptor
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.SpecialSignatureInfo
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.resolve.OverrideResolver
import org.jetbrains.kotlin.resolve.OverridingUtil
@@ -28,10 +30,8 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.JetTypeChecker
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_ABSTRACT
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_PUBLIC
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_SYNTHETIC
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.org.objectweb.asm.Opcodes.*
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import java.util.ArrayList
import java.util.HashSet
@@ -97,8 +97,40 @@ class CollectionStubMethodGenerator(
// errors when compiling Java against such classes because one of them doesn't seem to override the generic method
// declared in the Java Collection interface (can't override generic with erased). So we maintain an additional set of
// methods which need to be generated with the ACC_SYNTHETIC flag
val originalSignature = method.findOverriddenFromDirectSuperClass(mutableClass)!!.getOriginal().signature()
if (originalSignature.getAsmMethod() != signature.getAsmMethod()) {
val overriddenMethod = method.findOverriddenFromDirectSuperClass(mutableClass)!!
val originalSignature = overriddenMethod.original.signature()
var specialSignature: JvmMethodSignature? = null
if (overriddenMethod.isBuiltinWithSpecialDescriptorInJvm()) {
// Stubs for remove(Ljava/lang/Object;)Z and remove(I) should not be synthetic
// Otherwise Javac will not see it
val overriddenMethodSignature = overriddenMethod.signature()
val genericSignatureInfo = overriddenMethod.getSpecialSignatureInfo()
val specialGenericSignature =
if (genericSignatureInfo != null)
genericSignatureInfo.signature
else
overriddenMethodSignature.genericsSignature
val (asmMethod, valueParameters) =
// if remove(E) in Kotlin -> remove(Object) in Java
// so choose original signature
if (genericSignatureInfo == SpecialSignatureInfo.GENERIC_PARAMETER)
Pair(originalSignature.asmMethod, originalSignature.valueParameters)
else
Pair(overriddenMethodSignature.asmMethod, overriddenMethodSignature.valueParameters)
specialSignature = JvmMethodSignature(
asmMethod,
specialGenericSignature,
valueParameters
)
methodStubsToGenerate.add(specialSignature)
}
if (originalSignature.asmMethod != signature.asmMethod && originalSignature.asmMethod != specialSignature?.asmMethod) {
syntheticStubsToGenerate.add(originalSignature)
}
}
@@ -155,7 +187,7 @@ class CollectionStubMethodGenerator(
return ourSuperCollectionClasses.filter { klass -> klass.readOnlyClass !in redundantClasses }
}
private fun Collection<JetType>.classes(): Collection<ClassDescriptor> =
private fun Collection<KotlinType>.classes(): Collection<ClassDescriptor> =
this.map { it.getConstructor().getDeclarationDescriptor() as ClassDescriptor }
private fun findFakeOverridesForMethodsFromMutableCollection(
@@ -167,7 +199,7 @@ class CollectionStubMethodGenerator(
OverrideResolver.generateOverridesInAClass(klass, listOf(), object : OverridingUtil.DescriptorSink {
override fun addFakeOverride(fakeOverride: CallableMemberDescriptor) {
if (fakeOverride !is FunctionDescriptor) return
if (fakeOverride.findOverriddenFromDirectSuperClass(mutableCollectionClass) != null) {
if (fakeOverride.findOverriddenFromDirectSuperClass(mutableCollectionClass)?.kind == DECLARATION) {
result.add(fakeOverride)
}
}
@@ -181,13 +213,13 @@ class CollectionStubMethodGenerator(
return result
}
private fun Collection<JetType>.findMostSpecificTypeForClass(klass: ClassDescriptor): JetType {
private fun Collection<KotlinType>.findMostSpecificTypeForClass(klass: ClassDescriptor): KotlinType {
val types = this.filter { it.getConstructor().getDeclarationDescriptor() == klass }
if (types.isEmpty()) error("No supertype of $klass in $this")
if (types.size() == 1) return types.first()
// Find the first type in the list such that it's a subtype of every other type in that list
return types.first { type ->
types.all { other -> JetTypeChecker.DEFAULT.isSubtypeOf(type, other) }
types.all { other -> KotlinTypeChecker.DEFAULT.isSubtypeOf(type, other) }
}
}
@@ -207,8 +239,8 @@ class CollectionStubMethodGenerator(
return this.getOverriddenDescriptors().firstOrNull { it.getContainingDeclaration() == classDescriptor }
}
private fun newType(classDescriptor: ClassDescriptor, typeArguments: List<TypeProjection>): JetType {
return JetTypeImpl.create(Annotations.EMPTY, classDescriptor, false, typeArguments)
private fun newType(classDescriptor: ClassDescriptor, typeArguments: List<TypeProjection>): KotlinType {
return KotlinTypeImpl.create(Annotations.EMPTY, classDescriptor, false, typeArguments)
}
private fun FunctionDescriptor.signature(): JvmMethodSignature = typeMapper.mapSignature(this)

View File

@@ -0,0 +1,60 @@
/*
* 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
import org.jetbrains.org.objectweb.asm.Type
import java.util.*
class DefaultCallMask(val size: Int) {
val bits: BitSet = BitSet(size)
fun mark(index: Int) {
assert (index < size) {
"Mask index should be less then size, but $index >= $size"
}
bits.set(index)
}
fun toInts(): List<Int> {
if (bits.isEmpty || size == 0) {
return emptyList()
}
val masks = ArrayList<Int>(1)
var mask = 0
for (i in 0..size - 1) {
if (i != 0 && i % Integer.SIZE == 0) {
masks.add(mask)
mask = 0;
}
mask = mask or if (bits.get(i)) 1 shl (i % Integer.SIZE) else 0
}
masks.add(mask)
return masks
}
public fun generateOnStackIfNeeded(callGenerator: CallGenerator): Boolean {
val toInts = toInts()
for (mask in toInts) {
callGenerator.putValueIfNeeded(null, Type.INT_TYPE, StackValue.constant(mask, Type.INT_TYPE))
}
return toInts.isNotEmpty();
}
}

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.codegen;
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
import org.jetbrains.kotlin.psi.JetParameter;
import org.jetbrains.kotlin.psi.KtParameter;
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
@@ -31,7 +31,7 @@ public interface DefaultParameterValueLoader {
ValueParameterDescriptor descriptor,
ExpressionCodegen codegen
) {
JetParameter jetParameter = (JetParameter) descriptorToDeclaration(descriptor);
KtParameter jetParameter = (KtParameter) descriptorToDeclaration(descriptor);
assert jetParameter != null;
return codegen.gen(jetParameter.getDefaultValue());
}

View File

@@ -19,9 +19,9 @@ package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.psi.JetClass
import org.jetbrains.kotlin.psi.JetClassOrObject
import org.jetbrains.kotlin.psi.JetElement
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmOverloadsAnnotation
@@ -38,13 +38,15 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
* If all of the parameters of the specified constructor declare default values,
* generates a no-argument constructor that passes default values for all arguments.
*/
fun generateConstructorOverloadsIfNeeded(
fun generatePrimaryConstructorOverloadsIfNeeded(
constructorDescriptor: ConstructorDescriptor,
classBuilder: ClassBuilder,
contextKind: OwnerKind,
classOrObject: JetClassOrObject
classOrObject: KtClassOrObject
) {
if (generateOverloadsIfNeeded(classOrObject, constructorDescriptor, constructorDescriptor, contextKind, classBuilder)) {
val methodElement = classOrObject.getPrimaryConstructor() ?: classOrObject
if (generateOverloadsIfNeeded(methodElement, constructorDescriptor, constructorDescriptor, contextKind, classBuilder)) {
return
}
@@ -52,7 +54,7 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
return
}
generateOverloadWithSubstitutedParameters(constructorDescriptor, constructorDescriptor, classBuilder, classOrObject, contextKind,
generateOverloadWithSubstitutedParameters(constructorDescriptor, constructorDescriptor, classBuilder, methodElement, contextKind,
constructorDescriptor.countDefaultParameters())
}
@@ -64,13 +66,13 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
*
* @param functionDescriptor the method for which the overloads are generated
* @param delegateFunctionDescriptor the method descriptor for the implementation that we need to call
* (same as [functionDescriptor] in all cases except for companion object methods annotated with [platformStatic],
* (same as [functionDescriptor] in all cases except for companion object methods annotated with @JvmStatic,
* where [functionDescriptor] is the static method in the main class and [delegateFunctionDescriptor] is the
* implementation in the companion object class)
* @return true if the overloads annotation was found on the element, false otherwise
*/
fun generateOverloadsIfNeeded(
methodElement: JetElement?,
methodElement: KtElement?,
functionDescriptor: FunctionDescriptor,
delegateFunctionDescriptor: FunctionDescriptor,
contextKind: OwnerKind,
@@ -100,7 +102,7 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
*
* @param functionDescriptor the method for which the overloads are generated
* @param delegateFunctionDescriptor the method descriptor for the implementation that we need to call
* (same as [functionDescriptor] in all cases except for companion object methods annotated with [platformStatic],
* (same as [functionDescriptor] in all cases except for companion object methods annotated with @JvmStatic,
* where [functionDescriptor] is the static method in the main class and [delegateFunctionDescriptor] is the
* implementation in the companion object class)
* @param methodElement the PSI element for the method implementation (used in diagnostic messages only)
@@ -109,7 +111,7 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
functionDescriptor: FunctionDescriptor,
delegateFunctionDescriptor: FunctionDescriptor,
classBuilder: ClassBuilder,
methodElement: JetElement?,
methodElement: KtElement?,
contextKind: OwnerKind,
substituteCount: Int
) {
@@ -173,7 +175,7 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
}
else {
AsmUtil.pushDefaultValueOnStack(paramType, v)
val i = parameterDescriptor.getIndex()
val i = parameterDescriptor.index
if (i != 0 && i % Integer.SIZE == 0) {
masks.add(mask)
mask = 0
@@ -208,7 +210,7 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
return functionDescriptor.getValueParameters().filter { !it.declaresDefaultValue() || --remainingCount >= 0 }
}
private fun isEmptyConstructorNeeded(constructorDescriptor: ConstructorDescriptor, classOrObject: JetClassOrObject): Boolean {
private fun isEmptyConstructorNeeded(constructorDescriptor: ConstructorDescriptor, classOrObject: KtClassOrObject): Boolean {
val classDescriptor = constructorDescriptor.getContainingDeclaration()
if (classDescriptor.getKind() != ClassKind.CLASS) return false
@@ -220,12 +222,12 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
return false
if (constructorDescriptor.getValueParameters().isEmpty()) return false
if (classOrObject is JetClass && hasSecondaryConstructorsWithNoParameters(classOrObject)) return false
if (classOrObject is KtClass && hasSecondaryConstructorsWithNoParameters(classOrObject)) return false
return constructorDescriptor.getValueParameters().all { it.declaresDefaultValue() }
}
private fun hasSecondaryConstructorsWithNoParameters(klass: JetClass) =
private fun hasSecondaryConstructorsWithNoParameters(klass: KtClass) =
klass.getSecondaryConstructors().any { it.getValueParameters().isEmpty() }
}

View File

@@ -20,6 +20,7 @@ import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.ClassVisitor;

View File

@@ -22,20 +22,28 @@ import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
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 JetTypeMapper typeMapper) {
if (!classDescriptor.getKind().isSingleton()) {
return createForSingleton(classDescriptor, typeMapper, false);
}
@NotNull
public static FieldInfo createForSingleton(@NotNull ClassDescriptor classDescriptor, @NotNull JetTypeMapper typeMapper, boolean oldSingleton) {
if (!classDescriptor.getKind().isSingleton() || DescriptorUtils.isEnumEntry(classDescriptor)) {
throw new UnsupportedOperationException("Can't create singleton field for class: " + classDescriptor);
}
if (isNonCompanionObject(classDescriptor) || CompanionObjectMapping.hasMappingToObject(classDescriptor)) {
Type type = typeMapper.mapType(classDescriptor);
return new FieldInfo(type, type, JvmAbi.INSTANCE_FIELD, true);
if (isNonCompanionObject(classDescriptor) || COMPANION_OBJECT_MAPPING.hasMappingToObject(classDescriptor)) {
return createSingletonViaInstance(classDescriptor, typeMapper, oldSingleton);
}
else {
ClassDescriptor ownerDescriptor = DescriptorUtils.getParentOfType(classDescriptor, ClassDescriptor.class);
@@ -45,6 +53,16 @@ public class FieldInfo {
}
}
@NotNull
public static FieldInfo createSingletonViaInstance(
@NotNull ClassDescriptor classDescriptor,
@NotNull JetTypeMapper typeMapper,
boolean oldSingleton
) {
Type type = typeMapper.mapType(classDescriptor);
return new FieldInfo(type, type, oldSingleton ? JvmAbi.DEPRECATED_INSTANCE_FIELD : JvmAbi.INSTANCE_FIELD, true);
}
@NotNull
public static FieldInfo createForHiddenField(@NotNull Type owner, @NotNull Type fieldType, @NotNull String fieldName) {
return new FieldInfo(owner, fieldType, fieldName, false);

View File

@@ -25,12 +25,10 @@ import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.bridges.Bridge;
import org.jetbrains.kotlin.backend.common.bridges.BridgesPackage;
import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
import org.jetbrains.kotlin.codegen.annotation.AnnotatedWithOnlyTargetedAnnotations;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.context.CodegenContextUtil;
import org.jetbrains.kotlin.codegen.context.DelegatingFacadeContext;
import org.jetbrains.kotlin.codegen.context.MethodContext;
import org.jetbrains.kotlin.codegen.context.*;
import org.jetbrains.kotlin.codegen.intrinsics.TypeIntrinsics;
import org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
@@ -39,22 +37,27 @@ 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.kotlin.nativeDeclarations.NativeDeclarationsPackage;
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
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.JetNamedFunction;
import org.jetbrains.kotlin.psi.KtNamedFunction;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
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.jvm.diagnostics.DiagnosticsPackage;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
@@ -72,13 +75,13 @@ import java.util.Set;
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isNullableAny;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.codegen.JvmSerializationBindings.*;
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.*;
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION;
import static org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.*;
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.getSourceFromDescriptor;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.*;
import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class FunctionCodegen {
@@ -103,13 +106,13 @@ public class FunctionCodegen {
this.memberCodegen = memberCodegen;
}
public void gen(@NotNull JetNamedFunction function) {
public void gen(@NotNull KtNamedFunction function) {
SimpleFunctionDescriptor functionDescriptor = bindingContext.get(BindingContext.FUNCTION, function);
assert functionDescriptor != null : "No descriptor for function " + function.getText() + "\n" +
"in " + function.getContainingFile().getVirtualFile();
if (owner.getContextKind() != OwnerKind.TRAIT_IMPL || function.hasBody()) {
generateMethod(OtherOrigin(function, functionDescriptor), functionDescriptor,
if (owner.getContextKind() != OwnerKind.DEFAULT_IMPLS || function.hasBody()) {
generateMethod(JvmDeclarationOriginKt.OtherOrigin(function, functionDescriptor), functionDescriptor,
new FunctionGenerationStrategy.FunctionDefault(state, functionDescriptor, function));
}
@@ -120,7 +123,7 @@ public class FunctionCodegen {
}
public void generateOverloadsWithDefaultValues(
@Nullable JetNamedFunction function,
@Nullable KtNamedFunction function,
@NotNull FunctionDescriptor functionDescriptor,
@NotNull FunctionDescriptor delegateFunctionDescriptor
) {
@@ -144,11 +147,17 @@ public class FunctionCodegen {
@NotNull FunctionGenerationStrategy strategy
) {
OwnerKind contextKind = methodContext.getContextKind();
if (isInterface(functionDescriptor.getContainingDeclaration()) &&
functionDescriptor.getVisibility() == Visibilities.PRIVATE &&
contextKind != OwnerKind.DEFAULT_IMPLS) {
return;
}
JvmMethodSignature jvmSignature = typeMapper.mapSignature(functionDescriptor, contextKind);
Method asmMethod = jvmSignature.getAsmMethod();
int flags = getMethodAsmFlags(functionDescriptor, contextKind);
boolean isNative = NativeDeclarationsPackage.hasNativeAnnotation(functionDescriptor);
boolean isNative = NativeKt.hasNativeAnnotation(functionDescriptor);
if (isNative && owner instanceof DelegatingFacadeContext) {
// Native methods are only defined in facades and do not need package part implementations
@@ -175,10 +184,10 @@ public class FunctionCodegen {
generateBridges(functionDescriptor);
boolean staticInCompanionObject = AnnotationsPackage.isPlatformStaticInCompanionObject(functionDescriptor);
boolean staticInCompanionObject = AnnotationUtilKt.isPlatformStaticInCompanionObject(functionDescriptor);
if (staticInCompanionObject) {
ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
parentBodyCodegen.addAdditionalTask(new PlatformStaticGenerator(functionDescriptor, origin, state));
parentBodyCodegen.addAdditionalTask(new JvmStaticGenerator(functionDescriptor, origin, state));
}
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES || isAbstractMethod(functionDescriptor, contextKind)) {
@@ -200,9 +209,9 @@ public class FunctionCodegen {
generateMethodBody(mv, functionDescriptor, methodContext, jvmSignature, strategy, memberCodegen);
}
else if (staticInCompanionObject) {
// native platformStatic foo() in companion object should delegate to the static native function moved to the outer class
// native @JvmStatic foo() in companion object should delegate to the static native function moved to the outer class
mv.visitCode();
FunctionDescriptor staticFunctionDescriptor = PlatformStaticGenerator.createStaticFunctionDescriptor(functionDescriptor);
FunctionDescriptor staticFunctionDescriptor = JvmStaticGenerator.createStaticFunctionDescriptor(functionDescriptor);
JvmMethodSignature jvmMethodSignature =
typeMapper.mapSignature(memberCodegen.getContext().accessibleDescriptor(staticFunctionDescriptor, null));
Type owningType = typeMapper.mapClass((ClassifierDescriptor) staticFunctionDescriptor.getContainingDeclaration());
@@ -228,6 +237,22 @@ public class FunctionCodegen {
else {
annotationCodegen.genAnnotations(functionDescriptor, asmMethod.getReturnType());
}
writePackageFacadeMethodAnnotationsIfNeeded(mv);
}
private void writePackageFacadeMethodAnnotationsIfNeeded(MethodVisitor mv) {
if (owner instanceof PackageFacadeContext) {
PackageFacadeContext packageFacadeContext = (PackageFacadeContext) owner;
Type delegateToClassType = packageFacadeContext.getPublicFacadeType();
if (delegateToClassType != null) {
String className = delegateToClassType.getClassName();
AnnotationVisitor
av = mv.visitAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_DELEGATED_METHOD), true);
av.visit(JvmAnnotationNames.IMPLEMENTATION_CLASS_NAME_FIELD_NAME, className);
av.visitEnd();
}
}
}
private void generateParameterAnnotations(
@@ -248,7 +273,9 @@ public class FunctionCodegen {
if (kind == JvmMethodParameterKind.VALUE) {
ValueParameterDescriptor parameter = iterator.next();
v.getSerializationBindings().put(INDEX_FOR_VALUE_PARAMETER, parameter, i);
if (parameter.getIndex() != i) {
v.getSerializationBindings().put(INDEX_FOR_VALUE_PARAMETER, parameter, i);
}
AnnotationCodegen annotationCodegen = AnnotationCodegen.forParameter(i, mv, typeMapper);
if (functionDescriptor instanceof PropertySetterDescriptor) {
@@ -305,8 +332,7 @@ public class FunctionCodegen {
}
else if (isFunctionLiteral(functionDescriptor) ||
isLocalFunction(functionDescriptor) ||
isFunctionExpression(functionDescriptor)
) {
isFunctionExpression(functionDescriptor)) {
return typeMapper.mapType(context.getThisDescriptor());
}
else {
@@ -330,6 +356,10 @@ public class FunctionCodegen {
JetTypeMapper typeMapper = parentCodegen.typeMapper;
Label methodEnd;
int functionFakeIndex = -1;
int lambdaFakeIndex = -1;
if (context.getParentContext() instanceof DelegatingFacadeContext) {
generateFacadeDelegateMethodBody(mv, signature.getAsmMethod(), (DelegatingFacadeContext) context.getParentContext());
methodEnd = new Label();
@@ -337,6 +367,13 @@ public class FunctionCodegen {
else {
FrameMap frameMap = createFrameMap(parentCodegen.state, functionDescriptor, signature, isStaticMethod(context.getContextKind(),
functionDescriptor));
if (context.isInlineFunction()) {
functionFakeIndex = frameMap.enterTemp(Type.INT_TYPE);
}
if (context.isInliningLambda()) {
lambdaFakeIndex = frameMap.enterTemp(Type.INT_TYPE);
}
Label methodEntry = new Label();
mv.visitLabel(methodEntry);
@@ -354,6 +391,27 @@ public class FunctionCodegen {
Type thisType = getThisTypeForFunction(functionDescriptor, context, typeMapper);
generateLocalVariableTable(mv, signature, functionDescriptor, thisType, methodBegin, methodEnd, context.getContextKind());
if (context.isInlineFunction() && functionFakeIndex != -1) {
mv.visitLocalVariable(
JvmAbi.LOCAL_VARIABLE_NAME_PREFIX_INLINE_FUNCTION + functionDescriptor.getName().asString(),
Type.INT_TYPE.getDescriptor(), null,
methodBegin, methodEnd,
functionFakeIndex);
}
if (context.isInliningLambda() && thisType != null && lambdaFakeIndex != -1) {
String name = thisType.getClassName();
int indexOfLambdaOrdinal = name.lastIndexOf("$");
if (indexOfLambdaOrdinal > 0) {
int lambdaOrdinal = Integer.parseInt(name.substring(indexOfLambdaOrdinal + 1));
mv.visitLocalVariable(
JvmAbi.LOCAL_VARIABLE_NAME_PREFIX_INLINE_ARGUMENT + lambdaOrdinal,
Type.INT_TYPE.getDescriptor(), null,
methodBegin, methodEnd,
lambdaFakeIndex);
}
}
}
private static void generateLocalVariableTable(
@@ -482,29 +540,65 @@ public class FunctionCodegen {
public void generateBridges(@NotNull FunctionDescriptor descriptor) {
if (descriptor instanceof ConstructorDescriptor) return;
if (owner.getContextKind() == OwnerKind.TRAIT_IMPL) return;
if (isTrait(descriptor.getContainingDeclaration())) return;
if (owner.getContextKind() == OwnerKind.DEFAULT_IMPLS) return;
if (isInterface(descriptor.getContainingDeclaration())) return;
// 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 (CallResolverUtilPackage.isOrOverridesSynthesized(descriptor)) return;
if (CallResolverUtilKt.isOrOverridesSynthesized(descriptor)) return;
Set<Bridge<Method>> bridgesToGenerate = BridgesPackage.generateBridgesForFunctionDescriptor(
descriptor,
new Function1<FunctionDescriptor, Method>() {
@Override
public Method invoke(FunctionDescriptor descriptor) {
return typeMapper.mapSignature(descriptor).getAsmMethod();
boolean isSpecial = SpecialBuiltinMembers.getOverriddenBuiltinWithDifferentJvmDescriptor(descriptor) != null;
Set<Bridge<Method>> bridgesToGenerate;
if (!isSpecial) {
bridgesToGenerate = ImplKt.generateBridgesForFunctionDescriptor(
descriptor,
new Function1<FunctionDescriptor, Method>() {
@Override
public Method invoke(FunctionDescriptor descriptor) {
return typeMapper.mapSignature(descriptor).getAsmMethod();
}
}
}
);
);
if (!bridgesToGenerate.isEmpty()) {
PsiElement origin = descriptor.getKind() == DECLARATION ? getSourceFromDescriptor(descriptor) : null;
boolean isSpecialBridge =
BuiltinMethodsWithSpecialGenericSignature.getOverriddenBuiltinFunctionWithErasedValueParametersInJava(descriptor) != null;
if (!bridgesToGenerate.isEmpty()) {
PsiElement origin = descriptor.getKind() == DECLARATION ? getSourceFromDescriptor(descriptor) : null;
for (Bridge<Method> bridge : bridgesToGenerate) {
generateBridge(origin, descriptor, bridge.getFrom(), bridge.getTo());
for (Bridge<Method> bridge : bridgesToGenerate) {
generateBridge(origin, descriptor, bridge.getFrom(), bridge.getTo(), isSpecialBridge, false);
}
}
}
else {
Set<BridgeForBuiltinSpecial<Method>> specials = BuiltinSpecialBridgesUtil.generateBridgesForBuiltinSpecial(
descriptor,
new Function1<FunctionDescriptor, Method>() {
@Override
public Method invoke(FunctionDescriptor descriptor) {
return typeMapper.mapSignature(descriptor).getAsmMethod();
}
}
);
if (!specials.isEmpty()) {
PsiElement origin = descriptor.getKind() == DECLARATION ? getSourceFromDescriptor(descriptor) : null;
for (BridgeForBuiltinSpecial<Method> bridge : specials) {
generateBridge(
origin, descriptor, bridge.getFrom(), bridge.getTo(),
bridge.isSpecial(), bridge.isDelegateToSuper());
}
}
if (!descriptor.getKind().isReal() && isAbstractMethod(descriptor, OwnerKind.IMPLEMENTATION)) {
CallableDescriptor overridden = SpecialBuiltinMembers.getOverriddenBuiltinWithDifferentJvmDescriptor(descriptor);
assert overridden != null;
Method method = typeMapper.mapSignature(descriptor).getAsmMethod();
int flags = ACC_ABSTRACT | getVisibilityAccessFlag(descriptor);
v.newMethod(JvmDeclarationOriginKt.OtherOrigin(overridden), flags, method.getName(), method.getDescriptor(), null, null);
}
}
}
@@ -559,13 +653,11 @@ public class FunctionCodegen {
@NotNull FunctionDescriptor functionDescriptor,
@NotNull OwnerKind kind,
@NotNull DefaultParameterValueLoader loadStrategy,
@Nullable JetNamedFunction function
@Nullable KtNamedFunction function
) {
DeclarationDescriptor contextClass = owner.getContextDescriptor().getContainingDeclaration();
if (kind != OwnerKind.TRAIT_IMPL &&
contextClass instanceof ClassDescriptor &&
((ClassDescriptor) contextClass).getKind() == ClassKind.INTERFACE) {
if (kind != OwnerKind.DEFAULT_IMPLS && isInterface(contextClass)) {
return;
}
@@ -577,7 +669,7 @@ public class FunctionCodegen {
getDeprecatedAccessFlag(functionDescriptor) |
ACC_SYNTHETIC;
if (!(functionDescriptor instanceof ConstructorDescriptor)) {
flags |= ACC_STATIC;
flags |= ACC_STATIC | ACC_BRIDGE;
}
// $default methods are never private to be accessible from other class files (e.g. inner) without the need of synthetic accessors
flags &= ~ACC_PRIVATE;
@@ -585,7 +677,7 @@ public class FunctionCodegen {
Method defaultMethod = typeMapper.mapDefaultMethod(functionDescriptor, kind);
MethodVisitor mv = v.newMethod(
Synthetic(function, functionDescriptor),
JvmDeclarationOriginKt.Synthetic(function, functionDescriptor),
flags,
defaultMethod.getName(),
defaultMethod.getDescriptor(), null,
@@ -615,7 +707,7 @@ public class FunctionCodegen {
@NotNull FunctionDescriptor functionDescriptor,
@NotNull MethodVisitor mv,
@NotNull DefaultParameterValueLoader loadStrategy,
@Nullable JetNamedFunction function,
@Nullable KtNamedFunction function,
@NotNull MemberCodegen<?> parentCodegen
) {
GenerationState state = parentCodegen.state;
@@ -740,12 +832,15 @@ public class FunctionCodegen {
@Nullable PsiElement origin,
@NotNull FunctionDescriptor descriptor,
@NotNull Method bridge,
@NotNull Method delegateTo
@NotNull Method delegateTo,
boolean isSpecialBridge,
boolean isStubDeclarationWithDelegationToSuper
) {
int flags = ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC; // TODO.
boolean isSpecialOrDelegationToSuper = isSpecialBridge || isStubDeclarationWithDelegationToSuper;
int flags = ACC_PUBLIC | ACC_BRIDGE | (!isSpecialOrDelegationToSuper ? ACC_SYNTHETIC : 0) | (isSpecialBridge ? ACC_FINAL : 0); // TODO.
MethodVisitor mv =
v.newMethod(DiagnosticsPackage.Bridge(descriptor, origin), flags, bridge.getName(), bridge.getDescriptor(), null, null);
v.newMethod(JvmDeclarationOriginKt.Bridge(descriptor, origin), flags, bridge.getName(), bridge.getDescriptor(), null, null);
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) return;
mv.visitCode();
@@ -754,7 +849,9 @@ public class FunctionCodegen {
Type[] originalArgTypes = delegateTo.getArgumentTypes();
InstructionAdapter iv = new InstructionAdapter(mv);
ImplementationBodyCodegen.markLineNumberForSyntheticFunction(owner.getThisDescriptor(), iv);
MemberCodegen.markLineNumberForSyntheticFunction(owner.getThisDescriptor(), iv);
generateInstanceOfBarrierIfNeeded(iv, descriptor, bridge, delegateTo);
iv.load(0, OBJECT_TYPE);
for (int i = 0, reg = 1; i < argTypes.length; i++) {
@@ -763,7 +860,15 @@ public class FunctionCodegen {
reg += argTypes[i].getSize();
}
iv.invokevirtual(v.getThisName(), delegateTo.getName(), delegateTo.getDescriptor());
if (isStubDeclarationWithDelegationToSuper) {
ClassDescriptor parentClass = getSuperClassDescriptor((ClassDescriptor) descriptor.getContainingDeclaration());
assert parentClass != null;
String parentInternalName = typeMapper.mapClass(parentClass).getInternalName();
iv.invokespecial(parentInternalName, delegateTo.getName(), delegateTo.getDescriptor());
}
else {
iv.invokevirtual(v.getThisName(), delegateTo.getName(), delegateTo.getDescriptor());
}
StackValue.coerce(delegateTo.getReturnType(), bridge.getReturnType(), iv);
iv.areturn(bridge.getReturnType());
@@ -771,6 +876,62 @@ public class FunctionCodegen {
endVisit(mv, "bridge method", origin);
}
private static void generateInstanceOfBarrierIfNeeded(
@NotNull InstructionAdapter iv,
@NotNull FunctionDescriptor descriptor,
@NotNull Method bridge,
@NotNull Method delegateTo
) {
if (BuiltinMethodsWithSpecialGenericSignature.getOverriddenBuiltinFunctionWithErasedValueParametersInJava(descriptor) == null) return;
assert descriptor.getValueParameters().size() == 1 : "Should be descriptor with one value parameter, but found: " + descriptor;
if (bridge.getArgumentTypes()[0].getSort() != Type.OBJECT) return;
iv.load(1, OBJECT_TYPE);
KotlinType jetType = descriptor.getValueParameters().get(0).getType();
// TODO: reuse logic from ExpressionCodegen
if (jetType.isMarkedNullable()) {
Label nope = new Label();
Label end = new Label();
iv.dup();
iv.ifnull(nope);
TypeIntrinsics.instanceOf(
iv,
jetType,
boxType(delegateTo.getArgumentTypes()[0])
);
iv.goTo(end);
iv.mark(nope);
iv.pop();
iv.iconst(1);
iv.mark(end);
}
else {
TypeIntrinsics.instanceOf(
iv,
jetType,
boxType(delegateTo.getArgumentTypes()[0])
);
}
Label afterBarrier = new Label();
iv.ifne(afterBarrier);
String shortName = getFqName(descriptor).shortName().asString();
StackValue returnValue =
("indexOf".equals(shortName) || "lastIndexOf".equals(shortName)) ? StackValue.constant(-1, Type.INT_TYPE) : StackValue.none();
returnValue.put(bridge.getReturnType(), iv);
iv.areturn(bridge.getReturnType());
iv.visitLabel(afterBarrier);
}
public void genDelegate(@NotNull FunctionDescriptor functionDescriptor, FunctionDescriptor overriddenDescriptor, StackValue field) {
genDelegate(functionDescriptor, overriddenDescriptor.getOriginal(),
(ClassDescriptor) overriddenDescriptor.getContainingDeclaration(), field);
@@ -783,7 +944,7 @@ public class FunctionCodegen {
final StackValue field
) {
generateMethod(
Delegation(DescriptorToSourceUtils.descriptorToDeclaration(delegatedTo), delegateFunction), delegateFunction,
JvmDeclarationOriginKt.Delegation(DescriptorToSourceUtils.descriptorToDeclaration(delegatedTo), delegateFunction), delegateFunction,
new FunctionGenerationStrategy() {
@Override
public void generateBody(

View File

@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.context.MethodContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
import org.jetbrains.kotlin.psi.JetDeclarationWithBody;
import org.jetbrains.kotlin.psi.KtDeclarationWithBody;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
@@ -34,12 +34,12 @@ public abstract class FunctionGenerationStrategy {
);
public static class FunctionDefault extends CodegenBased<CallableDescriptor> {
private final JetDeclarationWithBody declaration;
private final KtDeclarationWithBody declaration;
public FunctionDefault(
@NotNull GenerationState state,
@NotNull CallableDescriptor descriptor,
@NotNull JetDeclarationWithBody declaration
@NotNull KtDeclarationWithBody declaration
) {
super(state, descriptor);
this.declaration = declaration;

View File

@@ -16,15 +16,12 @@
package org.jetbrains.kotlin.codegen;
import kotlin.KotlinPackage;
import kotlin.CollectionsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.psi.Call;
import org.jetbrains.kotlin.psi.JetCallExpression;
import org.jetbrains.kotlin.psi.JetExpression;
import org.jetbrains.kotlin.psi.ValueArgument;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.calls.model.DelegatingResolvedCall;
import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
@@ -36,11 +33,8 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.*;
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
import static org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrategy.CodegenBased<FunctionDescriptor> {
@@ -67,7 +61,7 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
every argument boils down to calling LOAD with the corresponding index
*/
JetCallExpression fakeExpression = constructFakeFunctionCall();
KtCallExpression fakeExpression = constructFakeFunctionCall();
final List<? extends ValueArgument> fakeArguments = fakeExpression.getValueArguments();
final ReceiverValue dispatchReceiver = computeAndSaveReceiver(signature, codegen, referencedFunction.getDispatchReceiverParameter());
@@ -75,6 +69,18 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
computeAndSaveArguments(fakeArguments, codegen);
ResolvedCall<CallableDescriptor> fakeResolvedCall = new DelegatingResolvedCall<CallableDescriptor>(resolvedCall) {
private final Map<ValueParameterDescriptor, ResolvedValueArgument> argumentMap;
{
argumentMap = new LinkedHashMap<ValueParameterDescriptor, ResolvedValueArgument>(fakeArguments.size());
int index = 0;
List<ValueParameterDescriptor> parameters = callableDescriptor.getValueParameters();
for (ValueArgument argument : fakeArguments) {
argumentMap.put(parameters.get(index), new ExpressionValueArgument(argument));
index++;
}
}
@NotNull
@Override
public ReceiverValue getExtensionReceiver() {
@@ -90,11 +96,13 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
@NotNull
@Override
public List<ResolvedValueArgument> getValueArgumentsByIndex() {
List<ResolvedValueArgument> result = new ArrayList<ResolvedValueArgument>(fakeArguments.size());
for (ValueArgument argument : fakeArguments) {
result.add(new ExpressionValueArgument(argument));
}
return result;
return new ArrayList<ResolvedValueArgument>(argumentMap.values());
}
@NotNull
@Override
public Map<ValueParameterDescriptor, ResolvedValueArgument> getValueArguments() {
return argumentMap;
}
};
@@ -120,7 +128,7 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
}
@NotNull
private JetCallExpression constructFakeFunctionCall() {
private KtCallExpression constructFakeFunctionCall() {
StringBuilder fakeFunctionCall = new StringBuilder("callableReferenceFakeCall(");
for (Iterator<ValueParameterDescriptor> iterator = referencedFunction.getValueParameters().iterator(); iterator.hasNext(); ) {
ValueParameterDescriptor descriptor = iterator.next();
@@ -130,14 +138,14 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
}
}
fakeFunctionCall.append(")");
return (JetCallExpression) JetPsiFactory(state.getProject()).createExpression(fakeFunctionCall.toString());
return (KtCallExpression) KtPsiFactoryKt.KtPsiFactory(state.getProject()).createExpression(fakeFunctionCall.toString());
}
private void computeAndSaveArguments(@NotNull List<? extends ValueArgument> fakeArguments, @NotNull ExpressionCodegen codegen) {
int receivers = (referencedFunction.getDispatchReceiverParameter() != null ? 1 : 0) +
(referencedFunction.getExtensionReceiverParameter() != null ? 1 : 0);
List<ValueParameterDescriptor> parameters = KotlinPackage.drop(callableDescriptor.getValueParameters(), receivers);
List<ValueParameterDescriptor> parameters = CollectionsKt.drop(callableDescriptor.getValueParameters(), receivers);
for (int i = 0; i < parameters.size(); i++) {
ValueParameterDescriptor parameter = parameters.get(i);
ValueArgument fakeArgument = fakeArguments.get(i);
@@ -156,7 +164,8 @@ public class FunctionReferenceGenerationStrategy extends FunctionGenerationStrat
) {
if (receiver == null) return NO_RECEIVER;
JetExpression receiverExpression = JetPsiFactory(state.getProject()).createExpression("callableReferenceFakeReceiver");
KtExpression receiverExpression = KtPsiFactoryKt
.KtPsiFactory(state.getProject()).createExpression("callableReferenceFakeReceiver");
codegen.tempVariables.put(receiverExpression, receiverParameterStackValue(signature));
return new ExpressionReceiver(receiverExpression, receiver.getType());
}

View File

@@ -0,0 +1,190 @@
/*
* 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
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.backend.common.bridges.findImplementationFromInterface
import org.jetbrains.kotlin.backend.common.bridges.firstSuperMethodFromKotlin
import org.jetbrains.kotlin.codegen.context.ClassContext
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.KOTLIN_INTERFACE_DEFAULT_IMPLS
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.diagnostics.DelegationToTraitImpl
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes.*
import java.util.*
public class InterfaceImplBodyCodegen(
aClass: KtClassOrObject,
context: ClassContext,
v: ClassBuilder,
state: GenerationState,
parentCodegen: MemberCodegen<*>?
) : ClassBodyCodegen(aClass, context, InterfaceImplBodyCodegen.InterfaceImplClassBuilder(v), state, parentCodegen) {
private var isAnythingGenerated: Boolean = false
get() = (v as InterfaceImplClassBuilder).isAnythingGenerated
override fun generateDeclaration() {
v.defineClass(
myClass, V1_6, ACC_PUBLIC or ACC_FINAL,
typeMapper.mapDefaultImpls(descriptor).internalName,
null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY
)
v.visitSource(myClass.getContainingFile().getName(), null)
}
override fun classForInnerClassRecord(): ClassDescriptor? {
if (!isAnythingGenerated) return null
if (DescriptorUtils.isLocal(descriptor)) return null
val classDescriptorImpl = ClassDescriptorImpl(
descriptor, Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME),
Modality.FINAL, Collections.emptyList(), SourceElement.NO_SOURCE)
classDescriptorImpl.initialize(MemberScope.Empty, emptySet(), null)
return classDescriptorImpl
}
override fun generateSyntheticParts() {
for (memberDescriptor in descriptor.getDefaultType().getMemberScope().getContributedDescriptors()) {
if (memberDescriptor !is CallableMemberDescriptor) continue
if (memberDescriptor.getKind().isReal()) continue
if (memberDescriptor.getVisibility() == Visibilities.INVISIBLE_FAKE) continue
if (memberDescriptor.getModality() == Modality.ABSTRACT) continue
val implementation = findImplementationFromInterface(memberDescriptor) ?: continue
// If implementation is located in a Java interface, it will be inherited via normal Java rules
if (implementation is JavaMethodDescriptor) continue
// We create a copy of the function with kind = DECLARATION so that FunctionCodegen will generate its body
val copy = memberDescriptor.copy(memberDescriptor.getContainingDeclaration(), Modality.OPEN, memberDescriptor.getVisibility(),
CallableMemberDescriptor.Kind.DECLARATION, true)
if (memberDescriptor is FunctionDescriptor) {
generateDelegationToSuperTraitImpl(copy as FunctionDescriptor, implementation as FunctionDescriptor)
}
else if (memberDescriptor is PropertyDescriptor) {
implementation as PropertyDescriptor
val getter = (copy as PropertyDescriptor).getGetter()
val implGetter = implementation.getGetter()
if (getter != null && implGetter != null) {
generateDelegationToSuperTraitImpl(getter, implGetter)
}
val setter = copy.getSetter()
val implSetter = implementation.getSetter()
if (setter != null && implSetter != null) {
generateDelegationToSuperTraitImpl(setter, implSetter)
}
}
}
}
private fun generateDelegationToSuperTraitImpl(descriptor: FunctionDescriptor, implementation: FunctionDescriptor) {
val delegateTo = firstSuperMethodFromKotlin(descriptor, implementation) as FunctionDescriptor? ?: return
// We can't call super methods from Java 1.8 interfaces because that requires INVOKESPECIAL which is forbidden from TImpl class
if (delegateTo is JavaMethodDescriptor) return
functionCodegen.generateMethod(
DelegationToTraitImpl(DescriptorToSourceUtils.descriptorToDeclaration(descriptor), descriptor),
descriptor,
object : FunctionGenerationStrategy.CodegenBased<FunctionDescriptor>(state, descriptor) {
override fun doGenerateBody(codegen: ExpressionCodegen, signature: JvmMethodSignature) {
val iv = codegen.v
val method = typeMapper.mapToCallableMethod(delegateTo, true)
val myParameters = signature.getValueParameters()
val calleeParameters = method.getValueParameters()
if (myParameters.size() != calleeParameters.size()) {
throw AssertionError(
"Method from super interface has a different signature.\n" +
"This method:\n%s\n%s\n%s\nSuper method:\n%s\n%s\n%s".format(
callableDescriptor, signature, myParameters, delegateTo, method, calleeParameters
)
)
}
var k = 0
val it = calleeParameters.iterator()
for (parameter in myParameters) {
val type = parameter.getAsmType()
StackValue.local(k, type).put(it.next().getAsmType(), iv)
k += type.getSize()
}
method.genInvokeInstruction(iv)
StackValue.coerce(method.returnType, signature.getReturnType(), iv)
iv.areturn(signature.getReturnType())
}
})
}
override fun generateKotlinAnnotation() {
(v as InterfaceImplClassBuilder).stopCounting()
val av = v.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(KOTLIN_INTERFACE_DEFAULT_IMPLS), true)
av.visit(JvmAnnotationNames.VERSION_FIELD_NAME, JvmAbi.VERSION.toArray())
av.visitEnd()
AsmUtil.writeKotlinSyntheticClassAnnotation(v, state)
}
override fun done() {
super.done()
if (!isAnythingGenerated) {
state.factory.removeClasses(setOf(typeMapper.mapDefaultImpls(descriptor).internalName))
}
}
private class InterfaceImplClassBuilder(private val v: ClassBuilder) : DelegatingClassBuilder() {
private var shouldCount: Boolean = true
var isAnythingGenerated: Boolean = false
private set
fun stopCounting() {
shouldCount = false
}
override fun getDelegate() = v
override fun newMethod(
origin: JvmDeclarationOrigin,
access: Int,
name: String,
desc: String,
signature: String?,
exceptions: Array<out String>?
): MethodVisitor {
if (shouldCount) {
isAnythingGenerated = true
}
return super.newMethod(origin, access, name, desc, signature, exceptions)
}
}
}

View File

@@ -16,39 +16,34 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import kotlin.KotlinPackage;
import com.intellij.psi.PsiFile;
import kotlin.CollectionsKt;
import kotlin.StringsKt;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.context.FacadePartWithSourceFile;
import org.jetbrains.kotlin.codegen.context.MethodContext;
import org.jetbrains.kotlin.codegen.context.PackageContext;
import org.jetbrains.kotlin.codegen.context.RootContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor;
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaPackageFragment;
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass;
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement;
import org.jetbrains.kotlin.load.kotlin.ModuleMapping;
import org.jetbrains.kotlin.load.kotlin.VirtualFileKotlinClass;
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider;
import org.jetbrains.kotlin.psi.JetFile;
import org.jetbrains.kotlin.psi.JetFunction;
import org.jetbrains.kotlin.psi.codeFragmentUtil.CodeFragmentUtilPackage;
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityUtilsKt;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.psi.KtFunction;
import org.jetbrains.kotlin.psi.codeFragmentUtil.CodeFragmentUtilKt;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.org.objectweb.asm.AnnotationVisitor;
import java.io.File;
@@ -61,7 +56,7 @@ public class JvmCodegenUtil {
private JvmCodegenUtil() {
}
public static boolean isInterface(DeclarationDescriptor descriptor) {
public static boolean isJvmInterface(DeclarationDescriptor descriptor) {
if (descriptor instanceof ClassDescriptor) {
ClassKind kind = ((ClassDescriptor) descriptor).getKind();
return kind == ClassKind.INTERFACE || kind == ClassKind.ANNOTATION_CLASS;
@@ -69,8 +64,8 @@ public class JvmCodegenUtil {
return false;
}
public static boolean isInterface(JetType type) {
return isInterface(type.getConstructor().getDeclarationDescriptor());
public static boolean isJvmInterface(KotlinType type) {
return isJvmInterface(type.getConstructor().getDeclarationDescriptor());
}
public static boolean isConst(@NotNull CalculatedClosure closure) {
@@ -85,25 +80,21 @@ public class JvmCodegenUtil {
return !isFakeOverride && !isDelegate &&
(((context.hasThisDescriptor() && containingDeclaration == context.getThisDescriptor()) ||
(context.getParentContext() instanceof PackageContext
&& isSamePackageInSameModule(context.getParentContext().getContextDescriptor(), containingDeclaration)))
&& context.getContextKind() != OwnerKind.TRAIT_IMPL);
((context.getParentContext() instanceof FacadePartWithSourceFile)
&& isWithinSameFile(((FacadePartWithSourceFile) context.getParentContext()).getSourceFile(), descriptor)))
&& context.getContextKind() != OwnerKind.DEFAULT_IMPLS);
}
private static boolean isSamePackageInSameModule(
@NotNull DeclarationDescriptor callerOwner,
@NotNull DeclarationDescriptor calleeOwner
private static boolean isWithinSameFile(
@Nullable KtFile callerFile,
@NotNull CallableMemberDescriptor descriptor
) {
if (callerOwner instanceof PackageFragmentDescriptor && calleeOwner instanceof PackageFragmentDescriptor) {
PackageFragmentDescriptor callerFragment = (PackageFragmentDescriptor) callerOwner;
PackageFragmentDescriptor calleeFragment = (PackageFragmentDescriptor) calleeOwner;
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration().getOriginal();
if (containingDeclaration instanceof PackageFragmentDescriptor) {
PsiElement calleeElement = DescriptorToSourceUtils.descriptorToDeclaration(descriptor);
PsiFile calleeFile = calleeElement != null ? calleeElement.getContainingFile() : null;
return callerFile != null && callerFile != SourceFile.NO_SOURCE_FILE && calleeFile == callerFile;
// backing field should be used directly within same module of same package
if (callerFragment == calleeFragment) {
return true;
}
return callerFragment.getFqName().equals(calleeFragment.getFqName())
&& calleeFragment instanceof IncrementalPackageFragmentProvider.IncrementalPackageFragment;
}
return false;
}
@@ -120,47 +111,15 @@ public class JvmCodegenUtil {
CallableMemberDescriptor directMember = getDirectMember(declarationDescriptor);
if (directMember instanceof DeserializedCallableMemberDescriptor) {
return isContainedByCompiledPartOfOurModule(((DeserializedCallableMemberDescriptor) directMember), outDirectory);
return ModuleVisibilityUtilsKt.isContainedByCompiledPartOfOurModule(directMember, outDirectory);
}
else {
return DescriptorUtils.areInSameModule(directMember, contextDescriptor);
}
}
private static boolean isContainedByCompiledPartOfOurModule(
@NotNull DeserializedCallableMemberDescriptor descriptor,
@Nullable File outDirectory
) {
DeclarationDescriptor packageFragment = descriptor.getContainingDeclaration();
if (packageFragment instanceof IncrementalPackageFragmentProvider.IncrementalPackageFragment) {
return true;
}
if (outDirectory == null) {
return false;
}
if (!(packageFragment instanceof LazyJavaPackageFragment)) {
return false;
}
SourceElement source = ((LazyJavaPackageFragment) packageFragment).getSource();
if (source instanceof KotlinJvmBinarySourceElement) {
KotlinJvmBinaryClass binaryClass = ((KotlinJvmBinarySourceElement) source).getBinaryClass();
if (binaryClass instanceof VirtualFileKotlinClass) {
VirtualFile file = ((VirtualFileKotlinClass) binaryClass).getFile();
if (file.getFileSystem().getProtocol() == StandardFileSystems.FILE_PROTOCOL) {
File ioFile = VfsUtilCore.virtualToIoFile(file);
return ioFile.getAbsolutePath().startsWith(outDirectory.getAbsolutePath() + File.separator);
}
}
}
return false;
}
public static boolean hasAbstractMembers(@NotNull ClassDescriptor classDescriptor) {
return KotlinPackage.any(classDescriptor.getDefaultType().getMemberScope().getAllDescriptors(),
return CollectionsKt.any(DescriptorUtils.getAllDescriptors(classDescriptor.getDefaultType().getMemberScope()),
new Function1<DeclarationDescriptor, Boolean>() {
@Override
public Boolean invoke(DeclarationDescriptor descriptor) {
@@ -180,8 +139,7 @@ public class JvmCodegenUtil {
if (JetTypeMapper.isAccessor(property)) return false;
// Inline functions can't use direct access because a field may not be visible at the call site
if (context.isInlineFunction() &&
(!Visibilities.isPrivate(property.getVisibility()) || DescriptorUtils.isTopLevelDeclaration(property))) {
if (context.isInlineFunction()) {
return false;
}
@@ -207,8 +165,8 @@ public class JvmCodegenUtil {
}
private static boolean isDebuggerContext(@NotNull MethodContext context) {
JetFile file = DescriptorToSourceUtils.getContainingFile(context.getContextDescriptor());
return file != null && CodeFragmentUtilPackage.getSuppressDiagnosticsInDebugMode(file);
KtFile file = DescriptorToSourceUtils.getContainingFile(context.getContextDescriptor());
return file != null && CodeFragmentUtilKt.getSuppressDiagnosticsInDebugMode(file);
}
@Nullable
@@ -245,19 +203,12 @@ public class JvmCodegenUtil {
public static boolean isArgumentWhichWillBeInlined(@NotNull BindingContext bindingContext, @NotNull DeclarationDescriptor descriptor) {
PsiElement declaration = DescriptorToSourceUtils.descriptorToDeclaration(descriptor);
return InlineUtil.canBeInlineArgument(declaration) &&
InlineUtil.isInlinedArgument((JetFunction) declaration, bindingContext, false);
}
public static boolean shouldUseJavaClassForClassLiteral(@NotNull ClassifierDescriptor descriptor) {
ModuleDescriptor module = DescriptorUtils.getContainingModule(descriptor);
return descriptor instanceof JavaClassDescriptor ||
module == module.getBuiltIns().getBuiltInsModule() ||
DescriptorUtils.isAnnotationClass(descriptor);
InlineUtil.isInlinedArgument((KtFunction) declaration, bindingContext, false);
}
@NotNull
public static String getModuleName(ModuleDescriptor module) {
return KotlinPackage.removeSurrounding(module.getName().asString(), "<", ">");
return StringsKt.removeSurrounding(module.getName().asString(), "<", ">");
}
@NotNull
@@ -269,6 +220,13 @@ public class JvmCodegenUtil {
av.visit(JvmAnnotationNames.VERSION_FIELD_NAME, JvmAbi.VERSION.toArray());
// TODO: drop after some time
av.visit(JvmAnnotationNames.OLD_ABI_VERSION_FIELD_NAME, JvmAbi.VERSION.getMinor());
av.visit(JvmAnnotationNames.OLD_ABI_VERSION_FIELD_NAME, 32);
}
public static void writeModuleName(@NotNull AnnotationVisitor av, @NotNull GenerationState state) {
String name = state.getModuleName();
if (!name.equals(JvmAbi.DEFAULT_MODULE_NAME)) {
av.visit(JvmAnnotationNames.MODULE_NAME_FIELD_NAME, name);
}
}
}

View File

@@ -23,15 +23,15 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
import org.jetbrains.kotlin.descriptors.impl.MutablePackageFragmentDescriptor;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM;
import org.jetbrains.kotlin.resolve.TargetPlatformKt;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
import java.util.*;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
public class JvmRuntimeTypes {
private final ClassDescriptor lambda;
private final ClassDescriptor functionReference;
@@ -39,10 +39,10 @@ public class JvmRuntimeTypes {
private final List<ClassDescriptor> mutablePropertyReferences;
public JvmRuntimeTypes() {
ModuleDescriptorImpl module = new ModuleDescriptorImpl(
ModuleDescriptorImpl module = TargetPlatformKt.createModule(
JvmPlatform.INSTANCE$,
Name.special("<jvm functions impl>"),
LockBasedStorageManager.NO_LOCKS,
TopDownAnalyzerFacadeForJVM.JVM_MODULE_PARAMETERS
LockBasedStorageManager.NO_LOCKS
);
PackageFragmentDescriptor kotlinJvmInternal = new MutablePackageFragmentDescriptor(module, new FqName("kotlin.jvm.internal"));
@@ -72,12 +72,12 @@ public class JvmRuntimeTypes {
}
@NotNull
public Collection<JetType> getSupertypesForClosure(@NotNull FunctionDescriptor descriptor) {
public Collection<KotlinType> getSupertypesForClosure(@NotNull FunctionDescriptor descriptor) {
ReceiverParameterDescriptor receiverParameter = descriptor.getExtensionReceiverParameter();
//noinspection ConstantConditions
JetType functionType = getBuiltIns(descriptor).getFunctionType(
Annotations.EMPTY,
KotlinType functionType = DescriptorUtilsKt.getBuiltIns(descriptor).getFunctionType(
Annotations.Companion.getEMPTY(),
receiverParameter == null ? null : receiverParameter.getType(),
ExpressionTypingUtils.getValueParametersTypes(descriptor.getValueParameters()),
descriptor.getReturnType()
@@ -87,16 +87,16 @@ public class JvmRuntimeTypes {
}
@NotNull
public Collection<JetType> getSupertypesForFunctionReference(@NotNull FunctionDescriptor descriptor) {
public Collection<KotlinType> getSupertypesForFunctionReference(@NotNull FunctionDescriptor descriptor) {
ReceiverParameterDescriptor extensionReceiver = descriptor.getExtensionReceiverParameter();
ReceiverParameterDescriptor dispatchReceiver = descriptor.getDispatchReceiverParameter();
JetType receiverType =
KotlinType receiverType =
extensionReceiver != null ? extensionReceiver.getType() : dispatchReceiver != null ? dispatchReceiver.getType() : null;
//noinspection ConstantConditions
JetType functionType = getBuiltIns(descriptor).getFunctionType(
Annotations.EMPTY,
KotlinType functionType = DescriptorUtilsKt.getBuiltIns(descriptor).getFunctionType(
Annotations.Companion.getEMPTY(),
receiverType,
ExpressionTypingUtils.getValueParametersTypes(descriptor.getValueParameters()),
descriptor.getReturnType()
@@ -106,7 +106,7 @@ public class JvmRuntimeTypes {
}
@NotNull
public JetType getSupertypeForPropertyReference(@NotNull PropertyDescriptor descriptor) {
public KotlinType getSupertypeForPropertyReference(@NotNull PropertyDescriptor descriptor) {
int arity = (descriptor.getExtensionReceiverParameter() != null ? 1 : 0) +
(descriptor.getDispatchReceiverParameter() != null ? 1 : 0);
return (descriptor.isVar() ? mutablePropertyReferences : propertyReferences).get(arity).getDefaultType();

View File

@@ -1,314 +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;
import com.intellij.openapi.util.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.kotlin.load.java.lazy.types.RawTypeCapabilities;
import org.jetbrains.kotlin.load.kotlin.SignatureDeserializer;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.serialization.AnnotationSerializer;
import org.jetbrains.kotlin.serialization.ProtoBuf;
import org.jetbrains.kotlin.serialization.SerializerExtension;
import org.jetbrains.kotlin.serialization.StringTable;
import org.jetbrains.kotlin.serialization.deserialization.NameResolver;
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor;
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor;
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.Method;
import java.util.Arrays;
import static org.jetbrains.kotlin.codegen.AsmUtil.shortNameByAsmType;
import static org.jetbrains.kotlin.codegen.JvmSerializationBindings.*;
public class JvmSerializerExtension extends SerializerExtension {
private final JvmSerializationBindings bindings;
private final JetTypeMapper typeMapper;
private final AnnotationSerializer annotationSerializer = new AnnotationSerializer();
public JvmSerializerExtension(@NotNull JvmSerializationBindings bindings, @NotNull JetTypeMapper typeMapper) {
this.bindings = bindings;
this.typeMapper = typeMapper;
}
@Override
public void serializeClass(@NotNull ClassDescriptor descriptor, @NotNull ProtoBuf.Class.Builder proto, @NotNull StringTable stringTable) {
AnnotationDescriptor annotation = descriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.annotation);
if (annotation != null) {
proto.addExtension(JvmProtoBuf.classAnnotation, annotationSerializer.serializeAnnotation(annotation, stringTable));
}
}
@Override
public void serializeCallable(
@NotNull CallableMemberDescriptor callable,
@NotNull ProtoBuf.Callable.Builder proto,
@NotNull StringTable stringTable
) {
saveSignature(callable, proto, stringTable);
saveImplClassName(callable, proto, stringTable);
}
@Override
public void serializeValueParameter(
@NotNull ValueParameterDescriptor descriptor,
@NotNull ProtoBuf.Callable.ValueParameter.Builder proto,
@NotNull StringTable stringTable
) {
Integer index = bindings.get(INDEX_FOR_VALUE_PARAMETER, descriptor);
if (index != null) {
proto.setExtension(JvmProtoBuf.index, index);
}
}
@Override
public void serializeType(@NotNull JetType type, @NotNull ProtoBuf.Type.Builder proto, @NotNull StringTable stringTable) {
// TODO: don't store type annotations in our binary metadata on Java 8, use *TypeAnnotations attributes instead
for (AnnotationDescriptor annotation : type.getAnnotations()) {
proto.addExtension(JvmProtoBuf.typeAnnotation, annotationSerializer.serializeAnnotation(annotation, stringTable));
}
if (type.getCapabilities() instanceof RawTypeCapabilities) {
proto.setExtension(JvmProtoBuf.isRaw, true);
}
}
@Override
@NotNull
public String getLocalClassName(@NotNull ClassDescriptor descriptor) {
return shortNameByAsmType(typeMapper.mapClass(descriptor));
}
private void saveSignature(
@NotNull CallableMemberDescriptor callable,
@NotNull ProtoBuf.Callable.Builder proto,
@NotNull StringTable stringTable
) {
SignatureSerializer signatureSerializer = new SignatureSerializer(stringTable);
if (callable instanceof FunctionDescriptor) {
JvmProtoBuf.JvmMethodSignature signature;
if (callable instanceof DeserializedSimpleFunctionDescriptor) {
DeserializedSimpleFunctionDescriptor deserialized = (DeserializedSimpleFunctionDescriptor) callable;
signature = signatureSerializer.copyMethodSignature(
deserialized.getProto().getExtension(JvmProtoBuf.methodSignature), deserialized.getNameResolver());
}
else {
Method method = bindings.get(METHOD_FOR_FUNCTION, (FunctionDescriptor) callable);
signature = method != null ? signatureSerializer.methodSignature(method) : null;
}
if (signature != null) {
proto.setExtension(JvmProtoBuf.methodSignature, signature);
}
}
else if (callable instanceof PropertyDescriptor) {
PropertyDescriptor property = (PropertyDescriptor) callable;
PropertyGetterDescriptor getter = property.getGetter();
PropertySetterDescriptor setter = property.getSetter();
Method getterMethod = getter == null ? null : bindings.get(METHOD_FOR_FUNCTION, getter);
Method setterMethod = setter == null ? null : bindings.get(METHOD_FOR_FUNCTION, setter);
Pair<Type, String> field = bindings.get(FIELD_FOR_PROPERTY, property);
Type fieldType;
String fieldName;
boolean isStaticInOuter;
Method syntheticMethod;
if (field != null) {
fieldType = field.first;
fieldName = field.second;
isStaticInOuter = bindings.get(STATIC_FIELD_IN_OUTER_CLASS, property);
syntheticMethod = bindings.get(SYNTHETIC_METHOD_FOR_PROPERTY, property);
}
else {
fieldType = null;
fieldName = null;
isStaticInOuter = false;
syntheticMethod = bindings.get(SYNTHETIC_METHOD_FOR_PROPERTY, property);
}
JvmProtoBuf.JvmPropertySignature signature;
if (callable instanceof DeserializedPropertyDescriptor) {
DeserializedPropertyDescriptor deserializedCallable = (DeserializedPropertyDescriptor) callable;
signature = signatureSerializer.copyPropertySignature(
deserializedCallable.getProto().getExtension(JvmProtoBuf.propertySignature),
deserializedCallable.getNameResolver()
);
}
else {
signature = signatureSerializer
.propertySignature(fieldType, fieldName, isStaticInOuter, syntheticMethod, getterMethod, setterMethod);
}
proto.setExtension(JvmProtoBuf.propertySignature, signature);
}
}
private void saveImplClassName(
@NotNull CallableMemberDescriptor callable,
@NotNull ProtoBuf.Callable.Builder proto,
@NotNull StringTable stringTable
) {
String name = bindings.get(IMPL_CLASS_NAME_FOR_CALLABLE, callable);
if (name != null) {
proto.setExtension(JvmProtoBuf.implClassName, stringTable.getSimpleNameIndex(Name.identifier(name)));
}
}
private static class SignatureSerializer {
private final StringTable stringTable;
public SignatureSerializer(@NotNull StringTable stringTable) {
this.stringTable = stringTable;
}
@NotNull
public JvmProtoBuf.JvmMethodSignature copyMethodSignature(
@NotNull JvmProtoBuf.JvmMethodSignature signature,
@NotNull NameResolver nameResolver
) {
String method = new SignatureDeserializer(nameResolver).methodSignatureString(signature);
return methodSignature(getAsmMethod(method));
}
@NotNull
public JvmProtoBuf.JvmMethodSignature methodSignature(@NotNull Method method) {
JvmProtoBuf.JvmMethodSignature.Builder signature = JvmProtoBuf.JvmMethodSignature.newBuilder();
signature.setName(stringTable.getStringIndex(method.getName()));
signature.setReturnType(type(method.getReturnType()));
for (Type type : method.getArgumentTypes()) {
signature.addParameterType(type(type));
}
return signature.build();
}
@NotNull
public JvmProtoBuf.JvmPropertySignature copyPropertySignature(
@NotNull JvmProtoBuf.JvmPropertySignature signature,
@NotNull NameResolver nameResolver
) {
Type fieldType;
String fieldName;
boolean isStaticInOuter;
SignatureDeserializer signatureDeserializer = new SignatureDeserializer(nameResolver);
if (signature.hasField()) {
JvmProtoBuf.JvmFieldSignature field = signature.getField();
fieldType = Type.getType(signatureDeserializer.typeDescriptor(field.getType()));
fieldName = nameResolver.getName(field.getName()).asString();
isStaticInOuter = field.getIsStaticInOuter();
}
else {
fieldType = null;
fieldName = null;
isStaticInOuter = false;
}
Method syntheticMethod = signature.hasSyntheticMethod()
? getAsmMethod(signatureDeserializer.methodSignatureString(signature.getSyntheticMethod()))
: null;
Method getter = signature.hasGetter() ? getAsmMethod(signatureDeserializer.methodSignatureString(signature.getGetter())) : null;
Method setter = signature.hasSetter() ? getAsmMethod(signatureDeserializer.methodSignatureString(signature.getSetter())) : null;
return propertySignature(fieldType, fieldName, isStaticInOuter, syntheticMethod, getter, setter);
}
@NotNull
public JvmProtoBuf.JvmPropertySignature propertySignature(
@Nullable Type fieldType,
@Nullable String fieldName,
boolean isStaticInOuter,
@Nullable Method syntheticMethod,
@Nullable Method getter,
@Nullable Method setter
) {
JvmProtoBuf.JvmPropertySignature.Builder signature = JvmProtoBuf.JvmPropertySignature.newBuilder();
if (fieldType != null) {
assert fieldName != null : "Field name shouldn't be null when there's a field type: " + fieldType;
signature.setField(fieldSignature(fieldType, fieldName, isStaticInOuter));
}
if (syntheticMethod != null) {
signature.setSyntheticMethod(methodSignature(syntheticMethod));
}
if (getter != null) {
signature.setGetter(methodSignature(getter));
}
if (setter != null) {
signature.setSetter(methodSignature(setter));
}
return signature.build();
}
@NotNull
public JvmProtoBuf.JvmFieldSignature fieldSignature(@NotNull Type type, @NotNull String name, boolean isStaticInOuter) {
JvmProtoBuf.JvmFieldSignature.Builder signature = JvmProtoBuf.JvmFieldSignature.newBuilder();
signature.setName(stringTable.getStringIndex(name));
signature.setType(type(type));
if (isStaticInOuter) {
signature.setIsStaticInOuter(true);
}
return signature.build();
}
@NotNull
public JvmProtoBuf.JvmType type(@NotNull Type givenType) {
JvmProtoBuf.JvmType.Builder builder = JvmProtoBuf.JvmType.newBuilder();
Type type = givenType;
if (type.getSort() == Type.ARRAY) {
builder.setArrayDimension(type.getDimensions());
type = type.getElementType();
}
if (type.getSort() == Type.OBJECT) {
FqName fqName = internalNameToFqName(type.getInternalName());
builder.setClassFqName(stringTable.getFqNameIndex(fqName));
}
else {
builder.setPrimitiveType(JvmProtoBuf.JvmType.PrimitiveType.valueOf(type.getSort()));
}
return builder.build();
}
@NotNull
private static FqName internalNameToFqName(@NotNull String internalName) {
return FqName.fromSegments(Arrays.asList(internalName.split("/")));
}
}
@NotNull
private static Method getAsmMethod(@NotNull String nameAndDesc) {
int indexOf = nameAndDesc.indexOf('(');
return new Method(nameAndDesc.substring(0, indexOf), nameAndDesc.substring(indexOf));
}
}

View File

@@ -0,0 +1,98 @@
/*
* 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
import org.jetbrains.kotlin.backend.common.CodegenUtil
import org.jetbrains.kotlin.codegen.context.MethodContext
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.diagnostics.Synthetic
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
class JvmStaticGenerator(
val descriptor: FunctionDescriptor,
val declarationOrigin: JvmDeclarationOrigin,
val state: GenerationState
) : Function2<ImplementationBodyCodegen, ClassBuilder, Unit> {
private val typeMapper = state.typeMapper
override fun invoke(codegen: ImplementationBodyCodegen, classBuilder: ClassBuilder) {
val staticFunctionDescriptor = createStaticFunctionDescriptor(descriptor)
val originElement = declarationOrigin.element
codegen.functionCodegen.generateMethod(
Synthetic(originElement, staticFunctionDescriptor),
staticFunctionDescriptor,
object : FunctionGenerationStrategy() {
override fun generateBody(
mv: MethodVisitor,
frameMap: FrameMap,
signature: JvmMethodSignature,
context: MethodContext,
parentCodegen: MemberCodegen<*>
) {
val iv = InstructionAdapter(mv)
val classDescriptor = descriptor.containingDeclaration as ClassDescriptor
val singletonValue = StackValue.singleton(classDescriptor, typeMapper)
singletonValue.put(singletonValue.type, iv)
var index = 0
val asmMethod = signature.asmMethod
for (paramType in asmMethod.argumentTypes) {
iv.load(index, paramType)
index += paramType.size
}
val syntheticOrOriginalMethod = typeMapper.mapToCallableMethod(
codegen.getContext().accessibleDescriptor(descriptor, /* superCallTarget = */ null),
false
)
syntheticOrOriginalMethod.genInvokeInstruction(iv)
iv.areturn(asmMethod.returnType)
}
}
)
if (originElement is KtNamedFunction) {
codegen.functionCodegen.generateOverloadsWithDefaultValues(originElement, staticFunctionDescriptor, descriptor)
}
}
companion object {
@JvmStatic
public fun createStaticFunctionDescriptor(descriptor: FunctionDescriptor): FunctionDescriptor {
val memberDescriptor = if (descriptor is PropertyAccessorDescriptor) descriptor.getCorrespondingProperty() else descriptor
val copies = CodegenUtil.copyFunctions(
memberDescriptor,
memberDescriptor,
descriptor.getContainingDeclaration().getContainingDeclaration(),
descriptor.getModality(),
descriptor.getVisibility(),
CallableMemberDescriptor.Kind.SYNTHESIZED,
false
)
val staticFunctionDescriptor = copies[descriptor]!!
return staticFunctionDescriptor
}
}
}

View File

@@ -21,11 +21,10 @@ import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.fileClasses.JvmFileClassInfo;
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils;
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.JetFile;
import org.jetbrains.kotlin.psi.JetScript;
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.psi.KtScript;
import org.jetbrains.kotlin.resolve.ScriptNameUtil;
import org.jetbrains.org.objectweb.asm.Type;
@@ -38,10 +37,9 @@ import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.registerClassN
public class KotlinCodegenFacade {
public static void prepareForCompilation(@NotNull GenerationState state) {
for (JetFile file : state.getFiles()) {
for (KtFile file : state.getFiles()) {
if (file.isScript()) {
// SCRIPT: register class name for scripting from this file, move outside of this function
JetScript script = file.getScript();
KtScript script = file.getScript();
assert script != null;
FqName name = ScriptNameUtil.classNameForScript(script);
@@ -63,44 +61,60 @@ public class KotlinCodegenFacade {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
MultiMap<FqName, JetFile> packageFqNameToFiles = new MultiMap<FqName, JetFile>();
MultiMap<FqName, JetFile> multifileClassFqNameToFiles = new MultiMap<FqName, JetFile>();
doGenerateFiles(state.getFiles(), state, errorHandler);
}
for (JetFile file : state.getFiles()) {
public static void doGenerateFiles(
@NotNull Collection<KtFile> files,
@NotNull GenerationState state,
@NotNull CompilationErrorHandler errorHandler
) {
MultiMap<FqName, KtFile> filesInPackages = new MultiMap<FqName, KtFile>();
MultiMap<FqName, KtFile> filesInMultifileClasses = new MultiMap<FqName, KtFile>();
for (KtFile file : files) {
if (file == null) throw new IllegalArgumentException("A null file given for compilation");
JvmFileClassInfo fileClassInfo = state.getFileClassesProvider().getFileClassInfo(file);
if (fileClassInfo.getIsMultifileClass()) {
multifileClassFqNameToFiles.putValue(fileClassInfo.getFacadeClassFqName(), file);
}
else if (state.getPackageFacadesAsMultifileClasses()) {
multifileClassFqNameToFiles.putValue(PackageClassUtils.getPackageClassFqName(file.getPackageFqName()), file);
if (fileClassInfo.getWithJvmMultifileClass()) {
filesInMultifileClasses.putValue(fileClassInfo.getFacadeClassFqName(), file);
}
else {
packageFqNameToFiles.putValue(file.getPackageFqName(), file);
filesInPackages.putValue(file.getPackageFqName(), file);
}
}
Set<FqName> obsoleteMultifileClasses = new HashSet<FqName>(state.getObsoleteMultifileClasses());
for (FqName multifileClassFqName : Sets.union(filesInMultifileClasses.keySet(), obsoleteMultifileClasses)) {
doCheckCancelled(state);
generateMultifileClass(state, multifileClassFqName, filesInMultifileClasses.get(multifileClassFqName), errorHandler);
}
Set<FqName> packagesWithObsoleteParts = new HashSet<FqName>(state.getPackagesWithObsoleteParts());
for (FqName packageFqName : Sets.union(packagesWithObsoleteParts, packageFqNameToFiles.keySet())) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
generatePackage(state, packageFqName, packageFqNameToFiles.get(packageFqName), errorHandler);
for (FqName packageFqName : Sets.union(packagesWithObsoleteParts, filesInPackages.keySet())) {
doCheckCancelled(state);
generatePackage(state, packageFqName, filesInPackages.get(packageFqName), errorHandler);
}
for (FqName multifileClassFqName : multifileClassFqNameToFiles.keySet()) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
generateMultifileClass(state, multifileClassFqName, multifileClassFqNameToFiles.get(multifileClassFqName), errorHandler);
}
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
doCheckCancelled(state);
state.getFactory().done();
}
private static void doCheckCancelled(GenerationState state) {
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
}
}
public static void generatePackage(
@NotNull GenerationState state,
@NotNull FqName packageFqName,
@NotNull Collection<JetFile> jetFiles,
@NotNull Collection<KtFile> jetFiles,
@NotNull CompilationErrorHandler errorHandler
) {
// We do not really generate package class, but use old package fqName to identify package in module-info.
//FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(packageFqName);
PackageCodegen codegen = state.getFactory().forPackage(packageFqName, jetFiles);
codegen.generate(errorHandler);
}
@@ -108,7 +122,7 @@ public class KotlinCodegenFacade {
private static void generateMultifileClass(
@NotNull GenerationState state,
@NotNull FqName multifileClassFqName,
@NotNull Collection<JetFile> files,
@NotNull Collection<KtFile> files,
@NotNull CompilationErrorHandler handler
) {
MultifileClassCodegen codegen = state.getFactory().forMultifileClass(multifileClassFqName, files);

View File

@@ -17,11 +17,13 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.psi.PsiElement;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
import org.jetbrains.kotlin.codegen.context.*;
import org.jetbrains.kotlin.codegen.inline.*;
import org.jetbrains.kotlin.codegen.state.GenerationState;
@@ -29,26 +31,29 @@ import org.jetbrains.kotlin.codegen.state.JetTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
import org.jetbrains.kotlin.fileClasses.FileClassesPackage;
import org.jetbrains.kotlin.fileClasses.FileClasses;
import org.jetbrains.kotlin.fileClasses.JvmFileClassesProvider;
import org.jetbrains.kotlin.load.java.JavaVisibilities;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.name.SpecialNames;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
import org.jetbrains.kotlin.resolve.source.SourcePackage;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.storage.NotNullLazyValue;
import org.jetbrains.kotlin.types.ErrorUtils;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
@@ -60,13 +65,14 @@ import static org.jetbrains.kotlin.codegen.AsmUtil.calculateInnerClassAccessFlag
import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive;
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED;
import static org.jetbrains.kotlin.resolve.BindingContext.VARIABLE;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isCompanionObject;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isStaticDeclaration;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.OtherOrigin;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.TraitImpl;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt.Synthetic;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclarationContainer*/> {
public abstract class MemberCodegen<T extends KtElement/* TODO: & JetDeclarationContainer*/> {
protected final GenerationState state;
protected final T element;
protected final FieldOwnerContext context;
@@ -117,7 +123,9 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
generateSyntheticParts();
generateKotlinAnnotation();
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
generateKotlinAnnotation();
}
done();
}
@@ -136,6 +144,26 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
return null;
}
public static void markLineNumberForSyntheticFunction(@Nullable ClassDescriptor declarationDescriptor, @NotNull InstructionAdapter v) {
if (declarationDescriptor == null) {
return;
}
PsiElement classElement = DescriptorToSourceUtils.getSourceFromDescriptor(declarationDescriptor);
if (classElement != null) {
markLineNumberForSyntheticFunction(classElement, v);
}
}
public static void markLineNumberForSyntheticFunction(@NotNull PsiElement element, @NotNull InstructionAdapter v) {
Integer lineNumber = CodegenUtil.getLineNumberForElement(element, false);
if (lineNumber != null) {
Label label = new Label();
v.visitLabel(label);
v.visitLineNumber(lineNumber, label);
}
}
protected void done() {
if (clInit != null) {
clInit.v.visitInsn(RETURN);
@@ -151,10 +179,10 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
v.done();
}
public void genFunctionOrProperty(@NotNull JetDeclaration functionOrProperty) {
if (functionOrProperty instanceof JetNamedFunction) {
public void genFunctionOrProperty(@NotNull KtDeclaration functionOrProperty) {
if (functionOrProperty instanceof KtNamedFunction) {
try {
functionCodegen.gen((JetNamedFunction) functionOrProperty);
functionCodegen.gen((KtNamedFunction) functionOrProperty);
}
catch (ProcessCanceledException e) {
throw e;
@@ -166,9 +194,9 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
throw new CompilationException("Failed to generate function " + functionOrProperty.getName(), e, functionOrProperty);
}
}
else if (functionOrProperty instanceof JetProperty) {
else if (functionOrProperty instanceof KtProperty) {
try {
propertyCodegen.gen((JetProperty) functionOrProperty);
propertyCodegen.gen((KtProperty) functionOrProperty);
}
catch (ProcessCanceledException e) {
throw e;
@@ -187,7 +215,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
public static void genClassOrObject(
@NotNull CodegenContext parentContext,
@NotNull JetClassOrObject aClass,
@NotNull KtClassOrObject aClass,
@NotNull GenerationState state,
@Nullable MemberCodegen<?> parentCodegen
) {
@@ -203,16 +231,9 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
}
Type classType = state.getTypeMapper().mapClass(descriptor);
ClassBuilder classBuilder = state.getFactory().newVisitor(OtherOrigin(aClass, descriptor), classType, aClass.getContainingFile());
ClassBuilder classBuilder = state.getFactory().newVisitor(JvmDeclarationOriginKt.OtherOrigin(aClass, descriptor), classType, aClass.getContainingFile());
ClassContext classContext = parentContext.intoClass(descriptor, OwnerKind.IMPLEMENTATION, state);
new ImplementationBodyCodegen(aClass, classContext, classBuilder, state, parentCodegen).generate();
if (aClass instanceof JetClass && ((JetClass) aClass).isInterface()) {
Type traitImplType = state.getTypeMapper().mapTraitImpl(descriptor);
ClassBuilder traitImplBuilder = state.getFactory().newVisitor(TraitImpl(aClass, descriptor), traitImplType, aClass.getContainingFile());
ClassContext traitImplContext = parentContext.intoClass(descriptor, OwnerKind.TRAIT_IMPL, state);
new TraitImplBodyCodegen(aClass, traitImplContext, traitImplBuilder, state, parentCodegen).generate();
}
new ImplementationBodyCodegen(aClass, classContext, classBuilder, state, parentCodegen, false).generate();
}
private static void badDescriptor(ClassDescriptor descriptor, ClassBuilderMode mode) {
@@ -221,7 +242,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
}
}
public void genClassOrObject(JetClassOrObject aClass) {
public void genClassOrObject(KtClassOrObject aClass) {
genClassOrObject(context, aClass, state, this);
}
@@ -296,7 +317,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
return implementationOwnerType;
}
else {
return FileClassesPackage.getFileClassType(fileClassesProvider, element.getContainingJetFile());
return FileClasses.getFileClassType(fileClassesProvider, element.getContainingKtFile());
}
}
/*disabled cause of KT-7775
@@ -330,13 +351,13 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
protected ExpressionCodegen createOrGetClInitCodegen() {
DeclarationDescriptor descriptor = context.getContextDescriptor();
if (clInit == null) {
MethodVisitor mv = v.newMethod(OtherOrigin(descriptor), ACC_STATIC, "<clinit>", "()V", null, null);
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(descriptor), ACC_STATIC, "<clinit>", "()V", null, null);
SimpleFunctionDescriptorImpl clInit =
SimpleFunctionDescriptorImpl.create(descriptor, Annotations.EMPTY, Name.special("<clinit>"), SYNTHESIZED,
SourcePackage.toSourceElement(element));
SimpleFunctionDescriptorImpl.create(descriptor, Annotations.Companion.getEMPTY(), Name.special("<clinit>"), SYNTHESIZED,
KotlinSourceElementKt.toSourceElement(element));
clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(),
Collections.<ValueParameterDescriptor>emptyList(),
DescriptorUtilPackage.getModule(descriptor).getBuiltIns().getUnitType(),
DescriptorUtilsKt.getModule(descriptor).getBuiltIns().getUnitType(),
null, Visibilities.PRIVATE);
this.clInit = new ExpressionCodegen(mv, new FrameMap(), Type.VOID_TYPE, context.intoFunction(clInit), state, this);
@@ -346,14 +367,14 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
protected void generateInitializers(@NotNull Function0<ExpressionCodegen> createCodegen) {
NotNullLazyValue<ExpressionCodegen> codegen = LockBasedStorageManager.NO_LOCKS.createLazyValue(createCodegen);
for (JetDeclaration declaration : ((JetDeclarationContainer) element).getDeclarations()) {
if (declaration instanceof JetProperty) {
if (shouldInitializeProperty((JetProperty) declaration)) {
initializeProperty(codegen.invoke(), (JetProperty) declaration);
for (KtDeclaration declaration : ((KtDeclarationContainer) element).getDeclarations()) {
if (declaration instanceof KtProperty) {
if (shouldInitializeProperty((KtProperty) declaration)) {
initializeProperty(codegen.invoke(), (KtProperty) declaration);
}
}
else if (declaration instanceof JetClassInitializer) {
JetExpression body = ((JetClassInitializer) declaration).getBody();
else if (declaration instanceof KtClassInitializer) {
KtExpression body = ((KtClassInitializer) declaration).getBody();
if (body != null) {
codegen.invoke().gen(body, Type.VOID_TYPE);
}
@@ -361,35 +382,30 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
}
}
private void initializeProperty(@NotNull ExpressionCodegen codegen, @NotNull JetProperty property) {
private void initializeProperty(@NotNull ExpressionCodegen codegen, @NotNull KtProperty property) {
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) bindingContext.get(VARIABLE, property);
assert propertyDescriptor != null;
JetExpression initializer = property.getDelegateExpressionOrInitializer();
KtExpression initializer = property.getDelegateExpressionOrInitializer();
assert initializer != null : "shouldInitializeProperty must return false if initializer is null";
StackValue.Property propValue = codegen.intermediateValueForProperty(propertyDescriptor, true, null, true, StackValue.LOCAL_0);
StackValue.Property propValue = codegen.intermediateValueForProperty(propertyDescriptor, true, false, null, true, StackValue.LOCAL_0);
propValue.store(codegen.gen(initializer), codegen.v);
ResolvedCall<FunctionDescriptor> pdResolvedCall =
bindingContext.get(BindingContext.DELEGATED_PROPERTY_PD_RESOLVED_CALL, propertyDescriptor);
if (pdResolvedCall != null) {
int index = PropertyCodegen.indexOfDelegatedProperty(property);
StackValue lastValue = PropertyCodegen.invokeDelegatedPropertyConventionMethod(
propertyDescriptor, codegen, typeMapper, pdResolvedCall, index, 0
);
lastValue.put(Type.VOID_TYPE, codegen.v);
}
}
private boolean shouldInitializeProperty(@NotNull JetProperty property) {
private boolean shouldInitializeProperty(@NotNull KtProperty property) {
if (!property.hasDelegateExpressionOrInitializer()) return false;
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) bindingContext.get(VARIABLE, property);
assert propertyDescriptor != null;
JetExpression initializer = property.getInitializer();
if (propertyDescriptor.isConst()) {
//const initializer always inlined
return false;
}
KtExpression initializer = property.getInitializer();
ConstantValue<?> initializerValue = computeInitializerValue(property, propertyDescriptor, initializer);
// we must write constant values for fields in light classes,
@@ -397,16 +413,16 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
if (initializerValue == null) return state.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES;
//TODO: OPTIMIZATION: don't initialize static final fields
JetType jetType = getPropertyOrDelegateType(property, propertyDescriptor);
KotlinType jetType = getPropertyOrDelegateType(property, propertyDescriptor);
Type type = typeMapper.mapType(jetType);
return !skipDefaultValue(propertyDescriptor, initializerValue.getValue(), type);
}
@Nullable
private ConstantValue<?> computeInitializerValue(
@NotNull JetProperty property,
@NotNull KtProperty property,
@NotNull PropertyDescriptor propertyDescriptor,
@Nullable JetExpression initializer
@Nullable KtExpression initializer
) {
if (property.isVar() && initializer != null) {
BindingTrace tempTrace = TemporaryBindingTrace.create(state.getBindingTrace(), "property initializer");
@@ -416,10 +432,10 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
}
@NotNull
private JetType getPropertyOrDelegateType(@NotNull JetProperty property, @NotNull PropertyDescriptor descriptor) {
JetExpression delegateExpression = property.getDelegateExpression();
private KotlinType getPropertyOrDelegateType(@NotNull KtProperty property, @NotNull PropertyDescriptor descriptor) {
KtExpression delegateExpression = property.getDelegateExpression();
if (delegateExpression != null) {
JetType delegateType = bindingContext.getType(delegateExpression);
KotlinType delegateType = bindingContext.getType(delegateExpression);
assert delegateType != null : "Type of delegate expression should be recorded";
return delegateType;
}
@@ -463,41 +479,11 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
return false;
}
public static void generateReflectionObjectField(
@NotNull GenerationState state,
@NotNull Type thisAsmType,
@NotNull ClassBuilder classBuilder,
@NotNull Method factory,
@NotNull String fieldName,
@NotNull InstructionAdapter v
) {
String type = factory.getReturnType().getDescriptor();
// TODO: generic signature
classBuilder.newField(NO_ORIGIN, ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, fieldName, type, null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) return;
v.aconst(thisAsmType);
if (factory.getArgumentTypes().length == 2) {
v.aconst(state.getModuleName());
}
v.invokestatic(REFLECTION, factory.getName(), factory.getDescriptor(), false);
v.putstatic(thisAsmType.getInternalName(), fieldName, type);
}
public static void generateModuleNameField(
@NotNull GenerationState state,
@NotNull ClassBuilder classBuilder
) {
classBuilder.newField(NO_ORIGIN, ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.MODULE_NAME_FIELD,
AsmTypes.JAVA_STRING_TYPE.getDescriptor(), null, state.getModuleName());
}
protected void generatePropertyMetadataArrayFieldIfNeeded(@NotNull Type thisAsmType) {
List<JetProperty> delegatedProperties = new ArrayList<JetProperty>();
for (JetDeclaration declaration : ((JetDeclarationContainer) element).getDeclarations()) {
if (declaration instanceof JetProperty) {
JetProperty property = (JetProperty) declaration;
List<KtProperty> delegatedProperties = new ArrayList<KtProperty>();
for (KtDeclaration declaration : ((KtDeclarationContainer) element).getDeclarations()) {
if (declaration instanceof KtProperty) {
KtProperty property = (KtProperty) declaration;
if (property.hasDelegate()) {
delegatedProperties.add(property);
}
@@ -505,7 +491,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
}
if (delegatedProperties.isEmpty()) return;
v.newField(NO_ORIGIN, ACC_PRIVATE | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.PROPERTY_METADATA_ARRAY_NAME,
v.newField(NO_ORIGIN, ACC_PRIVATE | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
"[" + PROPERTY_METADATA_TYPE, null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) return;
@@ -515,18 +501,48 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
iv.newarray(PROPERTY_METADATA_TYPE);
for (int i = 0, size = delegatedProperties.size(); i < size; i++) {
VariableDescriptor property = BindingContextUtils.getNotNull(bindingContext, VARIABLE, delegatedProperties.get(i));
PropertyDescriptor property =
(PropertyDescriptor) BindingContextUtils.getNotNull(bindingContext, VARIABLE, delegatedProperties.get(i));
iv.dup();
iv.iconst(i);
iv.anew(PROPERTY_METADATA_IMPL_TYPE);
iv.dup();
iv.visitLdcInsn(property.getName().asString());
iv.invokespecial(PROPERTY_METADATA_IMPL_TYPE.getInternalName(), "<init>", "(Ljava/lang/String;)V", false);
iv.astore(PROPERTY_METADATA_IMPL_TYPE);
StackValue value;
// TODO: remove this option and always generate PropertyReferenceNImpl creation
if ("true".equalsIgnoreCase(System.getProperty("kotlin.jvm.optimize.delegated.properties"))) {
int receiverCount = (property.getDispatchReceiverParameter() != null ? 1 : 0) +
(property.getExtensionReceiverParameter() != null ? 1 : 0);
Type implType = property.isVar() ? MUTABLE_PROPERTY_REFERENCE_IMPL[receiverCount] : PROPERTY_REFERENCE_IMPL[receiverCount];
iv.anew(implType);
iv.dup();
// TODO: generate the container once and save to a local field instead
ClosureCodegen.generateCallableReferenceDeclarationContainer(iv, property, state);
iv.aconst(property.getName().asString());
iv.aconst(PropertyReferenceCodegen.getPropertyReferenceSignature(property, state));
iv.invokespecial(
implType.getInternalName(), "<init>",
Type.getMethodDescriptor(Type.VOID_TYPE, K_DECLARATION_CONTAINER_TYPE, JAVA_STRING_TYPE, JAVA_STRING_TYPE), false
);
value = StackValue.onStack(implType);
Method wrapper = PropertyReferenceCodegen.getWrapperMethodForPropertyReference(property, receiverCount);
iv.invokestatic(REFLECTION, wrapper.getName(), wrapper.getDescriptor(), false);
}
else {
ReceiverParameterDescriptor dispatchReceiver = property.getDispatchReceiverParameter();
//noinspection ConstantConditions
value = createOrGetClInitCodegen().generatePropertyReference(
delegatedProperties.get(i).getDelegate(), property, property,
dispatchReceiver != null ? new TransientReceiver(dispatchReceiver.getType()) : ReceiverValue.NO_RECEIVER
);
}
value.put(PROPERTY_METADATA_TYPE, iv);
iv.astore(PROPERTY_METADATA_TYPE);
}
iv.putstatic(thisAsmType.getInternalName(), JvmAbi.PROPERTY_METADATA_ARRAY_NAME, "[" + PROPERTY_METADATA_TYPE);
iv.putstatic(thisAsmType.getInternalName(), JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME, "[" + PROPERTY_METADATA_TYPE);
}
public String getClassName() {
@@ -565,7 +581,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
@NotNull Type fieldAsmType,
@NotNull Function1<InstructionAdapter, Unit> initialization
) {
v.newField(OtherOrigin(element), ACC_STATIC | ACC_FINAL | ACC_PUBLIC, JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor(),
v.newField(JvmDeclarationOriginKt.OtherOrigin(element), ACC_STATIC | ACC_FINAL | ACC_PUBLIC, JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor(),
null, null);
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
@@ -577,4 +593,128 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
iv.putstatic(thisAsmType.getInternalName(), JvmAbi.INSTANCE_FIELD, fieldAsmType.getDescriptor());
}
}
protected void generateSyntheticAccessors() {
for (AccessorForCallableDescriptor<?> accessor : ((CodegenContext<?>) context).getAccessors()) {
generateSyntheticAccessor(accessor);
}
}
private void generateSyntheticAccessor(@NotNull AccessorForCallableDescriptor<?> accessorForCallableDescriptor) {
if (accessorForCallableDescriptor instanceof FunctionDescriptor) {
final FunctionDescriptor accessor = (FunctionDescriptor) accessorForCallableDescriptor;
final FunctionDescriptor original = (FunctionDescriptor) accessorForCallableDescriptor.getCalleeDescriptor();
functionCodegen.generateMethod(
Synthetic(null, original), accessor,
new FunctionGenerationStrategy.CodegenBased<FunctionDescriptor>(state, accessor) {
@Override
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
markLineNumberForSyntheticFunction(element, codegen.v);
generateMethodCallTo(original, accessor, codegen.v);
codegen.v.areturn(signature.getReturnType());
}
}
);
}
else if (accessorForCallableDescriptor instanceof AccessorForPropertyDescriptor) {
final AccessorForPropertyDescriptor accessor = (AccessorForPropertyDescriptor) accessorForCallableDescriptor;
final PropertyDescriptor original = accessor.getCalleeDescriptor();
class PropertyAccessorStrategy extends FunctionGenerationStrategy.CodegenBased<PropertyAccessorDescriptor> {
public PropertyAccessorStrategy(@NotNull PropertyAccessorDescriptor callableDescriptor) {
super(MemberCodegen.this.state, callableDescriptor);
}
@Override
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
boolean syntheticBackingField = accessor instanceof AccessorForPropertyBackingFieldFromLocal;
boolean forceField = (AsmUtil.isPropertyWithBackingFieldInOuterClass(original) &&
!isCompanionObject(accessor.getContainingDeclaration())) ||
syntheticBackingField ||
original.getVisibility() == JavaVisibilities.PROTECTED_STATIC_VISIBILITY;
StackValue property = codegen.intermediateValueForProperty(
original, forceField, syntheticBackingField, accessor.getSuperCallTarget(), true, StackValue.none()
);
InstructionAdapter iv = codegen.v;
markLineNumberForSyntheticFunction(element, iv);
Type[] argTypes = signature.getAsmMethod().getArgumentTypes();
for (int i = 0, reg = 0; i < argTypes.length; i++) {
Type argType = argTypes[i];
iv.load(reg, argType);
//noinspection AssignmentToForLoopParameter
reg += argType.getSize();
}
if (callableDescriptor instanceof PropertyGetterDescriptor) {
property.put(property.type, iv);
}
else {
property.store(StackValue.onStack(property.type), iv, true);
}
iv.areturn(signature.getReturnType());
}
}
if (accessor.isWithSyntheticGetterAccessor()) {
PropertyGetterDescriptor getter = accessor.getGetter();
assert getter != null;
functionCodegen.generateMethod(Synthetic(null, original.getGetter() != null ? original.getGetter() : original),
getter, new PropertyAccessorStrategy(getter));
}
if (accessor.isVar() && accessor.isWithSyntheticSetterAccessor()) {
PropertySetterDescriptor setter = accessor.getSetter();
assert setter != null;
functionCodegen.generateMethod(Synthetic(null, original.getSetter() != null ? original.getSetter() : original),
setter, new PropertyAccessorStrategy(setter));
}
}
else {
throw new UnsupportedOperationException();
}
}
private void generateMethodCallTo(
@NotNull FunctionDescriptor functionDescriptor,
@Nullable FunctionDescriptor accessorDescriptor,
@NotNull InstructionAdapter iv
) {
CallableMethod callableMethod = typeMapper.mapToCallableMethod(
functionDescriptor,
accessorDescriptor instanceof AccessorForCallableDescriptor &&
((AccessorForCallableDescriptor) accessorDescriptor).getSuperCallTarget() != null
);
boolean hasDispatchReceiver = !isStaticDeclaration(functionDescriptor);
int reg = hasDispatchReceiver ? 1 : 0;
boolean accessorIsConstructor = accessorDescriptor instanceof AccessorForConstructorDescriptor;
if (!accessorIsConstructor && functionDescriptor instanceof ConstructorDescriptor) {
iv.anew(callableMethod.getOwner());
iv.dup();
reg = 0;
}
else if (accessorIsConstructor || (accessorDescriptor != null && JetTypeMapper.isAccessor(accessorDescriptor) && hasDispatchReceiver)) {
if (!AnnotationUtilKt.isPlatformStaticInObjectOrClass(functionDescriptor)) {
iv.load(0, OBJECT_TYPE);
}
}
for (Type argType : callableMethod.getParameterTypes()) {
if (AsmTypes.DEFAULT_CONSTRUCTOR_MARKER.equals(argType)) {
iv.aconst(null);
}
else {
iv.load(reg, argType);
reg += argType.getSize();
}
}
callableMethod.genInvokeInstruction(iv);
}
}

View File

@@ -21,13 +21,14 @@ import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.util.ArrayUtil
import com.intellij.util.SmartList
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext
import org.jetbrains.kotlin.codegen.context.MethodContext
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
import org.jetbrains.kotlin.fileClasses.getFileClassType
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.load.kotlin.PackageParts
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider
@@ -36,33 +37,43 @@ import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStat
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import java.util.*
public class MultifileClassCodegen(
private val state: GenerationState,
public val files: Collection<JetFile>,
public val files: Collection<KtFile>,
private val facadeFqName: FqName
) {
private val facadeClassType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(facadeFqName)
private val packageFragment = getOnlyPackageFragment(facadeFqName.parent(), files, state.bindingContext)
private val compiledPackageFragment = getCompiledPackageFragment(facadeFqName.parent(), state)
private val compiledPackageFragment = getCompiledPackageFragment(facadeFqName, state)
private val previouslyCompiledCallables =
if (compiledPackageFragment == null)
emptyList<DeserializedCallableMemberDescriptor>()
else
getDeserializedCallables(compiledPackageFragment)
private fun getDeserializedCallables(compiledPackageFragment: PackageFragmentDescriptor) =
compiledPackageFragment.getMemberScope().getContributedDescriptors(DescriptorKindFilter.CALLABLES, MemberScope.ALL_NAME_FILTER).filterIsInstance<DeserializedCallableMemberDescriptor>()
public val packageParts = PackageParts(facadeFqName.parent().asString())
// TODO incremental compilation support
// TODO previouslyCompiledCallables
// We can do this (probably without 'compiledPackageFragment') after modifications to part codegen.
private val classBuilder = ClassBuilderOnDemand {
val originFile = files.firstOrNull()
val actualPackageFragment = packageFragment ?:
@@ -71,8 +82,10 @@ public class MultifileClassCodegen(
val declarationOrigin = MultifileClass(originFile, actualPackageFragment, facadeFqName)
val classBuilder = state.factory.newVisitor(declarationOrigin, facadeClassType, files)
val filesWithCallables = files.filter { it.declarations.any { it is JetNamedFunction || it is JetProperty } }
val singleSourceFile = filesWithCallables.singleOrNull()
val filesWithCallables = files.filter { it.declarations.any { it is KtNamedFunction || it is KtProperty } }
val singleSourceFile = if (previouslyCompiledCallables.isNotEmpty()) null else filesWithCallables.singleOrNull()
classBuilder.defineClass(singleSourceFile, Opcodes.V1_6, FACADE_CLASS_ATTRIBUTES,
facadeClassType.internalName,
null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY)
@@ -86,6 +99,20 @@ public class MultifileClassCodegen(
val generateCallableMemberTasks = HashMap<CallableMemberDescriptor, () -> Unit>()
val partFqNames = arrayListOf<FqName>()
generateCodeForSourceFiles(errorHandler, generateCallableMemberTasks, partFqNames)
generateDelegatesToPreviouslyCompiledParts(generateCallableMemberTasks, partFqNames)
if (!generateCallableMemberTasks.isEmpty()) {
generateMultifileFacadeClass(generateCallableMemberTasks, partFqNames)
}
}
private fun generateCodeForSourceFiles(
errorHandler: CompilationErrorHandler,
generateCallableMemberTasks: MutableMap<CallableMemberDescriptor, () -> Unit>,
partFqNames: MutableList<FqName>
) {
for (file in files) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
try {
@@ -104,37 +131,25 @@ public class MultifileClassCodegen(
}
}
}
// generateDelegationsToPreviouslyCompiled(generateCallableMemberTasks)
if (!generateCallableMemberTasks.isEmpty()) {
generateMultifileFacadeClass(generateCallableMemberTasks, partFqNames)
}
}
private fun generateMultifileFacadeClass(
tasks: Map<CallableMemberDescriptor, () -> Unit>,
partFqNames: List<FqName>
) {
generateKotlinPackageReflectionField()
MemberCodegen.generateModuleNameField(state, classBuilder)
for (member in tasks.keySet().sortedWith(MemberComparator.INSTANCE)) {
for (member in tasks.keys.sortedWith(MemberComparator.INSTANCE)) {
tasks[member]!!()
}
writeKotlinMultifileFacadeAnnotationIfNeeded(partFqNames)
}
public fun generateClassOrObject(classOrObject: JetClassOrObject) {
val file = classOrObject.getContainingJetFile()
val partType = state.fileClassesProvider.getFileClassType(file)
val context = state.rootContext.intoMultifileClassPart(packageFragment!!, facadeClassType, partType)
MemberCodegen.genClassOrObject(context, classOrObject, state, null)
public fun generateClassOrObject(classOrObject: KtClassOrObject, packagePartContext: FieldOwnerContext<PackageFragmentDescriptor>) {
MemberCodegen.genClassOrObject(packagePartContext, classOrObject, state, null)
}
private fun generatePart(
file: JetFile,
file: KtFile,
generateCallableMemberTasks: MutableMap<CallableMemberDescriptor, () -> Unit>,
partFqNames: MutableList<FqName>
) {
@@ -144,20 +159,17 @@ public class MultifileClassCodegen(
var generatePart = false
val partClassInfo = state.fileClassesProvider.getFileClassInfo(file)
val partType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(partClassInfo.fileClassFqName)
val partContext = state.rootContext.intoMultifileClassPart(packageFragment, facadeClassType, partType)
val partContext = state.rootContext.intoMultifileClassPart(packageFragment, facadeClassType, partType, file)
for (declaration in file.declarations) {
if (declaration is JetProperty || declaration is JetNamedFunction) {
generatePart = true
}
else if (declaration is JetClassOrObject) {
if (state.generateDeclaredClassFilter.shouldGenerateClass(declaration)) {
generateClassOrObject(declaration)
when (declaration) {
is KtProperty, is KtNamedFunction -> {
generatePart = true
}
}
else if (declaration is JetScript) {
// SCRIPT: generate script code, should be separate execution branch
if (state.generateDeclaredClassFilter.shouldGenerateScript(declaration)) {
is KtClassOrObject -> if (state.generateDeclaredClassFilter.shouldGenerateClass(declaration)) {
generateClassOrObject(declaration, partContext)
}
is KtScript -> if (state.generateDeclaredClassFilter.shouldGenerateScript(declaration)) {
ScriptCodegen.createScriptCodegen(declaration, state, partContext).generate()
}
}
@@ -173,28 +185,68 @@ public class MultifileClassCodegen(
val builder = state.factory.newVisitor(MultifileClassPart(file, packageFragment, facadeFqName), partType, file)
MultifileClassPartCodegen(builder, file, partType, facadeFqName, partContext, state).generate()
MultifileClassPartCodegen(builder, file, partType, facadeClassType, partContext, state).generate()
val facadeContext = state.rootContext.intoMultifileClass(packageFragment, facadeClassType, partType)
val memberCodegen = createCodegenForPartOfMultifileFacade(facadeContext)
for (declaration in file.declarations) {
if (declaration is JetNamedFunction || declaration is JetProperty) {
if (declaration is KtNamedFunction || declaration is KtProperty) {
val descriptor = state.bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration)
assert(descriptor is CallableMemberDescriptor) { "Expected callable member, was " + descriptor + " for " + declaration.text }
generateCallableMemberTasks.put(descriptor as CallableMemberDescriptor,
{ memberCodegen.genFunctionOrProperty(declaration) })
if (!Visibilities.isPrivate((descriptor as CallableMemberDescriptor).visibility)) {
generateCallableMemberTasks.put(descriptor, { memberCodegen.genFunctionOrProperty(declaration) })
}
}
}
}
private fun generateKotlinPackageReflectionField() {
val mv = classBuilder.newMethod(JvmDeclarationOrigin.NO_ORIGIN, Opcodes.ACC_STATIC, "<clinit>", "()V", null, null)
val method = AsmUtil.method("createKotlinPackage",
AsmTypes.K_PACKAGE_TYPE, AsmTypes.getType(Class::class.java), AsmTypes.getType(String::class.java))
val iv = InstructionAdapter(mv)
MemberCodegen.generateReflectionObjectField(state, facadeClassType, classBuilder, method, JvmAbi.KOTLIN_PACKAGE_FIELD_NAME, iv)
iv.areturn(Type.VOID_TYPE)
FunctionCodegen.endVisit(mv, "package facade static initializer", null)
private fun generateDelegatesToPreviouslyCompiledParts(
generateCallableMemberTasks: MutableMap<CallableMemberDescriptor, () -> Unit>,
partFqNames: MutableList<FqName>
) {
if (compiledPackageFragment == null) return
partFqNames.addAll(compiledPackageFragment.partsNames.map { JvmClassName.byInternalName(it).fqNameForClassNameWithoutDollars })
for (callable in previouslyCompiledCallables) {
val partFqName = JvmFileClassUtil.getPartFqNameForDeserializedCallable(callable)
val partType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(partFqName)
generateCallableMemberTasks[callable] = { generateDelegateToCompiledMember(callable, compiledPackageFragment, partType) }
}
}
private fun generateDelegateToCompiledMember(
member: CallableMemberDescriptor,
compiledPackageFragment: PackageFragmentDescriptor,
partType: Type
) {
val context = state.rootContext.intoMultifileClass(compiledPackageFragment, facadeClassType, partType)
val memberCodegen = createCodegenForPartOfMultifileFacade(context)
when (member) {
is DeserializedSimpleFunctionDescriptor -> {
memberCodegen.functionCodegen.generateMethod(OtherOrigin(member), member, DelegateToCompiledMemberGenerationStrategy)
memberCodegen.functionCodegen.generateDefaultIfNeeded(
context.intoFunction(member), member, OwnerKind.PACKAGE, DefaultParameterValueLoader.DEFAULT, null)
memberCodegen.functionCodegen.generateOverloadsWithDefaultValues(null, member, member)
}
is DeserializedPropertyDescriptor -> {
memberCodegen.propertyCodegen.generateInPackageFacade(member)
}
else -> {
throw IllegalStateException("Unexpected member: " + member)
}
}
}
object DelegateToCompiledMemberGenerationStrategy : FunctionGenerationStrategy() {
override fun generateBody(mv: MethodVisitor, frameMap: FrameMap, signature: JvmMethodSignature, context: MethodContext, parentCodegen: MemberCodegen<*>) {
throw IllegalStateException("shouldn't be called")
}
}
private fun writeKotlinMultifileFacadeAnnotationIfNeeded(partFqNames: List<FqName>) {
@@ -203,19 +255,20 @@ public class MultifileClassCodegen(
val av = classBuilder.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_MULTIFILE_CLASS), true)
JvmCodegenUtil.writeAbiVersion(av)
JvmCodegenUtil.writeModuleName(av, state)
val shortNames = partFqNames.map { it.shortName().asString() }.sorted()
val filePartClassNamesArray = av.visitArray(JvmAnnotationNames.FILE_PART_CLASS_NAMES_FIELD_NAME)
for (shortName in shortNames) {
filePartClassNamesArray.visit(null, shortName)
val partInternalNames = partFqNames.map { JvmClassName.byFqNameWithoutInnerClasses(it).internalName }.sorted()
val arv = av.visitArray(JvmAnnotationNames.FILE_PART_CLASS_NAMES_FIELD_NAME)
for (internalName in partInternalNames) {
arv.visit(null, internalName)
}
filePartClassNamesArray.visitEnd()
arv.visitEnd()
av.visitEnd()
}
private fun createCodegenForPartOfMultifileFacade(facadeContext: FieldOwnerContext<*>): MemberCodegen<JetFile> =
object : MemberCodegen<JetFile>(state, null, facadeContext, null, classBuilder) {
private fun createCodegenForPartOfMultifileFacade(facadeContext: FieldOwnerContext<*>): MemberCodegen<KtFile> =
object : MemberCodegen<KtFile>(state, null, facadeContext, null, classBuilder) {
override fun generateDeclaration() = throw UnsupportedOperationException()
override fun generateBody() = throw UnsupportedOperationException()
override fun generateKotlinAnnotation() = throw UnsupportedOperationException()
@@ -228,7 +281,7 @@ public class MultifileClassCodegen(
companion object {
private val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL
private fun getOnlyPackageFragment(packageFqName: FqName, files: Collection<JetFile>, bindingContext: BindingContext): PackageFragmentDescriptor? {
private fun getOnlyPackageFragment(packageFqName: FqName, files: Collection<KtFile>, bindingContext: BindingContext): PackageFragmentDescriptor? {
val fragments = SmartList<PackageFragmentDescriptor>()
for (file in files) {
val fragment = bindingContext.get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file)
@@ -246,12 +299,19 @@ public class MultifileClassCodegen(
return fragments.firstOrNull()
}
private fun getCompiledPackageFragment(packageFqName: FqName, state: GenerationState): PackageFragmentDescriptor? =
if (!IncrementalCompilation.ENABLED) null
else state.module.getPackage(packageFqName).fragments.firstOrNull { fragment ->
private fun getCompiledPackageFragment(facadeFqName: FqName, state: GenerationState):
IncrementalPackageFragmentProvider.IncrementalPackageFragment.IncrementalMultifileClassPackageFragment? {
if (!IncrementalCompilation.isEnabled()) return null
val packageFqName = facadeFqName.parent()
val incrementalPackageFragment = state.module.getPackage(packageFqName).fragments.firstOrNull { fragment ->
fragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment &&
fragment.target == state.targetId
}
} as IncrementalPackageFragmentProvider.IncrementalPackageFragment?
return incrementalPackageFragment?.getPackageFragmentForMultifileClass(facadeFqName)
}
}
}

View File

@@ -18,31 +18,27 @@ package org.jetbrains.kotlin.codegen
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext
import org.jetbrains.kotlin.codegen.serialization.JvmSerializerExtension
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.JetFile
import org.jetbrains.kotlin.psi.JetNamedFunction
import org.jetbrains.kotlin.psi.JetProperty
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.KtProperty
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.PackageData
import org.jetbrains.kotlin.serialization.SerializationUtil
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import java.util.*
public class MultifileClassPartCodegen(
v: ClassBuilder,
file: JetFile,
file: KtFile,
private val filePartType: Type,
private val multifileClassFqName: FqName,
private val multifileClassType: Type,
partContext: FieldOwnerContext<*>,
state: GenerationState
) : MemberCodegen<JetFile>(state, null, partContext, file, v) {
) : MemberCodegen<KtFile>(state, null, partContext, file, v) {
override fun generate() {
if (state.classBuilderMode == ClassBuilderMode.LIGHT_CLASSES) return
super.generate()
@@ -62,7 +58,7 @@ public class MultifileClassPartCodegen(
override fun generateBody() {
for (declaration in element.declarations) {
if (declaration is JetNamedFunction || declaration is JetProperty) {
if (declaration is KtNamedFunction || declaration is KtProperty) {
genFunctionOrProperty(declaration)
}
}
@@ -73,18 +69,14 @@ public class MultifileClassPartCodegen(
}
override fun generateKotlinAnnotation() {
if (state.classBuilderMode != ClassBuilderMode.FULL) {
return
}
val members = ArrayList<DeclarationDescriptor>()
for (declaration in element.declarations) {
when (declaration) {
is JetNamedFunction -> {
is KtNamedFunction -> {
val functionDescriptor = bindingContext.get(BindingContext.FUNCTION, declaration)
members.add(functionDescriptor ?: throw AssertionError("Function ${declaration.name} is not bound in ${element.name}"))
}
is JetProperty -> {
is KtProperty -> {
val property = bindingContext.get(BindingContext.VARIABLE, declaration)
members.add(property ?: throw AssertionError("Property ${declaration.name} is not bound in ${element.name}"))
}
@@ -93,23 +85,18 @@ public class MultifileClassPartCodegen(
val bindings = v.serializationBindings
val serializer = DescriptorSerializer.createTopLevel(JvmSerializerExtension(bindings, state.typeMapper))
val serializer = DescriptorSerializer.createTopLevel(
JvmSerializerExtension(bindings, state.typeMapper, state.useTypeTableInSerializer)
)
val packageProto = serializer.packagePartProto(members).build()
if (packageProto.memberCount == 0) return
val strings = serializer.stringTable
val nameResolver = NameResolver(strings.serializeSimpleNames(), strings.serializeQualifiedNames())
val data = PackageData(nameResolver, packageProto)
val av = v.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_MULTIFILE_CLASS_PART), true)
JvmCodegenUtil.writeAbiVersion(av)
av.visit(JvmAnnotationNames.MULTIFILE_CLASS_NAME_FIELD_NAME, multifileClassFqName.shortName().asString())
val dataArray = av.visitArray(JvmAnnotationNames.DATA_FIELD_NAME)
for (string in BitEncoding.encodeBytes(SerializationUtil.serializePackageData(data))) {
dataArray.visit(null, string)
}
dataArray.visitEnd()
AsmUtil.writeAnnotationData(av, serializer, packageProto)
av.visit(JvmAnnotationNames.MULTIFILE_CLASS_NAME_FIELD_NAME, multifileClassType.internalName)
av.visitEnd()
}
}
override fun generateSyntheticParts() {
generateSyntheticAccessors()
}
}

View File

@@ -24,9 +24,9 @@ import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorBase;
import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl;
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorImpl;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.scopes.JetScope;
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.TypeConstructor;
import org.jetbrains.kotlin.types.TypeConstructorImpl;
import org.jetbrains.kotlin.types.TypeUtils;
@@ -41,7 +41,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
private Visibility visibility;
private TypeConstructor typeConstructor;
private List<TypeParameterDescriptor> typeParameters;
private final Collection<JetType> supertypes = new ArrayList<JetType>();
private final Collection<KotlinType> supertypes = new ArrayList<KotlinType>();
public MutableClassDescriptor(
@NotNull DeclarationDescriptor containingDeclaration,
@@ -66,7 +66,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
@NotNull
@Override
public Annotations getAnnotations() {
return Annotations.EMPTY;
return Annotations.Companion.getEMPTY();
}
public void setModality(@NotNull Modality modality) {
@@ -100,6 +100,11 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
return isInner;
}
@Override
public boolean isData() {
return false;
}
@Override
public boolean isCompanionObject() {
return false;
@@ -111,10 +116,10 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
return typeConstructor;
}
public void addSupertype(@NotNull JetType supertype) {
public void addSupertype(@NotNull KotlinType supertype) {
assert !supertype.isError() : "Error types must be filtered out in DescriptorResolver";
if (TypeUtils.getClassDescriptor(supertype) != null) {
// See the Errors.SUPERTYPE_NOT_A_CLASS_OR_TRAIT
// See the Errors.SUPERTYPE_NOT_A_CLASS_OR_INTERFACE
supertypes.add(supertype);
}
}
@@ -142,7 +147,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
assert typeConstructor == null : typeConstructor;
this.typeConstructor = TypeConstructorImpl.createForClass(
this,
Annotations.EMPTY,
Annotations.Companion.getEMPTY(),
!getModality().isOverridable(),
getName().asString(),
typeParameters,
@@ -155,14 +160,14 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
@Override
@NotNull
public JetScope getUnsubstitutedMemberScope() {
return JetScope.Empty.INSTANCE$; // used for getDefaultType
public MemberScope getUnsubstitutedMemberScope() {
return MemberScope.Empty.INSTANCE; // used for getDefaultType
}
@NotNull
@Override
public JetScope getStaticScope() {
return JetScope.Empty.INSTANCE$;
public MemberScope getStaticScope() {
return MemberScope.Empty.INSTANCE;
}
@Override

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