Compare commits

...

4436 Commits

Author SHA1 Message Date
Anton Bannykh
64a2f0d323 ~ release intercepted + loop unrolling 2018-07-06 21:00:41 +03:00
Anton Bannykh
9e8a9720a1 ~ more tests + better interception 2018-07-06 20:24:42 +03:00
Anton Bannykh
30b0c622a2 ~ improve intrinsics createCoroutineUnintercepted 2018-07-06 18:33:45 +03:00
Anton Bannykh
fb65d45467 JS: coroutines 1.3 2018-07-05 20:45:47 +03:00
Denis Zharkov
ddb535712f ~ renderLambdaToStringFix rendered reference-public-api
It's necessary because of the changes in 3497880f203449121ea8035c49b792cc4dc53bd6
2018-07-05 17:52:36 +03:00
Denis Zharkov
24980212dd Replace trivial usages of suspendCoroutineOrReturn in tests
This is necessary since suspendCoroutineOrReturn gets removed in 1.3
2018-07-05 16:19:47 +03:00
Denis Zharkov
dbb7b9c6f8 Replace a couple of usages of suspendCoroutineOrReturn in tests 2018-07-05 16:19:46 +03:00
Denis Zharkov
1f6f0de441 Fix dispatchResume.kt tests after suspendCoroutineOrReturn removal
To leave them COMMON_COROUTINES_TEST use suspendCoroutine instead
But, since it requires for continuation to be called externally
the tests are rewritten
2018-07-05 16:19:45 +03:00
Denis Zharkov
c572862862 Fix some of the bytecodeText tests
The changes are necessary because of release coroutines support:
- Get rid of suspendCoroutineOrReturn calls. It's anyway irrelevant
to what is being tested here

- In varValueConflictsWithTable.kt, variables slots have been shifted
because the variable for continuation's exception was removed

- In varValueConflictsWithTableSameSort.kt, a variable has been introduced
to preserve the same slot numbers for old variables.
Otherwise, they become shifted and to the second slot,
and there are a lot of irrelevant "ALOAD 2" instructions

This change is another example of why bytecode text tests are evil
2018-07-05 16:19:45 +03:00
Denis Zharkov
c1a22230be Fix tests after new Continuation API support
#KT-24863 Fixed
2018-07-05 10:20:56 +03:00
Denis Zharkov
7818594588 Support new Continuation API in JVM BE
#KT-24863 Fixed
2018-07-04 16:06:17 +03:00
Denis Zharkov
ae9d2db9b9 Support CoroutineUtil.kt helpers within AbstractCompileKotlinAgainstKotlinTest 2018-07-04 16:06:16 +03:00
Denis Zharkov
2f34791dbc Add ContinuationAdapter to coroutine tests helpers
It allows having the same Continuation implementations for different
API versions
2018-07-04 16:06:15 +03:00
Denis Zharkov
22fe15efb3 Minor. Use coroutine test helpers for inline/diagnostics tests
It should help with decreasing test data copy-pasting when
testing against release / pre-release coroutines
2018-07-04 16:04:25 +03:00
Denis Zharkov
c6059c9364 Minor. Reformat CoroutineCodegen.kt 2018-07-04 16:04:25 +03:00
Denis Zharkov
62f1f40d3e Minor. Move helpers for coroutines tests to kt-file 2018-07-04 16:04:25 +03:00
Roman Elizarov
fbb3d7dc7e Extracted BaseContinuationImpl 2018-07-04 16:03:30 +03:00
Roman Elizarov
ef28e06eb7 releaseInterceptedContinuation clarified and ref check in impl fixed 2018-07-04 16:03:30 +03:00
Roman Elizarov
ea5a8bad64 Fixed boxing of SuccessOrFailure inside SafeContinuation impl 2018-07-04 16:03:30 +03:00
Roman Elizarov
a6440e76a7 Further design improvements for coroutines 1.3 APIs
* Documentation improvements and clarification
* Dropped legacy intrinsic functions
* Remove context parameter default from Continuation builder function
2018-07-04 16:03:30 +03:00
Roman Elizarov
d55edc3b12 Continuation builder function 2018-07-04 16:03:30 +03:00
Roman Elizarov
d0f4aeb7f4 Fixed ContinuationImpl.intercepted 2018-07-04 16:03:30 +03:00
Roman Elizarov
24b1491c81 Unroll recursion in resumeWith
Fixes KT-18987
2018-07-04 16:03:30 +03:00
Roman Elizarov
456867697e Implement COROUTINE_SUSPENDED as a property with getter 2018-07-04 16:03:30 +03:00
Roman Elizarov
6723181513 Missing SinceKotlin declarations added for resume extensions 2018-07-04 16:03:30 +03:00
Roman Elizarov
cca80d5632 releaseInterceptedContinuation and few other minor fixes 2018-07-04 16:03:30 +03:00
Roman Elizarov
e34e54b8e3 More work on draft coroutines 1.3 ABI & API:
* SuspendFunction[01] interfaces removed, moved to RestrictedContinuationImpl
* validateContext introduced to check restricted coroutines
* Distinguish SuspendLambda as being lambda/coroutine and provide a separate
  toString implementation (draft) in its coroutine incarnation.
2018-07-04 16:03:30 +03:00
Roman Elizarov
3bb5cb4ad3 Better support for mixed-version libs (override old method, too) 2018-07-04 16:03:30 +03:00
Roman Elizarov
d367bfdb72 Draft Kotlin Coroutines 1.3 ABI & API:
* SuccessOrFailure inline class is introduced
* Continuation.resumeWith(SuccessOrFailure)
* createCoroutineUnintercepted
* [Restricted]ContinuationImpl as named suspending function base
* [Restricted]SuspendLambda as suspending lambda base
* SuspendFunction[01] interfaces for efficient createCoroutine
* Serializable coroutine classes
2018-07-04 16:03:30 +03:00
Alexey Tsvetkov
39fc7cffe1 Temporarily ignore Kapt3WorkersAndroid32IT 2018-07-04 15:15:57 +03:00
Alexey Tsvetkov
bab8c97c09 Allow overriding default Gradle version per test class 2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
05fa8b7451 Add SDK jars to compile classpath for Kapt Workers task 2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
bfc608de29 Close kapt context 2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
3b18debee3 Test kapt with workers 2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
efeea9d7d4 Update android tools versions in Gradle plugin tests 2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
357518be0d Remove projectDir input from KaptWithoutKotlincTask
It is redundant since the task would be restarted when project dir changes,
because paths of sources would also change
2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
9b97108db4 Fix getting plugin version for kotlinKaptWorkerDependencies configuration
Previously the configuration would not work for non-android projects,
because it looked only at KotlinAndroidPluginWrapper for plugin version
2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
43b7ffd823 Create kotlinKaptWorkerDependencies only once
#KT-25124 fixed
2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
5bf5632886 Do not load annotation processors when generating stubs
#KT-25131 fixed
2018-07-04 14:55:42 +03:00
Alexey Tsvetkov
f438b7501c Fix compilation of plugin projects in JPS
#KT-25218 fixed
2018-07-04 14:54:07 +03:00
Alexander Udalov
285912f556 Minor, add helper StackValue.constant(int) 2018-07-04 13:39:32 +02:00
Denis Zharkov
22a9cecfe0 Optimize KotlinPropertyAccessorsReferenceSearcher for case of no kt-files
Property names by accessors can be computed without resolving
java descriptors

 #KT-11477 Fixed
 #KT-16890 Fixed
2018-07-04 14:03:28 +03:00
Denis Zharkov
2d50ad82a5 Optimize SyntheticJavaPropertyDescriptor.Companion::findByGetterOrSetter
Do not force getContributedDescriptors call when we need to request
at most three names
2018-07-04 14:03:28 +03:00
Denis Zharkov
5e6a3673c8 Reformat SyntheticJavaPropertiesScope.kt 2018-07-04 14:03:28 +03:00
Alexey Sedunov
fc93f00c7b Misc: Make LibraryEffectiveKindProvider cache an instance property 2018-07-04 13:34:20 +03:00
Ilya Chernikov
db73ed1d0c Add 1.2.51 issues to changelog 2018-07-04 11:42:47 +02:00
Alexey Sedunov
5f69eebe66 Misc: Fix SOE due to wrong overloaded method call
#KT-25247 Fixed
2018-07-03 22:09:55 +03:00
Alexander Udalov
50904d4216 Add JvmFunctionExtensionVisitor.visitEnd
#KT-25223 Fixed
2018-07-03 19:15:34 +02:00
Ilya Gorbunov
cbc3480d9e Split common builtin companion tests from JVM-only tests
Remove duplicated tests from NumbersJVMTest.
2018-07-03 19:58:53 +03:00
Svyatoslav Kuzmich
83f8cfaa66 [JS IR BE] hashCode, toString, number conversion support 2018-07-03 19:51:58 +03:00
Svyatoslav Kuzmich
a7a695f203 KJS: Add JsLoop AST interface and corresponding visitors 2018-07-03 19:51:58 +03:00
Roman Artemev
d130ba6f44 [JS IR BE] Update test data 2018-07-03 19:14:00 +03:00
Roman Artemev
47d088d4c5 [JS IR BE] Reimplement block decomposer lowering 2018-07-03 19:13:53 +03:00
Mikhail Zarechenskiy
e2c287c77e Fix language feature for mod/rem tests for migration to 1.3 version
After 2e88f5c47d
2018-07-03 16:10:37 +03:00
Alexander Podkhalyuzin
7ee055fccc Merge pull request #1745 from JetBrains/rr/suppressor
Introduce KotlinInspectionSuppressor
2018-07-03 14:37:39 +03:00
Svyatoslav Scherbina
226f16b44e ir.tree: fix .originalKotlinType for transformed IR types 2018-07-03 09:55:12 +03:00
Ilya Gorbunov
4fd6dcd063 Turn progressive mode on with the gradle parameter test.progressive.mode 2018-07-03 05:10:24 +03:00
Ilya Gorbunov
3c86e40bcb Fix WITH_UNSIGNED directive in noBoxingOperationsOnNonTrivialSpread 2018-07-03 03:52:18 +03:00
Ilya Gorbunov
16fb5f6901 Set language and api versions automatically for unsigned types box tests
Remove InlineClasses feature directive from tests
2018-07-03 03:52:18 +03:00
Ilya Gorbunov
181a8d7d6a Extract default language version settings for diagnostics tests
And override it in unsigned types diagnostics tests.
Remove InlineClasses feature directive from tests, because it's already
enabled in that language version.
2018-07-03 03:52:18 +03:00
Ilya Gorbunov
3349976279 Make MIN_VALUE and MAX_VALUE of unsigned types actual constants 2018-07-03 03:52:18 +03:00
Ilya Gorbunov
7a208c3e01 Simplify unsigned array constructor functions 2018-07-03 03:52:18 +03:00
Ilya Gorbunov
615f57f2fc Compile unsigned types sourceset with 1.3 and annotate them with SinceKotlin("1.3") 2018-07-03 03:52:18 +03:00
Ilya Gorbunov
a72ad8b267 Advance bootstrap to 1.2.70-dev-23 2018-07-03 03:52:18 +03:00
Alexey Tsvetkov
1dea01a479 Build: remove testRuntime dependency on ":kotlin-compiler:dist" 2018-07-02 22:36:35 +03:00
Alexey Sedunov
03ed4e39e3 Search Everywhere: Recover original behavior for non-functions
#KT-25189 Fixed
2018-07-02 20:18:21 +03:00
Alexander Udalov
e4af8dc7d8 Improve reflection error message when function/property is not found 2018-07-02 18:49:09 +02:00
Alexander Udalov
4f2fdd1c01 Load all resources in RuntimePackagePartProvider; optimize code
The issue was reproducible when the same package is present in different
modules with the same -module-name (which is a popular case of src/test
roots in simple IDEA projects). The problem was in the fact that several
resource files containing package name mapping with the same name were
present in the classpath, but RuntimePackagePartProvider only considered
the first one. The fix is to use getResources instead of
getResourceAsStream and handle each returned resource.

Also, optimize internal representation to store the mapping in the form
which is the most convenient for findPackageParts, which should be
faster than registerModule because in theory, it's called more often.

 #KT-21973 Fixed
 #KT-24651
2018-07-02 18:49:09 +02:00
Alexander Udalov
8ccbbf71ec Remove obsolete BuiltInFunction and mapIntrinsicFunctionSignature
This is now fully covered by the JVM signature mapping, introduced in
the previous commit. The change in KDeclarationContainerImpl.methodOwner
is needed because primitive classes have no methods on JVM; and when
we're looking for "Int.equals", we'll now look it up in the Class object
for java.lang.Integer, not for the primitive int.
2018-07-02 18:49:08 +02:00
Alexander Udalov
4266e50be8 Use manual type mapping in reflection for members from built-ins
There are cases when members deserialized from JVM classes have no JVM
signature in the proto. For example, if a member is inherited from a
built-in class (such as Map.getOrDefault in some Map implementations),
or if a member is synthesized in the compiler front-end and back-end
separately (such as enum values/valueOf). In these cases, we'll use the
naive type mapping to try to recover the signature.

 #KT-16616 Fixed
 #KT-17542 Fixed
2018-07-02 18:49:08 +02:00
Alexander Udalov
a7c80f2df1 Reformat module reflection.jvm, fix inspections/warnings 2018-07-02 18:49:08 +02:00
Alexander Udalov
25ee67a644 Catch SecurityException when reading system property in BitEncoding
This does not fix KT-15167 though because the exception from KT-20575 is
thrown shortly afterwards

 #KT-15167
2018-07-02 18:49:08 +02:00
Alexander Udalov
42de05f3fa Improve diagnostic for missing BuiltInsLoader implementation
Also initialize it lazily to avoid wrapping the exception into
ExceptionInInitializerError

 #KT-20575
2018-07-02 18:49:08 +02:00
Alexander Udalov
50c515deca Do not serialize constructors for anonymous objects
The only client of this data is reflection, and since anonymous objects
do not have constructors in the source code, they shouldn't in
reflection as well

 #KT-20442 Fixed
2018-07-02 18:49:08 +02:00
Alexander Udalov
17fc41e0f9 Do not create primary constructor for enum entry synthetic class
The change in DescriptorSerializer is needed so that serialized protos
of enum entry classes which are resolved in sources
(LazyClassDescriptor) and are deserialized from binaries
(EnumEntrySyntheticClassDescriptor) are the same. There are tests on
incremental compilation in JS that check that the serialized proto is
exactly the same after rebuild and after an incremental build.

 #KT-22048 Fixed
2018-07-02 18:49:08 +02:00
Alexey Sedunov
b52b07ec79 Test Support: KT-22306
Do not show run markers in JS modules when no relevant run configurations are available

 #KT-22306 Fixed
2018-07-02 19:15:52 +03:00
Alexey Sedunov
3e91346240 Rename: Fix processing of references to synthetic Java properties
Fixes for non-master-bunch plugin.xml
2018-07-02 19:15:51 +03:00
Alexey Sedunov
22d74276a0 Misc: Configure stdlib in failing tests 2018-07-02 19:08:10 +03:00
Alexey Sedunov
65dad5eb74 Misc: Fix test assertion 2018-07-02 19:08:10 +03:00
Mikhail Zarechenskiy
59567c8012 Improve exception message to detect actual problem
This relates to EA-120082, EA-119637
2018-07-02 16:12:39 +03:00
Mikhail Zarechenskiy
2e88f5c47d Prohibit operator mod as declaration and calls that resolved via it
#KT-24197 Fixed
2018-07-02 16:12:36 +03:00
Roman Artemev
c887b88ed9 Fix coroutine test generator 2018-07-02 15:35:02 +03:00
Nikolay Krasko
f1a44ed1a4 Allow to disable bad format inspection for unchanged files (KT-25199)
#KT-25199 Fixed
2018-07-02 15:06:47 +03:00
Nikolay Krasko
30a2969887 Move KotlinCleanupInspection to Migration group 2018-07-02 15:06:47 +03:00
Denis Zharkov
3b968351bb Load Java overrides of Kotlin suspend functions as suspend, too
There's still some blind spots:
- Covariant overrides in Java (KT-25036)
- Current implementation assumes that when language version is 1.3 every suspend function
reference only release-coroutines-package Continuation
(we need to check if it's a correct statement)

 #KT-24848 Fixed
 #KT-25036 Open
2018-07-02 14:14:59 +03:00
Denis Zharkov
0fc9bb3f4a Minor. Reformat LazyJavaClassMemberScope.kt 2018-07-02 14:14:59 +03:00
Mikhail Zarechenskiy
de60c9b635 Fix language features in tests for gradual migration to 1.3 version 2018-07-02 12:13:11 +03:00
Vyacheslav Gerasimov
931ebb4c3c as32: Limit until-build to prevent installation on AS 3.3 2018-07-01 00:09:21 +03:00
Alexey Tsvetkov
ece991639e Do not compile jps tests for android studio
I accidentally enabled compilation in one of my previous commits
2018-06-29 20:16:53 +03:00
Ilya Gorbunov
bed26dc700 Fix local delegated property smartcast usage 2018-06-29 20:11:03 +03:00
Nicolay Mitropolsky
80f022c3d5 182: IDEA sdk set to 182.3458.5 2018-06-29 16:42:44 +03:00
Dmitry Petrov
bbcb12ea4b samAdapter test doesn't actually need FULL_JDK 2018-06-29 14:27:57 +03:00
Dmitry Petrov
92430fc63a Update testData for JS_IR tests 2018-06-29 14:23:09 +03:00
Dmitry Petrov
38e9c86443 Update testData for irCfg and sourceRanges tests 2018-06-29 14:01:54 +03:00
Mikhail Glukhikh
537655a4c2 KotlinInspectionSuppressor: introduce more precise quick-fix names
Related to KT-11154, KT-25169
2018-06-29 11:58:28 +03:00
Mikhail Glukhikh
a51bda64dc Add a pair of tests for KT-11154 2018-06-29 11:44:48 +03:00
Dmitry Petrov
f0050930b5 Add ":compiler:ir.backend.common" to compilerModules 2018-06-29 11:24:46 +03:00
Mikhael Bogdanov
da0a966d65 Initialize return type and use unit type in IrDelegationConstructorCall
(cherry picked from commit faac924)
2018-06-29 11:24:46 +03:00
Mikhael Bogdanov
7bd5031eaf Fix array check
(cherry picked from commit e662f82)
2018-06-29 11:24:46 +03:00
Dmitry Petrov
b1d0a5e807 Fix delegated function body generation 2018-06-29 11:24:46 +03:00
Dmitry Petrov
71c5bf0b97 Fix annotation copying for IrValueParameters 2018-06-29 11:24:46 +03:00
Dmitry Petrov
799fcc2606 Fix IrType rendering, update testData 2018-06-29 11:24:46 +03:00
Dmitry Petrov
7fd3fac122 Minor: fix after rebase 2018-06-29 11:24:46 +03:00
Mikhael Bogdanov
2a721ea0f6 Fix EnumClassLowering
(cherry picked from commit 1aa7e1a)
2018-06-29 11:24:46 +03:00
Mikhael Bogdanov
95d72d0a32 Fix unbound symbol problem
Make property initialization non-lazy to bind owner by general mechanism

(cherry picked from commit eec6c18)
2018-06-29 11:24:46 +03:00
Mikhael Bogdanov
ba9f12b617 Use original descriptor for property stub generation
(cherry picked from commit 1a9f242)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
068859eece Minor: use right type for null literal
(cherry picked from commit 88c824b)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
56bf1f895c Mute failed test for JS IR BE
(cherry picked from commit 6d379a6)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
15f33dd94a Unmute some tests for JS IR BE
(cherry picked from commit 04a9622)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
bf2aa5263e JS IR BE: migrate to IR types
(cherry picked from commit 064f47b)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
952163b2fb IR: define references to Throwable, KCallable and KProperty classes inside IrBuiltIns
(cherry picked from commit f92bda0)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
92407c509f IR BE common: add KotlinType based utils
(cherry picked from commit d8be3a6)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
686a3d631c IR BE common: provide type arguments count explicitly for ir calls to reduce dependency on descriptors
(cherry picked from commit af76ae2)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
f002e6030a IR BE common: use another ctor of IrGetValueImpl in LocalDeclarationsLowering
(cherry picked from commit 7e34d6e)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
d5906dd584 IR BE common: fix InnerClassesLowering
(cherry picked from commit 4239a5f)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
072804af52 ir.tree: uncomment and fix IrFunction.createParameterDeclarations
(cherry picked from commit af8b4be)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
6bc86bd42f IR: add ClassifierDescriptor.toIrType and KotlinType.toIrType
(cherry picked from commit 3e09659)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
fa51b962b8 IR: return original KotlinType from IrTupe.toKotlinType() when it possible instead of creating new one
(cherry picked from commit e3b921a)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
1c2ac364c7 IR: add more predicates on IrType
(cherry picked from commit 5cf136c)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
17454d3f9c ir.tree: fix return type of IrMemberAccessExpression.getTypeArgumentOrDefault
(cherry picked from commit 9e7661f)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
576dfda3a8 IrTypes: fix translating for Dynamic type
(cherry picked from commit bd04b46)
2018-06-29 11:24:46 +03:00
Mikhael Bogdanov
ecb5d29130 Add additional IrFunction constructor with custom visibility and modality
(cherry picked from commit 0664d77)
2018-06-29 11:24:46 +03:00
Mikhael Bogdanov
3063de82aa Fix JVM BE IR part
(cherry picked from commit 5e55040)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
1d67cd3b97 IR: add ir.backend.common to jvm backend dependencies
(cherry picked from commit 0776e3d)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
9bcc3cae79 IR Tree: add overloads for irCall and IrGetValueImpl
(cherry picked from commit 1420fc5)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
80b6d84c72 Add dependency: backend.js -> ir.backend.common
(cherry picked from commit a8b02f8)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
7e9cf64754 KJS: don't use onlyIf from ir/backend.common
(cherry picked from commit 34574a9)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
49f2598907 IrTypes: fix ir2cfg
(cherry picked from commit cf162c7)
2018-06-29 11:24:46 +03:00
Zalim Bashorov
ea7b344b80 Use IrType in IrSuspensionPointImpl and IrSuspendableExpressionImpl
(cherry picked from commit 06e1728)
2018-06-29 11:24:46 +03:00
Dmitry Petrov
d5286874bd Fix circular dependency: TypeTranslator <-> ConstantValueGenerator
TODO proper DI?
2018-06-29 11:24:46 +03:00
Dmitry Petrov
ede3a34baa Temporary fix for IR2CFG: use originalKotlinType 2018-06-29 11:24:46 +03:00
Dmitry Petrov
15eafc1513 IrTypes: IrSuspensionPoint, IrSuspendableExpression update 2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
b11abeed6a IrTypes: migrate some code from backend.common
(cherry picked from commit 3788130)
2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
f1bdb48a76 IrTypes: comment backend.common code to be migrated by someone else
(cherry picked from commit 0491fc4)
2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
25d0c57194 backend.common: remove obsolete lowerings
(cherry picked from commit 5d6b9c7)
2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
17312a305b psi2ir: fix type for IrGetField(delegate) when generating delegation
(cherry picked from commit 7601cc2)
2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
56fdf2c735 psi2ir: fix null support in 'promoteToPrimitiveNumericType'
(cherry picked from commit 9b2a637)
2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
0b4d9513eb psi2ir: fix generating fake override for property with type parameters
(cherry picked from commit 2051177)
2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
be413e4fab psi2ir: don't generate accessor type parameter supertypes twice
(cherry picked from commit 22e6d5f)
2018-06-29 11:24:46 +03:00
Dmitry Petrov
a9d0e6d3da IrTypes: generateAnnotationConstructorCall -> ConstantValueGenerator 2018-06-29 11:24:46 +03:00
Dmitry Petrov
3a11767fae IrTypes: use proper scope for type parameters in stub generation 2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
f837537cb6 IrTypes: fix multiple issues in psi2ir 2018-06-29 11:24:46 +03:00
Svyatoslav Scherbina
35cf7c4db3 Expose transformAnnotations from DeepCopyIrTree 2018-06-29 11:24:46 +03:00
Dmitry Petrov
d1b6e8901a Minor: IrTypes: fix after rebase 2018-06-29 11:24:46 +03:00
Dmitry Petrov
2d9ae6e93e IrTypes: approximate only non-denotable Kotlin types 2018-06-29 11:24:46 +03:00
Dmitry Petrov
93f4a4da10 IrTypes: star projections
Initial implementation, mostly to avoid infinite recursion in cases such
as 'Enum<*>'.
2018-06-29 11:24:46 +03:00
Dmitry Petrov
5b3947da11 IrTypes: Fix type arguments mapping for properties 2018-06-29 11:24:46 +03:00
Dmitry Petrov
7497372f65 IrTypes: IrProperty has no type of its own
Within the current scheme, type parameters for IrProperty become type
parameters for getter and setter (and, since only extension properties
can have type parameters, backing field's type can't depend on type
parameters; see also KT-24643). Either properties themselves can have
type parameters of their own (for the sake of representing the property
type), or properties don't have types and don't have type parameters.
2018-06-29 11:24:46 +03:00
Dmitry Petrov
ad65fa8c45 IrTypes: IrTypeParameter.superTypes can depend on type parameters
IrTypeParameter.superTypes can depend on type parameters and thus should
be initialized with type parameters in scope.
2018-06-29 11:24:46 +03:00
Dmitry Petrov
eb6f652763 IrTypes: IrClass.superTypes can depend on type parameters
IrClass.superTypes can depend on type parameters of a class and thus
should be initialized after type parameters are in put in scope.
2018-06-29 11:24:46 +03:00
Dmitry Petrov
8ae17ecbcb IrTypes: IrFunction.returnType can depend on type parameters
Function return type can depend on function type parameters and should
be initialized with type parameters in scope.
2018-06-29 11:24:46 +03:00
Dmitry Petrov
847223683e Minor: IrTypes: fix after rebase 2018-06-29 11:24:46 +03:00
Dmitry Petrov
0ffef64428 IrTypes: IrClass.superTypes, IrTypeParameter.superTypes 2018-06-29 11:24:46 +03:00
Dmitry Petrov
353076f596 compiler/ir/backend.common is NOT a part of compiler/backend-common 2018-06-29 11:24:46 +03:00
Dmitry Petrov
25a66916a6 IrTypes: minor: pass generator context where required 2018-06-29 11:24:46 +03:00
Dmitry Petrov
6649ef2740 IrTypes required to declare symbol 2018-06-29 11:24:46 +03:00
Dmitry Petrov
609a6ca9bb IrTypes: dummy implementation of IrType.render 2018-06-29 11:24:46 +03:00
Dmitry Petrov
4eb2fc66d0 IrTypes: deep copy with symbols
Preliminary implementation of type remapper (does nothing).
2018-06-29 11:24:46 +03:00
Dmitry Petrov
062c4bf41d IrTypes: make old DeepCopy compile
Lots of TODOs, should figure out proper type mapping strategy
(or simply drop this frankenstein code, finally).
2018-06-29 11:24:46 +03:00
Dmitry Petrov
62a42130c8 Add dependency: ir.tree -> intellij
AnnotationGenerator looks into PsiElement
2018-06-29 11:24:46 +03:00
Dmitry Petrov
c22f6dee4a IrTypes: update minor utilities 2018-06-29 11:24:46 +03:00
Dmitry Petrov
e8fe788df6 IrTypes: Implicit casts, take 1
Keep KotlinType along with IrTypes created by psi2ir.
2018-06-29 11:24:46 +03:00
Dmitry Petrov
54e9a2bb7b IrTypes in psi2ir: generators (seem to be) complete 2018-06-29 11:24:46 +03:00
Dmitry Petrov
5f4f6ef863 IrTypes in psi2ir (work in progress) 2018-06-29 11:24:46 +03:00
Dmitry Petrov
0774ca415c Rebase + reformat 2018-06-29 11:24:46 +03:00
Dmitry Petrov
0f718ec2d8 IrTypes: Fix up some back-end code 2018-06-29 11:24:46 +03:00
Dmitry Petrov
326e4a160f IrTypes in psi2ir (work in progress) 2018-06-29 11:24:46 +03:00
Dmitry Petrov
0e34ee5270 IrTypes: basic built-in types 2018-06-29 11:24:46 +03:00
Dmitry Petrov
c97697d7a9 psi2ir: translate types in StatementGenerator
TODO: DI
2018-06-29 11:24:46 +03:00
Dmitry Petrov
372f280578 DeclarationStubGenerator uses IrTypes 2018-06-29 11:24:46 +03:00
Dmitry Petrov
1353cf879c IR: Drop obsolete builders (should be rewritten) 2018-06-29 11:24:46 +03:00
Dmitry Petrov
f66f3c1fed psi2ir: cleanup TypeTranslator 2018-06-29 11:24:46 +03:00
Dmitry Petrov
4bd2504367 IR declarations: KotlinType -> IrType 2018-06-29 11:24:46 +03:00
Dmitry Petrov
4992ca9179 IR expressions: KotlinType -> IrType 2018-06-29 11:24:46 +03:00
Dmitry Petrov
c28877d23c psi2ir: approximate types in TypeTranslator 2018-06-29 11:24:46 +03:00
Dmitry Petrov
1be28d6032 IrType -> IrDynamicType, IrErrorType, IrSimpleType 2018-06-29 11:24:46 +03:00
Mikhail Glukhikh
fdc0335b4a Add actual: handle (incorrect) case with expect function with body
So #KT-23326 Fixed
2018-06-29 10:54:37 +03:00
Mikhail Glukhikh
0fb183e302 Add actual: handle parameters with val/var as compatible with property
So #KT-23762 Fixed
2018-06-29 10:54:36 +03:00
Mikhail Glukhikh
dd0b267531 Add actual: handle primary & secondary constructors as compatible
So #KT-23686 Fixed
2018-06-29 10:54:35 +03:00
Mikhail Glukhikh
082c3e6767 Reformat: AddActualFix 2018-06-29 10:54:33 +03:00
Mikhail Glukhikh
16c6d63b10 Create actual: do not generate default parameter values
So #KT-23105 Fixed
2018-06-29 10:54:32 +03:00
Mikhail Glukhikh
b13e4535f5 Safe delete: add dialog asking about expect / actual declarations
Related to KT-15666
2018-06-29 10:54:30 +03:00
Mikhail Glukhikh
aac71bf904 Safe delete: when invoking on actual, delete expect & actual neighbors
So #KT-15666 Fixed
2018-06-29 10:54:24 +03:00
Mikhail Glukhikh
50e70e4638 Safe delete: when invoking on expect, delete also relevant actual
Partial fix of KT-15666
2018-06-29 10:53:43 +03:00
Mikhail Glukhikh
465d5c077e Safe delete: search for actual declarations more accurately 2018-06-29 10:53:42 +03:00
Mikhail Glukhikh
5bdaef4983 Cleanup: KotlinSafeDeleteProcessor 2018-06-29 10:53:42 +03:00
Mikhail Glukhikh
c4bba135bf Introduce KotlinInspectionSuppressor
So #KT-25169 Fixed
So #KT-11154 Fixed
2018-06-29 10:43:02 +03:00
Alexey Tsvetkov
8848d7a043 Remove groovy plugin from kotlin-gradle-plugin build script 2018-06-28 22:03:11 +03:00
Alexey Tsvetkov
22c1907167 Track project version in ":kotlin-gradle-plugin:processResources"
Before the change consecutive incremental builds with different project versions
produced kotlin-gradle-plugin with the same project.version in project.properties file
2018-06-28 22:03:11 +03:00
Alexey Tsvetkov
3a7c674957 Fix test dependencies in jps-plugin
Otherwise tests fail on clean checkout
2018-06-28 22:03:10 +03:00
Alexey Sedunov
a63aa5b7ca Misc: Restore utility functions misplaced in a previous commit 2018-06-28 20:39:16 +03:00
Alexey Sedunov
76ac65f723 Configuration: Use soft references to keep library kind cache
#KT-24943 Fixed
2018-06-28 18:22:28 +03:00
Alexey Sedunov
60583e557f PSI: Do not delete package directive for file in default package
#KT-24968 Fixed
2018-06-28 18:22:28 +03:00
Alexey Sedunov
e2a632e326 Misc: Add "refactoring exit" message
This allows executing mandatory code at the end of particular refactoring.
Also this fixes memory leak due to listener not being disposed

 #KT-17235 Fixed
2018-06-28 18:22:28 +03:00
Alexey Sedunov
ba2f28720f Introduce Parameter: Fix exceptions caused by write actions in dialogs
#KT-24992 Fixed
2018-06-28 18:22:27 +03:00
Alexey Sedunov
ed597e2da5 Extract Function: Make compliant with PublicApiImplicitTypeInspection 2018-06-28 18:22:27 +03:00
Alexey Sedunov
633c67ebf0 Misc: Use KtToken to represent visibility in ExtractableCodeDescriptor 2018-06-28 18:22:27 +03:00
Mikhael Bogdanov
b1693acfcd Unmute smap test in ir 2018-06-28 17:12:09 +02:00
Alexey Sedunov
83745010ba Search Everywhere: Update renderer to reflect changes in IDEA
#KT-24812 Fixed
2018-06-28 17:52:05 +03:00
Alexey Sedunov
31d248c42d Search Everywhere: Use Kotlin renderer for Kotlin elements only 2018-06-28 17:52:05 +03:00
Alexey Sedunov
bede2e1c16 Extract Interface: Fix type import when converting parameter to property
#KT-18736 Fixed
2018-06-28 17:52:05 +03:00
Alexey Sedunov
9b7450cfdb Extract Superclass: Report private members used in abstracted members
#KT-16284 Fixed
2018-06-28 17:52:04 +03:00
Alexey Sedunov
bd88e02172 Extract Superclass: Fix visibility lifting when moving to interface
#KT-16281 Fixed
2018-06-28 17:52:04 +03:00
Alexey Sedunov
b0e0460ee6 Extract Superclass: Allow extraction to existing file
#KT-15351 Fixed
2018-06-28 17:52:04 +03:00
Alexey Sedunov
5ef54a2f03 Extract Superclass: Run refactoring inside of transaction
#KT-18555 Fixed
2018-06-28 17:52:03 +03:00
Nikolay Krasko
87f4d0c5a4 Move "Copy Current File As Diagnostic Test" action to internal (KT-25164)
#KT-25164 Fixed
2018-06-28 16:02:14 +03:00
Nikolay Krasko
c68284030d Check files is valid before searching for children (EA-113417) 2018-06-28 16:02:14 +03:00
Alexander Udalov
8c8d0eefbb Relocate package org.jetbrains.kotlin in kotlinx-metadata-jvm
To prevent clashes in scenarios where it's used together with the Kotlin
compiler (e.g. in annotation processing)

 #KT-24945 Fixed
2018-06-28 14:39:53 +02:00
Mikhail Zarechenskiy
173bcd90df Simplify lexer rule for typed integers 2018-06-28 13:32:10 +03:00
Mikhael Bogdanov
e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Mikhael Bogdanov
a10c06eb4d Regenerate ir tests with JVM_IR target 2018-06-28 12:26:41 +02:00
Mikhail Zarechenskiy
dc7678a700 Use smartcast info that related to call in change signature quick fix
There is an inconsistency on how we record smartcasts in old and new
 inference, but we definitely should use all possible information about
 smartcasts in quick-fixes

 #KT-25144 Fixed
2018-06-28 13:14:18 +03:00
Nicolay Mitropolsky
698096f13e Uast: fix for creating an UClass for invalid object-literals (EA-122644, KT-20056) 2018-06-28 10:29:47 +03:00
Alexey Tsvetkov
25e6b76238 Build: disable jar compression for local builds
This speeds ups jar creation twice, which is significant for local
incremental builds when jar creation can dominate compilation time.

Changes in stripMetadata are required because putting entry from not-stripped
jar caused failures when compression was disabled (because size and crc
are actually changed during metadata removal; don't know why it works
with compression).
2018-06-27 23:56:26 +03:00
Alexey Tsvetkov
3dc38fe2f8 Build: enable Java incremental compilation for local builds 2018-06-27 23:56:26 +03:00
Alexey Tsvetkov
c73657b38d Build: disable incremental compilation for non-TC build
This should bring small performance improvements for CI builds
(since they are not incremental anyway).
2018-06-27 23:56:26 +03:00
Nico Mandery
5c16633175 fix typos in documentation of JsQualifier annotation (#1733) 2018-06-27 19:34:27 +03:00
Lucas Smaira
5820656aae Find Kotlin class with alternative resolve enabled
Kotlin run configurations are failing non-deterministically in Android
Studio due to not finding the class while in dumb mode (while AS invokes
Gradle build or in indexing after that).

Fix that by finding class in KotlinRunConfiguration with alternative
resolve enabled.
2018-06-27 16:38:44 +03:00
Vyacheslav Gerasimov
abd3ac4e96 UAST: Reformat KotlinUObjectLiteralExpression.kt 2018-06-27 16:04:41 +03:00
Vyacheslav Gerasimov
a829251690 UAST: Fix possible TypeCastException when creating KotlinUNamedExpression 2018-06-27 16:04:40 +03:00
Vyacheslav Gerasimov
23ee463053 Check if module disposed when getting modules with kotlin files 2018-06-27 16:04:40 +03:00
Vyacheslav Gerasimov
16b4d25c1d Reformat ConfigureKotlinInProjectUtils 2018-06-27 16:04:40 +03:00
Vyacheslav Gerasimov
62c0d37d45 UAST: Do not log PCE in DeclarationDescriptor.toSource 2018-06-27 16:03:16 +03:00
Nikolay Krasko
8ea19eda73 as32: Minor: use full sentences for reasons 2018-06-27 15:11:08 +03:00
Nikolay Krasko
17d4961760 as32: Use full sentences for reasons 2018-06-27 15:11:08 +03:00
Nikolay Krasko
099f3f3ddf Move isEap and isDev utility functions to idea module 2018-06-27 15:11:08 +03:00
Nikolay Krasko
54bb09a5fb Make disabled verification visible in UI 2018-06-27 15:11:07 +03:00
Alexander Udalov
0c45f20515 Minor, fix several CLI argument descriptions 2018-06-27 13:25:30 +02:00
Mikhail Zarechenskiy
a765ee41d7 Introduce uL/UL suffix to represent numbers of unsigned long type
#KT-24663 Fixed
2018-06-27 14:21:12 +03:00
Mikhail Zarechenskiy
7c44992016 Allow any case for u suffix
#KT-24663 In Progress
2018-06-27 14:21:07 +03:00
Alexander Udalov
984e37c7f1 Prohibit explicit usage of kotlin.Metadata as annotation 2018-06-27 12:37:18 +02:00
Alexander Udalov
8d124eb77f Minor, use array literal syntax in kotlin.Metadata 2018-06-27 12:20:03 +02:00
Dmitry Petrov
46a3f7420c When in debugger context, access private companion object directly 2018-06-26 16:46:55 +03:00
Nicolay Mitropolsky
bef3d4ace2 Uast: proper identifiers for KotlinUBinaryExpression (KT-25092) 2018-06-26 16:39:47 +03:00
Mikhail Glukhikh
eb92b7ed7f Unused symbol: don't suggest actual declaration used in another platform
Related to KT-17512
Related to KT-15666
2018-06-26 15:36:10 +03:00
Mikhail Glukhikh
30327aa9cc Do not mark kotlin.test.Test annotated declarations as unused
So #KT-20523 Fixed
2018-06-26 15:36:09 +03:00
Mikhail Glukhikh
7e0e7dc983 Unused symbol: remove forced "used" from actual declarations
Now we really check whether actual declaration has usages
(in expect or actual code) or not
Related to KT-17512
Related to KT-15666
2018-06-26 15:36:07 +03:00
Mikhail Glukhikh
e885e54233 Implement search from expect element in KotlinReferenceSearcher
So mostly #KT-17512 Fixed
2018-06-26 15:36:06 +03:00
Mikhail Glukhikh
97d158d833 Find property usages dialog: rename all check-boxes as in other dialogs 2018-06-26 15:36:05 +03:00
Mikhail Glukhikh
abbfea357a Add find usages option: search expected 2018-06-26 15:36:04 +03:00
Mikhail Glukhikh
69e420991a KotlinFindMemberUsagesHandler: get rid of deprecation 2018-06-26 15:36:03 +03:00
Mikhail Glukhikh
0a36edcf20 Cleanup: KotlinReferenceSearcher 2018-06-26 15:36:01 +03:00
Mikhail Glukhikh
ea7db42af6 Cleanup: findUsagesOptions 2018-06-26 15:36:00 +03:00
Mikhail Glukhikh
a46e4f3142 Cleanup: KotlinFindMemberUsagesHandler 2018-06-26 15:35:59 +03:00
Mikhail Glukhikh
cc2869988f Test for KT-17512 (yet with incorrect results) 2018-06-26 15:35:58 +03:00
Mikhail Zarechenskiy
600d135786 Fix internal compiler error on importing invisible fake reference
Note that this is not relevant for LOCAL/INHERITED visibilities:
  - for LOCAL visibility it's impossible to have a qualifier
  - INHERITED is an intermediate visibility, we enhance it later
    (see resolveUnknownVisibilityForMember)

 #KT-20356 Fixed
2018-06-26 14:18:21 +03:00
Nikolay Krasko
84b26fc61d Show kotlin internal information only in internal builds 2018-06-26 11:35:22 +03:00
Nikolay Krasko
5df0879538 Fix NPE in replaceImports() (EA-109700) 2018-06-26 11:35:21 +03:00
Alexander Udalov
1951d38f40 Retain optional expected annotations when compiling platform code
After this change, optional expected annotations will be compiled to
physical class files on JVM, and stored to metadata on other platforms,
to allow their usages from dependent platform modules. For example:

    @OptionalExpectation
    expect annotation class A

When compiling this code on JVM, A.class will be produced as if the
class A did neither have the 'expect' modifier, nor had it been
annotated with OptionalExpectation. Note that if there's no actual
annotation class for A, then usages (which can only be usages as
annotation entries) are simply skipped.

Class A will be public from Kotlin's point of view (since it should
be possible to use it in Kotlin sources), but _package-private_ in Java
to disallow its usages outside of the declaring module.

 #KT-18882 Fixed
 #KT-24617 Fixed
2018-06-26 10:23:55 +02:00
Alexander Udalov
4e217b180a Pass BindingContext to CodegenUtil.getActualDeclarations
Will be used in a subsequent commit. Also rename getActualDeclarations
-> getDeclarationsToGenerate
2018-06-26 10:23:55 +02:00
Mikhail Zarechenskiy
ba6da7c40a Support varargs of inline class types with non-trivial spread
#KT-24880 In Progress
2018-06-25 17:15:50 +03:00
Mikhail Zarechenskiy
333411c57d Associate vararg of unsigned types with corresponding arrays
This is a first step, full support will be added later

 #KT-24880 In Progress
2018-06-25 17:15:47 +03:00
Mikhail Zarechenskiy
3e45a1529c Allow to declare vararg parameters of unsigned types
varargs inside annotations will be supported later when
 constant evaluation of more complex expressions of unsigned types
 will be ready

 #KT-24880 In Progress
2018-06-25 17:15:44 +03:00
Mikhail Zarechenskiy
3f462659d2 Determine underlying property of inline class by its name
Previous way to distinguish "primary constructor properties" from other
 properties wasn't correct for deserialized properties, because currently
 we don't have special information about this in metadata
2018-06-25 17:11:59 +03:00
Sergey Igushkin
dbd72ae53b Fix Android ap option providers as Kapt task nested inputs
1) Exclude the providers arguments from the kapt inputs, as the values
may contain absolute paths, may be output properties etc. The providers
should correctly annotate their inputs.

2) Fix the options passed to kapt as 'value=option' (leading to all the
options collapse into one with the null key), use 'key=option' instead
to make Kapt pass them as '-Aoption'.

Issue #KT-23866 Fixed
Issue #KT-25027 Fixed
2018-06-25 15:03:52 +03:00
Mikhail Glukhikh
a3be68de82 Useless call: move class up from companion to remove 1.3 deprecation 2018-06-25 12:07:45 +03:00
Ilya Chernikov
7bff5e3ce7 Add missing tests dependencies on the renewed kotlin-scripting-idea plugin 2018-06-25 08:06:20 +02:00
Ilya Chernikov
1fbece9e7d Clean scripting plugin options and classpath on importing from gradle
should prevent problems that may appear if JPS will try to load
gradle scripting subplugin

(cherrypicked with update from 1.2.50)
2018-06-25 08:06:20 +02:00
Alexander Udalov
0dc12fc560 Update bootstrap to 1.2.60-dev-980 2018-06-24 18:14:37 +02:00
Ilya Gorbunov
39cad033a3 Cleanup: remove deprecated configuration property
Currently it's useless because we don't override compilerJarFile anymore.
2018-06-24 17:27:57 +03:00
xiexed
414fabb2c6 KtStringTemplateExpressionManipulator: properly works with interpolations (KT-24958) 2018-06-22 21:54:28 +03:00
Vyacheslav Gerasimov
01db78d776 Build: Introduce Project extension properties for source sets 2018-06-22 21:42:30 +03:00
Vyacheslav Gerasimov
42dc6a277f Build: Remove build.gradle.kts.182 for root project 2018-06-22 21:42:29 +03:00
Vyacheslav Gerasimov
07b0eeccc4 Build: Reduce differences in versions scripts 2018-06-22 21:42:13 +03:00
Vyacheslav Gerasimov
5ec535b680 Build: Rename File helper for creating file from pathes list to fileFrom 2018-06-22 21:42:12 +03:00
Vyacheslav Gerasimov
37ed8e2617 Build: Reformat CommonUtil.kt 2018-06-22 21:42:12 +03:00
Vyacheslav Gerasimov
4e3e4b2cd0 Build: Exclude android-lint.jar from CIDR plugin 2018-06-22 21:41:25 +03:00
Vyacheslav Gerasimov
e724cfa60f Revert "Build: Copy uast to idea plugin as separate artifacts"
This reverts commit e6f6451
2018-06-22 21:41:25 +03:00
Leonid Startsev
bef97d85af Respect version string in SubpluginArtifact to load compiler plugins
with versions different from compiler one
2018-06-22 21:13:34 +03:00
Nikolay Krasko
be5527b108 Merge pull request #1088 from lucamtudor/lucamtudor-patch-readme
Updates ReadMe.md to name the Sublime Text Package
2018-06-22 21:10:55 +03:00
Nicolay Mitropolsky
01e9dd5085 don't use project scope to resolve java.lang.String (#KT-25024) 2018-06-22 20:28:55 +03:00
Nikolay Krasko
cdfb813f2e Use single settings for Kotlin code style 2018-06-22 19:19:14 +03:00
Nikolay Krasko
8e31113a4f Ident elvis with normal ident in Kotlin code style (KT-25008)
#KT-25008 Fixed
2018-06-22 19:19:13 +03:00
Nikolay Krasko
341e7746a2 Minor: deprecated canBeOverriden -> canBeOverridden 2018-06-22 19:19:13 +03:00
Nikolay Krasko
6d29e44d1a Remove deprecated DirectClassInheritorsSearch.search call (KT-24933)
#KT-24933 Fixed
2018-06-22 19:19:13 +03:00
Nikolay Krasko
1973860e70 Indent content of when (KT-14066)
#KT-14066 Fixed
2018-06-22 19:19:12 +03:00
Nikolay Krasko
dc8a3ab534 Fix leak in debugger (KT-24903)
#KT-24903 Fixed
2018-06-22 19:19:12 +03:00
Nikolay Krasko
64f14ad89b Reformat: debugger.stepping 2018-06-22 19:19:12 +03:00
Alexey Tsvetkov
89f0b11765 Avoid exception when inspectClassesForKotlinIC produces empty file
Empty file should not happen, but we should process it correctly anyway.
2018-06-22 19:15:45 +03:00
Alexey Tsvetkov
2065f8e6fe Fix inter-project IC for android->non-android dependency
#KT-24832 fixed
2018-06-22 19:15:45 +03:00
Alexey Tsvetkov
9071a70a44 Avoid iterating jar inputs in inspectClassesForKotlinIC task
Jar's inputs can contain zipTrees in case of fat jars,
which can cause slow build
(Gradle unpacks them into temporary dir; that can be slow)

    #KT-24956 fixed
2018-06-22 19:15:45 +03:00
Alexey Tsvetkov
e38cafb1a2 Don't create build directory for task in getter
Since the property is public, it can be invoked from outside,
possibly trough other properties.
This can lead to unwanted side effects: we can create taskBuildDirectory,
because some other task reads the property in parallel with 'clean' task
in current project.
That's exactly what happened when we referenced the property from
'GradleCompilerRunner#buildModulesInfo'.

    #KT-24938 fixed
2018-06-22 19:15:45 +03:00
Alexey Tsvetkov
03839f6861 Test: speed up integration test by not building release variant 2018-06-22 19:15:45 +03:00
Alexey Tsvetkov
433e742d73 Fix location mapping test on Windows 2018-06-22 19:15:45 +03:00
Nikolay Krasko
36ced8a6a6 as32: Allow to override verifier checks 2018-06-22 18:56:24 +03:00
Yan Zhulanow
4aa7a95055 Android Extensions: Explicitly check if the Android plugin is enabled (EA-104651)
AndroidGradleOrderEnumerationHandler is defined in gradle.xml that doesn't depend on the Android plugin.
So we need to additionally check if the Android plugin is installed/enabled.
2018-06-22 17:48:13 +03:00
Dmitry Petrov
d35a92a81d Generate accessor for private companion object 2018-06-22 16:53:07 +03:00
Svyatoslav Scherbina
ba3411e7d7 JS IR: unmute tests 2018-06-22 13:36:47 +03:00
Ilya Gorbunov
6d027bbbfc Remove state from parts of multifile classes
Split COROUTINE_SUSPENDED marker to expect and actual because Kotlin/JS backend
expects it to be property without getter.

Update EXPECTED_REACHABLE_NODES in JS test data.

#KT-24986 Fixed
2018-06-22 11:35:05 +03:00
Svyatoslav Scherbina
cffe7fb23b backend.common: backport DefaultArgumentStubGenerator from Native 2018-06-21 18:18:03 +03:00
Svyatoslav Scherbina
830923e111 backend.common: backport LocalDeclarationsLowering from Native 2018-06-21 18:18:02 +03:00
Svyatoslav Scherbina
944c60eb66 ir.tree: fix bug in IrElementTransformerVoid 2018-06-21 18:18:01 +03:00
Simon Ogorodnik
e20ee0205a Update bunches to include performanceTest config 2018-06-21 16:05:47 +03:00
Simon Ogorodnik
0ac32ae41b Switch GC to ConcMarkSweep and add other options from IDEA defaults 2018-06-21 16:05:46 +03:00
Simon Ogorodnik
7531a103a3 Add options to use JFR 2018-06-21 16:05:45 +03:00
Alexey Tsvetkov
b97e82f604 Resolve bootstrap compiler classpath in root buildscript
Temporary workaround for bootstrapping.
Building the project with plugin version 1.2.60-dev-xxx
and deployVersion='1.3-SNAPSHOT' fails because Gradle
substitutes kotlin-stdlib dependency of kotlinCompilerClasspath
configuration with project dependency ':kotlin-stdlib'.
kotlinCompilerClasspath configuration is used to run the compiler,
which cannot be started with not yet built ':kotlin-stdlib'.
2018-06-21 16:03:27 +03:00
Denis Zharkov
a644cbb5ed Fix deserialization of kotlin.suspend when LV=1.3 is used
Before this change, kotlin.suspend was being loaded as having a common
function type instead of suspend function type.

With LV=1.3, we expect that suspend function types should have
new Continuation interface as a last type argument, while
kotlin.suspend is built with LV=1.2 and has old Continuation.

This change might be reverted once stdlib will be rebuilt with LV=1.3

NB: kotlin.suspend doesn't need to be intrinsified since it only returns
its parameter with checkcast to kotlinin.jvm.functions.Function1
(i.e., it doesn't refer the coroutines package)

 #KT-24861 Fixed
2018-06-21 16:02:13 +03:00
Denis Zharkov
3d3d21cb93 Minor. Extract function in TypeDeserializer 2018-06-21 16:02:13 +03:00
Denis Zharkov
9deb9473d2 Minor. Reformat TypeDeserializer.kt 2018-06-21 16:02:13 +03:00
Denis Zharkov
3fcf2f9c0d Minor. Move KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME constant to 'core'
It will be used for deserialization of kotlin.suspend in the next commit
2018-06-21 16:02:13 +03:00
Denis Zharkov
effdcddeca Minor. Extract createDefaultFakeSMAP in InlineCodegen 2018-06-21 16:02:13 +03:00
Toshiaki Kameyama
5a4cba7528 "To raw/ordinary string literal" intention: Move cursor to same offset after conversion #KT-18106 Fixed (#1675) 2018-06-21 15:56:18 +03:00
Alexander Udalov
51c01c15b8 Refactor KotlinCoreEnvironment, fix warnings 2018-06-21 14:47:28 +02:00
Alexander Udalov
d2f278b601 Minimize content of version-specific bunch files for KotlinCoreEnvironment 2018-06-21 14:47:27 +02:00
Alexander Udalov
9309570752 Fix serialization of type parameters inner generic class
The call to `createTopLevel` instead of `create` (which creates
serializers for outer classes properly, with correct type parameter
contexts) caused MetadataSerializer to write type parameter metadata
incorrectly.  For example, in the following case:

    class A<E> {
        inner class B<T, E> { ... }
    }

A's type parameter E would get id 0, and B's type parameters T and E
would get ids 0 and 1. This is a problem because ids are supposed to be
unique for each class including its outer classes, and deserializer,
decompiler and stub builder rely on this assumption.

JVM metadata is unaffected because `create` is called correctly there,
see MemberCodegen#generateKotlinClassMetadataAnnotation

 #KT-24944 Fixed
2018-06-21 14:45:45 +02:00
Mikhail Zarechenskiy
c05285a23c Remove unneeded bunch file for TargetPlatform.kt
- added missing call checkers
 - fixed missing dependency for `KotlinCallComponents`

 #KT-25018 Fixed
2018-06-21 13:52:10 +03:00
Mikhail Zarechenskiy
6c06d441e5 Fix description of error type 2018-06-21 13:49:37 +03:00
Dmitry Savvinov
70714cb71e Deprecate smartcasts on local delegated properties
^KT-22517 Fixed
2018-06-21 13:36:43 +03:00
Dmitry Savvinov
31ce992ff2 Take DataFlowValueFactoryImpl from DI container instead of constructing directly 2018-06-21 13:36:43 +03:00
Dmitry Savvinov
fa72198505 Minor: narrow deprecation scope of DataFlowValueFactoryImpl to constructor 2018-06-21 13:36:43 +03:00
Dmitry Savvinov
8964b2c7a4 Minor: escape colon properly in interalArgWrongPrefix.args 2018-06-21 13:36:11 +03:00
Anton Bannykh
6edf138460 JS IR: muted newly failing tests 2018-06-21 13:27:17 +03:00
Anton Bannykh
04a2ffc0c1 JS IR: unmute tests 2018-06-21 13:27:17 +03:00
Anton Bannykh
6df9919eba JS IR: add DefaultContructorMarker to the runtime 2018-06-21 13:27:17 +03:00
Anton Bannykh
9039b75c25 JS IR: unmute tests 2018-06-21 13:27:17 +03:00
Anton Bannykh
c077b3ca5d JS IR: invoke missing lowering step for default arguments lowering 2018-06-21 13:27:17 +03:00
Dmitry Petrov
d546fca876 Enable JS_IR back-end on passing 'when' tests 2018-06-21 12:32:00 +03:00
Dmitry Petrov
8999e5bfe6 psi2ir: support unsigned integer literals
NB in FE unsigned integer constants are now represented using signed
integer types (e.g., UInt constant actually holds an Int value).
So, in IR so far we also represent unsigned constant literals as
constant values of corresponding signed types, but with corresponding
unsigned type:
0xFFFF_FFFFu becomes 'CONST Int type=kotlin.UInt value=-1'
2018-06-21 12:32:00 +03:00
Mikhael Bogdanov
c444db90fb Basic support of source mapping in inliner 2018-06-21 11:18:41 +02:00
Mikhael Bogdanov
83ab2b1d34 Minor. Code clean 2018-06-21 11:18:40 +02:00
Mikhael Bogdanov
7c615eb7ab Minor. Reformat 2018-06-21 11:18:40 +02:00
Mikhael Bogdanov
3dff3d61f5 Skip generic signature in bridges 2018-06-21 11:18:39 +02:00
Mikhael Bogdanov
0f7dc6e8af Fix IMPLICIT_COERCION_TO_UNIT 2018-06-21 11:18:38 +02:00
Mikhael Bogdanov
ede751c074 Support more cases in special bridge lowering 2018-06-21 11:18:37 +02:00
Mikhael Bogdanov
64835c1c9c Generate synthetic instructions in loops to support non standart stack transformation 2018-06-21 11:18:37 +02:00
Mikhael Bogdanov
f6038aafcc Fix IMPLICIT_NOT_NULL coercion 2018-06-21 11:18:36 +02:00
Mikhael Bogdanov
a4308e983a Set proper parent for lowered local declaration 2018-06-21 11:18:35 +02:00
Mikhael Bogdanov
c588d22e6a Don't sort descriptors in DeclarationStubGenerator
Sorting adds 30% time to test execution
2018-06-21 11:18:35 +02:00
Alexey Tsvetkov
32b1c42647 Specify root type in non-existent location warning 2018-06-20 23:58:37 +03:00
Alexey Tsvetkov
3fb26d92df Filter out non-existent java source roots in kapt tasks
#KT-24716 fixed
2018-06-20 23:58:37 +03:00
Denis Zharkov
5c04a302fa Add additional checks for RestrictsSuspension-marked functions
Namely, check that when one calls a restricted function
the reciever used for that calls is obtained exactly from the enclosing
suspend function

 #KT-24859 Fixed
2018-06-20 20:00:10 +03:00
Nikolay Krasko
35fdfc9f05 Fix running inner classes from console
#KT-24961 Fixed
2018-06-20 19:52:33 +03:00
Juan Chen
cd91cffdeb as32: Fine-tune exception handling in GooglePluginUpdateVerifier 2018-06-20 19:47:56 +03:00
Nikolay Krasko
bf890b46f3 Allow to leave decline reason empty but demand verifier name 2018-06-20 19:47:55 +03:00
Juan Chen
855c0a353c as32: Improve plugin update verification messages 2018-06-20 19:47:55 +03:00
Juan Chen
6523d4e306 as32: Implementation for GooglePluginUpdateVerifier 2018-06-20 19:47:55 +03:00
Nikolay Krasko
34111e8944 Prototype verify extension and apply it for Kotlin updater in AS 3.2 2018-06-20 19:47:55 +03:00
Dmitry Petrov
871dacbf6c Minor: generated tests update 2018-06-20 17:34:05 +03:00
Mikhail Glukhikh
e1d223937b Optimize "replace toString() with string template"
Related to KT-13782
2018-06-20 17:18:18 +03:00
Mikhail Glukhikh
7a1cf5704e MPP wizard: use more clear wording (KT-20554) 2018-06-20 17:18:18 +03:00
Mikhail Glukhikh
152327d69d Fix erroneous full resolve cache filling
Before this commit, we could store partial resolve results in full
resolve cache (for some declarations, e.g. primary constructors).
This may be done iff current partial resolve mode provides all results
from full resolve mode (CFA results & diagnostics).
Otherwise we should not do it.

This fixes four quick-fix tests on CreateTypeParameter
So #KT-23860 Fixed
So #KT-22758 Fixed
2018-06-20 17:18:18 +03:00
Mikhail Glukhikh
40668e3f96 Partial cleanup of ResolveElementCache 2018-06-20 17:18:18 +03:00
Toshiaki Kameyama
096f9fefd1 "Remove redundant '.let' call" intention: handle it inside function call
So #KT-20583 Fixed
2018-06-20 17:18:17 +03:00
Toshiaki Kameyama
d4798b699f Reformat: ReplaceSingleLineLetIntention 2018-06-20 17:18:17 +03:00
kenji tomita
817d75a47f Introduce ReplaceToStringWithStringTemplateInspection #KT-13782 Fixed 2018-06-20 17:18:17 +03:00
Dmitry Petrov
f956e8d85d Record special descriptor in REFERENCE_TARGET for type alias object
If a type alias is used to reference an object (companion object) as a
qualifier, record FakeCallableDescriptorForTypeAliasObject in
REFERENCE_TARGET. This tells IDE that type alias was used in the file,
thus, if it's imported, such import isn't redundant.
REFERENCE_TARGET is used mostly by IDE and by ClassifierUsageChecker,
which we also have to update to handle qualifiers with
FakeCallableDescriptorForTypeAliasObject in REFERENCE_TARGET.

Rewrite some parts of ClassifierUsageChecker for cleaner interaction.

 #KT-21863 Fixed Target versions 1.2.40
2018-06-20 17:16:25 +03:00
Dmitry Petrov
3b3cc5233f Minor: reformat code 2018-06-20 17:16:25 +03:00
Toshiaki Kameyama
6675d7814c KT-14779 Inspection to replace String.format with string templates (#1645)
* Add inspection to replace String.format with string templates #KT-14779 Fixed

* KT-14779 Fixed
2018-06-20 16:23:04 +03:00
Toshiaki Kameyama
e41a34af88 KT-11850 Add nested lambdas with implicit parameters warning (#1664)
* Add `Nested lambda has shadowed implicit parameter` inspection #KT-11850 Fixed

* KT-11850 Fixed
2018-06-20 15:57:03 +03:00
Roman Artemev
c0f53f3a4d Move IrSuspendableExpression and SuspensionPoint from Kotlin/Native to common part 2018-06-20 15:06:00 +03:00
Dmitry Petrov
c312fddb45 Ignore some 'when' subject variable tests in JS_IR be 2018-06-20 14:06:34 +03:00
Dmitry Petrov
a4b5d74ae3 Generate debug information for 'when' subject variable
NB debugger tests currently don't support language version or individual
language feature settings.
2018-06-20 14:06:34 +03:00
Dmitry Petrov
a7492e91c9 Check that subject expression is evaluated only once 2018-06-20 14:06:34 +03:00
Dmitry Petrov
6194cfc782 Additional IEEE754-related tests for subject variable in 'when' 2018-06-20 14:06:34 +03:00
Dmitry Petrov
34b76a3718 Support subject variable in specialized code generators for 'when' 2018-06-20 14:06:34 +03:00
Dmitry Petrov
3528405666 Minor: reformat 2018-06-20 14:06:34 +03:00
Dmitry Petrov
b4dc3dc91b Fix exhaustiveness check for when with subject variable 2018-06-20 14:06:34 +03:00
Dmitry Petrov
6949610dcb 'val' in 'when': IEEE754 equality 2018-06-20 14:06:34 +03:00
Dmitry Petrov
67247ee490 'val' in 'when' subject can't have modifiers (annotations are ok) 2018-06-20 14:06:34 +03:00
Dmitry Petrov
53fd883e2a Additional parser tests for both subject val and expression in 'when' 2018-06-20 14:06:34 +03:00
Dmitry Petrov
bf083314dd Support 'when' with subject variable in psi2ir 2018-06-20 14:06:34 +03:00
Dmitry Petrov
d6894091a9 Support 'when' with subject variable in JVM BE 2018-06-20 14:06:34 +03:00
Dmitry Savvinov
148d03e365 Add some data flow analysis tests on when 2018-06-20 14:06:34 +03:00
Dmitry Petrov
ae929d0f08 Handle nested when with subject properly
Hack: callee expression for when with subject variable is the subject
variable declaration. This solves the problem that all sub-calls in the
expression are implicitly considered to have a single common lexical
scope (and 'when (val x = ...)' introduces a new lexical scope, which
contains 'x').
2018-06-20 14:06:34 +03:00
Dmitry Petrov
758548603e Extra tests for when with val in subject 2018-06-20 14:06:34 +03:00
Dmitry Petrov
c691d64ea8 Minor: fix & reformat after rebase 2018-06-20 14:06:34 +03:00
Dmitry Petrov
8aec99f4b5 Fix parsing variable declaration in when subject
- parse destructuring declarations
- parse annotations on variable declaration in when subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
091b935c2d Introduce separate callee expression for when with subject variable
'Subject.Error' is redundant.
'Subject.None' can be an object.
'Subject#dataFlowValue' can be a lateinit property.

TODO: fix
- parsing local extension properties in 'when' subject
- parsing destructuring declarations in 'when' subject
- non-completed calls in nested 'when' with subject variable
- non-completed calls for subject variable in 'in' pattern
2018-06-20 14:06:34 +03:00
Dmitry Petrov
a76bf57694 Minor: remove redundant cast 2018-06-20 14:06:34 +03:00
Dmitry Petrov
5f0c9490bb Add test for smart cast on a value bound to when subject variable
E.g.:
  when (val y = x?.foo()) {
    null -> ...
    else -> ... // 'x' is also non-null here
  }
2018-06-20 14:06:34 +03:00
Dmitry Petrov
0a0bc67e8a Add test for UNUSED_VALUE on when subject variable 2018-06-20 14:06:34 +03:00
Dmitry Petrov
c20c1abb68 Add test for VAL_REASSIGNMENT on when subject variable 2018-06-20 14:06:34 +03:00
Dmitry Petrov
f6d446da47 It's ok to have no subject expression 2018-06-20 14:06:34 +03:00
Dmitry Petrov
7bc89b8871 Report error on illegal variable declaration in when subject 2018-06-20 14:06:34 +03:00
Dmitry Petrov
4fe894c03d Minor: extract variable subject processing to a separate fun 2018-06-20 14:06:34 +03:00
Dmitry Petrov
098d3eb235 Make smart casts work with variable declared in when subject 2018-06-20 14:06:34 +03:00
Dmitry Petrov
1eeafc2d0e Resolve variable declaration in 'when' subject 2018-06-20 14:06:34 +03:00
Toshiaki Kameyama
84e49e5b57 JS: Fix ClassCastException that occurs when 'when' clause has map range #KT-23458 Fixed 2018-06-20 14:00:29 +03:00
Toshiaki Kameyama
65ba57bcae JS: Fix TranslationRuntimeException on 'for (x in ("a"))' #KT-22376 Fixed 2018-06-20 13:59:10 +03:00
cobr123
db3c9962a2 Updates ReadMe.md JS issue link
{Backend. JS} instead {Back-end. JavaScript}
2018-06-20 12:51:10 +03:00
Dmitry Savvinov
9c61f65c0f Support internal compiler flags (-XX) in facets importing 2018-06-20 12:40:11 +03:00
Dmitry Savvinov
3fdfb49ac6 Minor: reformat and clean-up facetUtils.kt 2018-06-20 12:40:11 +03:00
Egor Neliuba
4fd076e4f4 Fix typo in DefaultErrorMessagesAndroid
"Delegating 'Parcelable' is now allowed" -> "Delegating 'Parcelable' is not allowed"
2018-06-20 01:04:30 +03:00
Yan Zhulanow
83ec49db31 Pill: Ignore kotlin-scripting compiler plugin from compiler arguments 2018-06-20 01:00:25 +03:00
Vyacheslav Gerasimov
fa56afca08 as31: Revert unintended changes in plugin.xml.as31 2018-06-19 21:35:26 +03:00
Vyacheslav Gerasimov
ea98a892d2 as31: Set until-build to 173.* instead of last AS 3.1 version (173.4301.25)
Was 173.4301.25 because of early builds of AS 3.2 which were 173 based
2018-06-19 21:05:58 +03:00
Vyacheslav Gerasimov
fa2eafe214 as31: Update AS to 3.1.3.0 2018-06-19 21:05:57 +03:00
Mikhail Zarechenskiy
fcacdc1fc5 Fix bridge methods generation when inline class types are used 2018-06-19 20:09:35 +03:00
Mikhail Zarechenskiy
f326fd66be Propagate KotlinType into if expression codegen for inline classes 2018-06-19 19:54:22 +03:00
Mikhail Zarechenskiy
c8c943e5fe [NI] Use context for relevant nested call to run call checkers
#KT-24808 Fixed
2018-06-19 19:54:21 +03:00
Roman Artemev
f69bd54d6c [JS IR BE] Update test data 2018-06-19 17:09:31 +03:00
Roman Artemev
02628e8de3 [JS IR BE] Support exceptions in IR BE runtime 2018-06-19 17:09:24 +03:00
Roman Artemev
b65443dd25 [JS IR BE] Support try-catch-finally in new backend 2018-06-19 17:08:14 +03:00
Alexey Tsvetkov
cdfcedb897 Minor: reword progress message
#KT-24936 fixed
2018-06-19 15:43:24 +03:00
Pavel V. Talanov
5063a4ce3d JavaElementFinder: revert to using ContainerUtil.quicksort
Fix comparator contract violated exception
Scopes inherited from LibraryScopeBase violate the comparator contract
2018-06-19 13:40:23 +02:00
Alexander Udalov
e689733f69 Revert "Map Kotlin TYPE target to Java TYPE_USE in bytecode"
This reverts commit d122406dca.

See KT-23857

 #KT-24952 Fixed
2018-06-19 12:08:18 +02:00
Alexander Udalov
863639c9ab Revert changes to data class equals/hashCode (KT-12330)
This looked like a small and useful change, but caused so many issues
(KT-24474, KT-24790, 30b9caea, and another unreported one -- see the
test update in this commit) that it didn't pay off after all. The
optimization is not that critical for now, as it's only relevant for
data classes where component types have trivial equals/hashCode
implementation, which is not very often

 #KT-12330 Declined
2018-06-19 12:05:55 +02:00
Max Medvedev
21ca06dace KT-22333 Extract function: make name editor focused once again 2018-06-19 12:51:18 +03:00
Toshiaki Kameyama
1e31d24e9b Add "Remove 'const'" quickfix for TYPE_CANT_BE_USED_FOR_CONST_VAL
So #KT-24815 Fixed
2018-06-19 12:48:13 +03:00
Toshiaki Kameyama
c344354395 Add quick-fix for 'is' absence in when #KT-18810 Fixed 2018-06-19 12:48:13 +03:00
Toshiaki Kameyama
2427406a8f Add 'Change to val' quickfix for delegates without setValue
So #KT-13688 Fixed
2018-06-19 12:48:13 +03:00
Toshiaki Kameyama
3292137acb "Convert lambda to anonymous function": Don't suggest in inline function
So #KT-24792 Fixed
2018-06-19 12:48:12 +03:00
Toshiaki Kameyama
fa58da85ee Add indices: don't suggest if parameter is destructuring declaration
So #KT-22162 Fixed
2018-06-19 12:48:12 +03:00
Toshiaki Kameyama
752c576e20 Reformat: AddForLoopIndicesIntention 2018-06-19 12:48:12 +03:00
Toshiaki Kameyama
2669193755 Use "Move to companion" quick fix for CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT
So #KT-22871 Fixed
2018-06-19 12:48:12 +03:00
Toshiaki Kameyama
69d2e8898a "Main should return Unit" inspection: extend on JUnit test methods
So #KT-24509 Fixed
2018-06-19 12:48:11 +03:00
Toshiaki Kameyama
b5e3db1811 Lambda to reference: fix false positive for parameter' class reference
So #KT-22041 Fixed
2018-06-19 12:48:11 +03:00
Toshiaki Kameyama
271cbc1dd3 Reformat: ConvertLambdaToReferenceIntention 2018-06-19 12:48:11 +03:00
Mikhail Glukhikh
b87dd07dd1 Redundant companion reference: minor refactoring 2018-06-19 12:48:11 +03:00
Toshiaki Kameyama
5ad98a139d "Redundant Companion": Don't suggest if same callable name is in use
So #KT-24425 Fixed
2018-06-19 12:48:10 +03:00
Alexey Sedunov
a2435ff3b0 Configuration: Add default gradle repository to settings.gradle
#KT-24614 Fixed
2018-06-19 12:22:41 +03:00
Alexey Sedunov
70287ce974 Configuration: Use Android variant as source set name
#KT-24839 Fixed
2018-06-19 12:22:41 +03:00
Alexey Sedunov
9a3a7fbcca Debugger: Dispose ExtractionData/ExtractionResult when necessary
This fixes memory leak due to extensive use of "Evaluate expression"
2018-06-19 12:22:41 +03:00
Alexey Sedunov
16dbc6fb4d Extract Function: Forbid inappropriate declarations inside extractable fragment
#KT-20467 Fixed
 #KT-20469 Fixed
2018-06-19 12:22:40 +03:00
Alexey Sedunov
f7cda61b08 Copy/Paste: Add imports for non-qualifiable callable references
#KT-23407 Fixed
2018-06-19 12:22:40 +03:00
Alexey Sedunov
694997651a Override/Implement: Fix processing of unresolved types
#KT-17350 Fixed
2018-06-19 12:22:40 +03:00
Alexey Sedunov
ed8b4b761a Override/Implement: Add 'actual' modifier to overrides of 'expect'
#KT-23106 Fixed
2018-06-19 12:22:40 +03:00
Alexey Sedunov
5f87e84966 Override/Implement: Do not insert super-call into extension body
Such super-calls are not are supported yet

 #KT-4311 Fixed
2018-06-19 12:22:39 +03:00
Alexey Sedunov
c49eede054 Generate hashCode()/equals(): Support deep array equality
#KT-19102 Fixed
2018-06-19 12:22:39 +03:00
Mikhail Glukhikh
9ef89447b3 Sealed sub-class -> object: handle equals, suggest "add equals"
Before this commit, sealed sub-class without state was considered
a style issue.
After this commit, sealed sub-class without state AND custom equals
is considered a probable bug,
because comparison of its instances is very fragile.
Alternative fix (generate equals & hashCode by identity) is added.
2018-06-19 11:20:26 +03:00
Dmitry Petrov
ecd2709a11 psi2ir: type arguments for function references 2018-06-19 11:13:50 +03:00
Mikhail Glukhikh
84c369dc6c Highlighting settings provider: skip inspections on libraries *only*
This keeps inspection running e.g. in build.gradle.kts scripts
2018-06-19 10:42:37 +03:00
Mikhail Glukhikh
cbec005055 Add test for KT-21710 (gutters inside library sources) 2018-06-19 10:42:36 +03:00
Mikhail Glukhikh
1819878c2b Switch off inspections on Kotlin files not in project source
To switch them off, KotlinDefaultHighlightingSettingsProvider
was introduced.
So #KT-19377 Fixed
2018-06-19 10:42:34 +03:00
Mikhail Glukhikh
ef0eb5cbe9 KotlinProblemHighlightFilter: *perform* highlighting on library sources
This commit reverts fixing commit for KT-19377
So #KT-21710 Fixed
So #KT-19377 Submitted
2018-06-19 10:42:33 +03:00
Mikhail Zarechenskiy
6431934c13 Fix signature mapping for built-in methods inside erased inline class 2018-06-18 18:55:18 +03:00
Mikhail Zarechenskiy
8503194e0d Temporarily mute test for JS target 2018-06-18 18:36:36 +03:00
Nikolay Krasko
0f88565b93 Auto-add pattern for running inner tests in Gradle (KT-24961)
Since Gradle 4.7 there's a more strict pattern check. Simple include
trick doesn't work anymore.

Probably modification of TestSelectionMatcher.java in
c2067eaa12 (diff-e92afe807d7ea74cc9ab0dcef30efc93)
is responsible for the new behaviour.

 #KT-24961 Fixed
2018-06-18 17:18:43 +03:00
Nikolay Krasko
1f2d6da770 Minor: fix formatting and warnings in tasks.kt 2018-06-18 17:18:38 +03:00
Alexander Udalov
f6169337dd Use kotlinx-metadata-jvm to relocate .kotlin_module files in kotlin-reflect
Instead of custom logic which used compiler internals and was very
brittle
2018-06-18 12:35:06 +02:00
Anton Bannykh
14dfb6bd99 JS: install -> npmInstall (collides with maven tasks) 2018-06-18 13:32:59 +03:00
Anton Bannykh
b551afb202 JS IR: minor fix for callable ref translation
The caching variable has to have no initializers so that there is no
dependence on evaluation order.
2018-06-18 13:15:19 +03:00
Anton Bannykh
43e3314255 JS IR: Remove inline functions with reified type parameters
Otherwise we cannot handle type casts
2018-06-18 13:15:19 +03:00
Anton Bannykh
3808d77bf4 JS IR: inliner 2018-06-18 13:15:19 +03:00
Anton Bannykh
d938c91711 JS IR: top-level initializer lowering 2018-06-18 13:15:19 +03:00
Mikhail Zarechenskiy
c5160a6a95 Don't use methods from super interface if call was on inline class type
Some methods (like `size` from kotlin.collections.Collection) have
 special rules for mapping and overriding. For example, when we call
 `size`, normally there will be `INVOKEVIRTUAL size()` in the bytecode,
 but for inline classes it should be `INVOKESTATIC ...$Erased.getSize()`
2018-06-18 12:35:31 +03:00
Mikhail Zarechenskiy
246d5e294c Fix bytecode optimisations for consequent boxing 2018-06-18 11:52:37 +03:00
Mikhail Zarechenskiy
01d9be65bc Perform bytecode optimisations for inline classes
#KT-23742 Fixed
2018-06-18 11:52:36 +03:00
Mikhail Zarechenskiy
7465289811 Introduce jvm backend class resolver to resolve asm types
Original author is @dnpetrov
2018-06-18 11:52:34 +03:00
Mikhail Zarechenskiy
5bdd7bca65 Pass GenerationState to OptimizationMethodVisitor
Original author is @dnpetrov
2018-06-18 11:52:32 +03:00
Mikhail Zarechenskiy
605cdcd8d8 Allow to use inline classes in 1.3 with warning 2018-06-18 11:52:31 +03:00
Mikhail Zarechenskiy
6db07f71f3 Check feature dependencies targets before report diagnostics
For example, if inline classes feature would have state `ENABLED_WITH_WARNING`,
 then corresponding warning will be reported on inline functions too
2018-06-18 11:52:29 +03:00
Nikolay Krasko
423e8f9979 Depend on jre8 kotlin stdlib in idea
Use jre artifact for now because of KT-24730.
2018-06-16 01:19:15 +03:00
Natalia Selezneva
077554c438 Use field access instead of setter in clone method of KtCodeFragment
Fix EA-120381
2018-06-16 00:01:29 +03:00
Alexander Udalov
a9974a522e Use correct class loader in kotlinx-metadata to load MetadataExtensions implementations
By default, ServiceLoader.load uses thread context class loader, which
can differ from the MetadataExtensions' class loader (which also loads
JvmMetadataExtensions, since they're in the same .jar) in many cases,
for example when used in annotation processing

 #KT-24881 Fixed
2018-06-15 19:35:39 +02:00
Alexander Udalov
28da071ff6 Remove usages of deprecated ClsCustomNavigationPolicy
#KT-24891 Fixed
2018-06-15 18:58:15 +02:00
Nikolay Krasko
ea3c4fd451 Run single test after Gradle 4.7 update 2018-06-15 18:06:20 +03:00
Roman Artemev
960fba3c4e Fix test failures 2018-06-15 16:23:06 +03:00
Nikolay Krasko
e37cbe51d2 Remove outdated runtime notification
#KT-23122 Fixed
 #KT-21634 Fixed
 #KT-20324 Fixed
 #KT-18366 Fixed
 #KT-20910 Fixed

Outdated runtime notification was abandoned.
2018-06-15 16:13:17 +03:00
Ilmir Usmanov
192f311128 Minor. Ignore test is JS_IR. 2018-06-15 15:43:56 +03:00
Alexander Udalov
9bf2d129ee Improve exception message when failing to serialize anonymous object metadata
(See KT-20996)

Old message:

    Cannot get FQ name of local class: class <no name provided>

New message:

    Cannot get FQ name of local class: class <no name provided> defined in private fun x(): <no name provided> defined in root package in file 1.kt
2018-06-15 13:26:44 +02:00
Ilya Chernikov
29adf09b7e Add test with other annotation, tests fix of #KT-2496 2018-06-15 12:01:49 +02:00
Rodrigo B. de Oliveira
e24a9d08f2 Only collect annotations with a name starting with KotlinScript 2018-06-15 11:53:49 +02:00
Natalia Selezneva
0adfa7b038 182: Converting J2K: save file path before conversion to use it in commit dialog
^KT-9945 Fixed
2018-06-14 21:33:11 +03:00
Natalia Selezneva
adfa7a2418 Create new module with dependency on IDEA Git plugin 2018-06-14 21:33:10 +03:00
Roman Artemev
dbb360555c [JS IR BE] Fix logic boolean operations 2018-06-14 19:54:35 +03:00
Roman Artemev
6ac4fd2e5f [JS IR BE] Update test data 2018-06-14 19:54:30 +03:00
Roman Artemev
17d71f1e46 [JS IR BE] Implement type check
* IrTypeOperator lowering
 * runtime support
 * refactoring
2018-06-14 18:40:06 +03:00
Alexander Udalov
50eda3b8a0 Make metadata writers' properties protected
These properties are only supposed to be used from Writer classes in
KotlinClassMetadata
2018-06-14 17:19:08 +02:00
Alexander Udalov
fec2c14ea5 Support local delegated properties in kotlinx-metadata-jvm 2018-06-14 17:19:08 +02:00
Alexander Udalov
b00f765255 Pass whole ReadContext/WriteContext to kotlinx-metadata extensions 2018-06-14 17:19:08 +02:00
Anton Bannykh
05123c13f8 [JS IR BE] mute ranges' tests 2018-06-14 18:17:43 +03:00
Mikhail Glukhikh
cbcd35e2f5 Implement Kotlin sub-classes tooltip to handle MPP correctly
Before this commit, Java tooltip was in use which could not
work correctly with expect / actual classes
So #KT-21011 Fixed
2018-06-14 15:42:37 +03:00
Mikhail Glukhikh
90b6f369e0 Module-specific list cell renderer: wrap into runReadAction
This should fix KotlinGoto*ModuleTestGenerated.testExpectClassSuperclass
and related exception in IDEA
Additional fix for KT-23685
2018-06-14 13:55:31 +03:00
Mikhail Glukhikh
3d4b407d0c MPP wizard: introduce structure: root <- common <- js / jvm
This commit also removes deprecated structure with common root
So #KT-20554 Fixed
2018-06-14 13:14:45 +03:00
Ilya Chernikov
cf294b57f0 Update changelog with changes in 1.2.50 2018-06-14 12:02:40 +02:00
Alexander Udalov
5d76e463d3 Fix exception from reflection on local delegated properties
The problem was that in JvmSerializerExtension.writeLocalProperties, we
only serialized metadata for local properties, but indices generated in
MemberCodegen.generatePropertyMetadataArrayFieldIfNeeded were among all
delegated properties in the class (not only local). This behaved
incorrectly as long as there was a local and a non-local delegated
property in the same class. For example, if there were 5 non-local
properties and then one local, that local property would get the index 5
and the synthetic signature "<v#5>". But there would only be one
Property entry in the metadata, and so reflection would fail here trying
to load the 5th element of the list which contains only one element.

Now, the index for a local delegated property is computed only as the
number of _local_ delegated properties above it in the class, i.e. the
first local delegated property gets index 0 (and synthetic signature
"<v#0>"), the next one -- index 1, and so on.

 #KT-23413 Fixed
2018-06-14 11:07:26 +02:00
Alexander Udalov
b8722ad213 Fail with KotlinReflectionInternalError on non-found local delegated property
Instead of IndexOutOfBoundsException from the protobuf internals which
was thrown when loading extension with a non-existing index out of the
list of all extensions (KT-23413)
2018-06-14 11:07:26 +02:00
Pavel V. Talanov
2d7df21b0f JavaElementFinder: fix classes not being sorted as intended
This is tested by `whole project` inspection tests

 #KT-24704 Fixed
2018-06-14 10:51:13 +02:00
Vyacheslav Gerasimov
aae0f5123e Build: Specify metadata source for ivy repositories
Otherwise composite build with Kotlin Native fails unable to resolve metadata files
2018-06-13 20:43:16 +03:00
Vyacheslav Gerasimov
992a31af88 Build: introduce javaPluginConvention extension on project
`ExtensionAware.the<T>()` introduced in gradle 4.7 made existing calls `the<JavaPluginConvention>()` invalid (on wrong receiver)
2018-06-13 19:43:03 +03:00
Vyacheslav Gerasimov
94c636adc3 Build: Fix usage of jvmArgs which became nullable 2018-06-13 19:43:03 +03:00
Vyacheslav Gerasimov
4b3a989b90 Build: Workaround IndexOutOfBoundsException on configuration with gradle 4.7
Using delegated property syntax somehow causes IndexOutOfBoundsException from kotlin-reflect, needs further investigation

Should be reverted after #KT-23413 is resolved
2018-06-13 19:43:03 +03:00
Ilya Gorbunov
0065a74c7e Update to gradle 4.7, fix nullability issue in buildSrc
JavaExec args list is nullable now, so use orEmpty before copying it.
2018-06-13 19:43:03 +03:00
Mikhail Glukhikh
37124e0c0d Make collectSlowLineMarker handle parents to deal with changes correctly
So #KT-20825 Fixed
So #KT-21113 Fixed
Related to IDEA-141330 fix
2018-06-13 19:23:41 +03:00
Mikhail Glukhikh
232d340118 Expect/actual companion object: set gutter on leaf element
May fix KT-21113
2018-06-13 19:23:40 +03:00
Mikhail Glukhikh
0a2ed054f1 Add module-specific cell renderers to navigate to actuals correctly
So #KT-23685 Fixed
2018-06-13 19:23:39 +03:00
Mikhail Glukhikh
efd6b7a035 KotlinGotoTargetRenderProvider: .java -> .kt 2018-06-13 19:23:38 +03:00
Mikhail Glukhikh
ab32a9a564 Minor enhancement of "actual" gutter
This makes hint about Ctrl+Alt+B available
2018-06-13 19:23:37 +03:00
Mikhail Glukhikh
f139847e47 Cleanup: KotlinLineMarkerProvider 2018-06-13 19:23:36 +03:00
Mikhail Glukhikh
cfd1a54463 Do not create expect / actual gutters for primary constructor
So #KT-22177 Fixed
So #KT-21063 Obsolete
2018-06-13 19:19:26 +03:00
Mikhail Glukhikh
b235af0656 Can be private: correct detection of calls inside inline accessors 2018-06-13 19:17:50 +03:00
Mikhail Glukhikh
542f0a61d1 Unused receiver: optimization 2018-06-13 18:12:37 +03:00
Mikhail Glukhikh
faa8d92560 Unused receiver: do not report on actual declarations #KT-24562 Fixed 2018-06-13 18:12:36 +03:00
Mikhail Glukhikh
38632c2937 Can be private: correct detection of calls inside inline function
So #KT-22180 Fixed
So #KT-22094 Fixed
2018-06-13 18:12:34 +03:00
Mikhail Glukhikh
a8737a1278 Can be private -> could be private (violation of naming convention) 2018-06-13 18:12:33 +03:00
Mikhail Glukhikh
88974ee32b Can be private: simplification
Related to KT-22030
2018-06-13 18:12:31 +03:00
Toshiaki Kameyama
7786896e9b Can be private: don't report when object or subclass calls the function
Questionable
So #KT-22030 Fixed
2018-06-13 18:12:30 +03:00
Mikhail Glukhikh
6c8276b701 Do not report "can be private" on annotated declarations #KT-24422 Fixed 2018-06-13 18:12:28 +03:00
Mikhail Glukhikh
d1155070a7 Do not report "can be private" on expect or actual declarations
So #KT-24374 Fixed
So #KT-24537 Fixed
2018-06-13 18:12:27 +03:00
Mikhail Glukhikh
11acea51b7 Reformat: can be private inspection 2018-06-13 18:12:25 +03:00
Mikhail Glukhikh
a09f6e14a5 Do not suggest "convert to object" for sealed sub-classes with state
So #KT-24816 Fixed
2018-06-13 18:12:18 +03:00
Alexander Udalov
813d7fcb6a Fix bytecode for equals/hashCode of data classes once again
#KT-24790 Fixed
2018-06-13 16:06:20 +02:00
Alexander Udalov
8749bd901b Fix MalformedParameterizedTypeException on classes from kotlin-reflect
This allows GraalVM's `native-image` to work correctly on
kotlin-reflect.jar. The size of the artifact has increased only by 66
bytes

 #KT-23962 Fixed
2018-06-13 16:01:34 +02:00
Alexander Gorshenev
6d7dd58f70 Separated idl2k frontend and backend invocations. 2018-06-13 15:45:54 +03:00
Ilmir Usmanov
6b777356e8 Add test with java reflection 2018-06-13 15:08:32 +03:00
Ilmir Usmanov
de7aa23119 Make private inline suspend functions effectively inline-only 2018-06-13 15:08:26 +03:00
Ilmir Usmanov
8a5ae16947 Generate separate methods for inline and noinline uses of inline suspend functions
Previously, inline suspend functions were effectively inline only,
but ordinary inline functions can be used as noinline.
To fix the issue, I generate two functions: one for inline with suffix
$$forInline and without state machine; and the other one without any
suffix and state machine for direct calls.
This change does not affect effectively inline only suspend functions,
i.e. functions with reified generics, annotated with @InlineOnly
annotation and functions with crossinline parameters.
 #KT-20219: Fixed
2018-06-13 15:08:19 +03:00
Alexander Udalov
bb4972b00e Regenerate tests 2018-06-12 14:01:33 +02:00
Alexander Udalov
fab45365c9 Update .idea/misc.xml for IDEA 2018.2 2018-06-12 14:01:33 +02:00
Nicolay Mitropolsky
79487a6a21 KotlinLanguageInjector: injecting into returned literals (#KT-21673) 2018-06-09 22:56:25 +03:00
Anton Bannykh
675d02093d mute new test + regenerate tests 2018-06-09 19:59:19 +03:00
Anton Bannykh
5fdc304a51 JS_IR: mute coroutine tests 2018-06-09 19:15:38 +03:00
Anton Bannykh
96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Anton Bannykh
7e1713af44 Tests: keep "// !" directives first when auto-muting box tests 2018-06-09 19:15:38 +03:00
Anton Bannykh
1e169b0838 JS_IR: add common codegen box tests (same as for old backend) 2018-06-09 19:15:38 +03:00
Vyacheslav Gerasimov
7fb2452dba 182: Fix toNullability clash in j2k 2018-06-09 16:51:24 +03:00
Vyacheslav Gerasimov
411afb0303 182: Suppress compiler proguard warnings from intellij-core dependencies 2018-06-09 14:45:55 +03:00
Vyacheslav Gerasimov
272f8b832b 182: Set since build to 182.3040 2018-06-09 14:44:50 +03:00
Yan Zhulanow
e57463e5fd 182: Fix compatibility with the Android plugin from AS 3.1
(cherry picked from commit 0592121)
2018-06-09 14:44:50 +03:00
Vyacheslav Gerasimov
4dbcb2e50e 182: Switch 182 to SNAPSHOT builds (until next EAP)
Android plugin 3.1 is merged to IJ 182, we need to provide compatible plugin
2018-06-09 14:44:50 +03:00
Ростов Сергей
d9c9e6ef0a jps, mpp: fix GenerateTests.kt.172 2018-06-09 11:18:55 +03:00
Yan Zhulanow
3df6d63580 Minor: Fix compilation after unsuccessful rebase. Add back the isMultiplatformModule() method 2018-06-09 00:19:17 +03:00
Yan Zhulanow
3ec33f4193 Debugger: Evaluate expression in MPP common module: @JvmName is unresolved (KT-23162) 2018-06-08 19:37:47 +03:00
Yan Zhulanow
e334f693b2 Minor: Do not place line markers in code fragments and in non-Kotlin files 2018-06-08 19:37:47 +03:00
Yan Zhulanow
ab5614eaac Minor: Replace a number of trivial Guava usages with constructor calls and kotlin-stdlib function calls 2018-06-08 19:37:47 +03:00
Yan Zhulanow
61ffde54fd Minor: Remove unneeded bunch file 2018-06-08 19:37:21 +03:00
Yan Zhulanow
ed43cb57e3 PrePush: Add a pre-push warning before committing to locked branches 2018-06-08 19:37:21 +03:00
Yan Zhulanow
bf10c1162a Kapt: Fix Gradle input/output verification 2018-06-08 19:37:21 +03:00
Yan Zhulanow
8645be3ace Kapt: Remove the remaining kapt1-related code in Gradle plugin 2018-06-08 19:37:20 +03:00
Yan Zhulanow
5f43808cfd Revert "Debugger: Fix breakpoints and stepping for inline-only function lambda arguments (#KT-23064)" 2018-06-08 19:37:20 +03:00
Yan Zhulanow
d851c8679a Fix a number of potential exceptions in debugger (EA-119717) 2018-06-08 19:37:20 +03:00
Yan Zhulanow
0f15dfdfdc Handle AbsentInformationException correctly (EA-119717) 2018-06-08 19:37:20 +03:00
Yan Zhulanow
4dfcb72fa1 Print source file location/contents if possible (EA-120038) 2018-06-08 19:37:20 +03:00
Yan Zhulanow
fc6057e34f Fix NPE in DelegateSourcePosition (EA-120042) 2018-06-08 19:37:20 +03:00
Yan Zhulanow
d08dcb9f0f Add missing read action in debugger (EA-120163) 2018-06-08 19:37:20 +03:00
Yan Zhulanow
93d668ad63 Support types without backing ClassLoader in 'safeArgumentTypes()' (EA-120387) 2018-06-08 19:37:19 +03:00
Yan Zhulanow
64ea16fdfc Kapt: Allow running kapt using Workers API in Gradle 2018-06-08 19:37:19 +03:00
Yan Zhulanow
2bc45e0484 Kapt: Extract annotation processing running logic from the compiler plugin 2018-06-08 19:37:19 +03:00
Yan Zhulanow
3ecf355e7a Kapt: Leave getBasePath() in ProGuard-ed kotlinc 2018-06-08 19:37:19 +03:00
Yan Zhulanow
eb4492394e Kapt: Fix compatibility with Java 9
1. Move option set up to one place, before using any of Java context components;
2. Set Javac file manager options (new to Java 9)
2018-06-08 19:37:19 +03:00
Yan Zhulanow
386f05bb91 Fix "Run" action for Kotlin sources in non-Android modules 2018-06-08 19:37:18 +03:00
Yan Zhulanow
ab611a20c5 Kapt: Do now show a warning for APs from 'annotationProcessor' configuration also declared in 'kapt' configuration (#KT-23898) 2018-06-08 19:27:00 +03:00
Yan Zhulanow
e1d22b8515 MPP: Fix implemented modules importing in Android projects (#KT-23697) 2018-06-08 19:27:00 +03:00
Yan Zhulanow
614003ad70 Android Extensions: Allow to disable specific features of Android Extensions (#KT-23244) 2018-06-08 19:26:59 +03:00
Yan Zhulanow
a70707b72b Android Extensions: Allow to access library project resources in Gradle setup (#KT-22430) 2018-06-08 19:26:59 +03:00
Yan Zhulanow
5eedbf4177 G2K: Rewrite AndroidGradleWrapper in Kotlin 2018-06-08 19:26:59 +03:00
Yan Zhulanow
9aa02c7ae4 G2K: Move AndroidGradleWrapper to the Kotlin source set, rename to .kt 2018-06-08 19:26:59 +03:00
Mikhail Zarechenskiy
d29f3fc3c5 Add test to check work of inline classes with callable references 2018-06-08 19:14:41 +03:00
Mikhail Zarechenskiy
8148bdc4d0 Support inline classes in MPP resolver/checker model 2018-06-08 19:13:39 +03:00
Alexander Podkhalyuzin
3d57276bc6 Fixed Readme about Gradle Test Runner 2018-06-08 18:44:25 +03:00
Denis Zharkov
01a2330a70 Avoid retaining protobuf package within DeserializedPackageFragmentImpl
It's only used for DeserializedPackageMemberScope that's being created
during initialization

At the same time, protobuf objects may be not very light-weight
(see 2e933a165a)

 #KT-24513 Fixed
2018-06-08 17:49:40 +03:00
Denis Zharkov
0a3e8fbe66 Pull down some implementation details from DeserializedPackageFragment
- DeserializedPackageFragmentImpl doesn't actually need member scope to be lazy
in a sense of optimization. It was only necessary for breaking
initialization cycle: DeserializationComponents <-> DeserializedPackageFragment
- For MetadataPackageFragment it might be useful to have
member scope actually lazy since it has O(n) complexity when n is a number
of package parts

This change is helpful for avoidance of storing reference to package-proto

 #KT-24513 In Progress
2018-06-08 17:49:40 +03:00
Nikolay Krasko
99b44faf5a Add information about bunch files to ReadMe 2018-06-08 17:11:16 +03:00
Alexey Sedunov
fc5a0b6768 Misc: Fix compilation of KotlinAwareJavaGetterRenameProcessor in 172 2018-06-08 16:01:40 +03:00
Vyacheslav Gerasimov
020d941c27 Fix test compilation for AS branches
There is no devkit is AS
2018-06-08 15:26:47 +03:00
Nikolay Krasko
88bbeae270 Make Tools->Kotlin be visible in dumb mode (KT-12075)
Kotlin update check works fine in dumb mode already.

 #KT-12075 Fixed
2018-06-08 14:44:08 +03:00
Nikolay Krasko
19eaf9289b Reformat: KotlinPluginUpdater.kt 2018-06-08 14:44:07 +03:00
Nikolay Krasko
f797592365 Minor: leave bunch directive for 173-specific code 2018-06-08 14:44:07 +03:00
Nikolay Krasko
f8d352c3d0 Fix auto-indent for when entry (KT-24743)
#KT-24743 Fixed
2018-06-08 14:44:07 +03:00
Nikolay Krasko
cd54c7922d Fix lambda return hint for labeled expressions (KT-24828)
#KT-24828 Fixed
2018-06-08 14:44:07 +03:00
Nikolay Krasko
076870ee05 Fix double return hint in lambda for annotated expression (KT-23238)
#KT-23238 Fixed
2018-06-08 14:44:06 +03:00
Nikolay Krasko
c5d5f0c2e2 Minor: reformat LambdaReturnValueHints.kt 2018-06-08 14:44:06 +03:00
Nikolay Krasko
9fbb7c5d14 Reformat: search\ideaExtensions package 2018-06-08 14:44:06 +03:00
Dmitry Savvinov
6d29e14a33 Improve message for serialization crash in JavaClassTrackerImpl 2018-06-08 14:38:44 +03:00
Alexey Sedunov
0ea1784d33 Introduce Parameter: Add suspend to lambdas with nested suspend-calls
#KT-24712 Fixed
2018-06-08 14:34:23 +03:00
Alexey Sedunov
8a838ab5bb Change Signature: Fix parameter name for kt-function overriding Java's
#KT-24763 Fixed
2018-06-08 14:34:23 +03:00
Alexey Sedunov
8978c4b9e8 Rename: Fix processing of references to synthetic Java properties
#KT-17742 Fixed
2018-06-08 14:34:23 +03:00
Alexey Sedunov
862dc76ed9 Rename: Fix processing of overriding methods with mangled names
#KT-24460 Fixed
2018-06-08 14:34:22 +03:00
Alexey Sedunov
eea9113d1c Introduce Type Alias: Fix replacement of references to nested classes
#KT-15159 Fixed
2018-06-08 14:34:22 +03:00
Alexey Sedunov
3902e1b51d Run: Add browse button to Kotlin "main" run configuration editor
#KT-17668 Fixed
2018-06-08 14:34:22 +03:00
Alexey Sedunov
8a09dcf821 Configuration: Update settings.gradle without loading its PSI
Otherwise dumb-mode problems may happen in latest builds of 182

 #KT-24667 Fixed
2018-06-08 14:34:22 +03:00
Sergey Rostov
c71357dd76 173: jps, mpp: fix AbstractIncrementalJpsTest.kt.173 2018-06-08 13:50:05 +03:00
Mikhael Bogdanov
a0060dd25b Generate synthetic method for @JvmDefault properties in DefaultImpls 2018-06-08 10:08:23 +02:00
Sergey Rostov
5455b6c0c0 jps: add common source roots to the final platform modules as a workaround for absence of incremental k2metadata compiler 2018-06-08 09:46:56 +03:00
Sergey Rostov
e0d44ecb90 jps, daemon: pass incremental compilation flag from jps process to daemon (fix) 2018-06-08 09:46:55 +03:00
Sergey Rostov
f86c6db4bf Idea gradle: proper support for composite MPP projects
(cherry picked from commit ca841f0)

#KT-24748 fixed
2018-06-08 09:46:54 +03:00
Sergey Rostov
80ed963f97 jps, daemon: (minor) formatting 2018-06-08 09:46:53 +03:00
Sergey Rostov
e831964871 jps, daemon: pass incremental compilation flag from jps process to daemon 2018-06-08 09:46:52 +03:00
Sergey Rostov
ce96c1b9a8 jps, daemon: fix javascript inline functions tracking
inline function hash should computed after compilation
2018-06-08 09:46:50 +03:00
Sergey Rostov
5a2ed364fe jps: checkCachesVersions for js and common (BuildMetaInfo save/check) 2018-06-08 09:46:49 +03:00
Sergey Rostov
3cfb200e07 jps: improve KotlinDirtySourceFilesHolder 2018-06-08 09:46:48 +03:00
Sergey Rostov
b5acb83325 jps: (minor) fix java module detection 2018-06-08 09:46:47 +03:00
Sergey Rostov
5478a552ed jps, js: Fix exception on rebuild js module 2018-06-08 09:46:46 +03:00
Sergey Rostov
d75a2be31b jps: Don't create cache for common modules (KOTLIN-CR-2028) 2018-06-08 09:46:45 +03:00
Sergey Rostov
c24aa13f12 jps: fixes for KOTLIN-CR-2028 2018-06-08 09:46:44 +03:00
Sergey Rostov
c2d87140ec jps, daemon: fix JsFunction.toString() serialization 2018-06-08 09:46:43 +03:00
Sergey Rostov
40b9fa88b7 jps: fix mergedCompilerArguments getter (mergedCompilerArguments) 2018-06-08 09:46:42 +03:00
Sergey Rostov
1cbef873ec jps: implement mpp and js daemon compiler services
#KT-24635 fixed
2018-06-08 09:46:41 +03:00
Sergey Rostov
b2fedd7b1e jps, mpp: fix marking expect/actual complementary files as dirty
This files should be marked as dirty for current round, not next
2018-06-08 09:46:40 +03:00
Sergey Rostov
65bdfa72c1 jps: support KotlinSourceRootType
KotlinSourceRootType will added with KotlinSourceRootProvider (ex KotlinMppCommonSourceRootProvider).
New target type (with computeAllTargets) is not possible because ModuleBuildTarget is final.

#KT-24506 fixed
2018-06-08 09:46:39 +03:00
Sergey Rostov
b2f58ad9c3 jps, mpp: temporary disable mpp tests 2018-06-08 09:46:38 +03:00
Sergey Rostov
0eee2729cd jps: support multiplatform incremental compilation for jvm and js
- support common modules metadata compilation under flag (it is not required since all common source roots are included transitively for now)
- introduce expect actual tracker in jps: move implementation from gradle to build-common
- support js incremental compilation: move implementation from gradle to build-common
2018-06-08 09:46:37 +03:00
Sergey Rostov
4a6554a36d multiplatform: remove MultiplatformGradleProjectTaskRunner
JPS is now able to build multiplatform projects, so build/run actions should be delegated to gradle only with "Delegate IDE build/run action actions" setting enabled.
2018-06-08 09:46:36 +03:00
Sergey Rostov
f7695dd039 mpp: Run tests from common modules should recompile correspond JVM implementation module
#KT-23722 Fixed
2018-06-08 09:46:35 +03:00
Ivan Gavrilovic
44482dbe90 Revert access modifier change in android history 2018-06-07 19:10:09 +03:00
Ivan Gavrilovic
728508e0ae Return an error when build history for dir does not exist 2018-06-07 19:10:04 +03:00
Ivan Gavrilovic
6bb54fd9a3 Support fetching build history files from directories for Android
Android Gradle plugin will start publishing clases in directories.
This commit adds support to find build history files when changed
files come from directories. It is similar to existing implementation
for jars i.e. it looks for .kotlin_module file under META-INF.

Test: ModulesApiHistoryAndroidTest
2018-06-07 19:10:00 +03:00
Mikhail Zarechenskiy
b2d9015723 Prohibit identity equals on inline class types 2018-06-07 18:22:05 +03:00
Mikhail Zarechenskiy
9891f562cc [NI] Make subtyping algorithm more robust to error types
During subtyping/incorporation we transform types (e.g. changing nullability,
 form of the type) and, basically, we're doing this to some FIXPOINT.
 It's important that we use `KotlinType.hashCode()` to compare types, but
 for error types hashCode is a hashCode of its supertype and, for example,
 `makeNullableAsSpecified` method recreate type every time. So, we continue
 to generate new constraints and we'll never stop incorporation algorithm
2018-06-07 15:45:53 +03:00
Ilya Gorbunov
1ee37b1772 Update ReadMe for stdlib-js 2018-06-07 14:39:48 +03:00
Anton Bannykh
544222167e Update ReadMe.md
js.libraries doesn't exist anymore
2018-06-07 14:11:37 +03:00
Mikhail Zarechenskiy
177d949f75 Advance bootstrap to 1.2.60-dev-544 2018-06-07 13:13:20 +03:00
Svyatoslav Kuzmich
563637548a KJS: Fix loop levels in ContinueReplacingVisitor (KT-24777) 2018-06-07 12:57:36 +03:00
Svyatoslav Kuzmich
2ec8c4aae6 KJS: Label loops in LabeledBlockToDoWhileTransformation
Fix KT-24542: insert labes for affected loops, breaks and continues
statements during LabeledBlockToDoWhileTransformation
2018-06-07 12:57:36 +03:00
Pavel V. Talanov
463d9b690f Minor: rename PsiFile.moduleInfo -> forcedModuleInfo 2018-06-06 21:04:05 +02:00
Pavel V. Talanov
74052542b4 Minor: rename KtFile.targetPlatform -> forcedTargetPlatform
To avoid confusing with platform extension and debugging for 3 hours
2018-06-06 21:04:04 +02:00
Pavel V. Talanov
ced3cf0904 Light classes: fix multifile facades for mpp modules with jvm part
When creating multifile facades respect that facade files can be both
    in common and jvm parts

 #KT-23942 Fixed
2018-06-06 21:04:02 +02:00
Pavel V. Talanov
a8a490ea5a Test multifile facades in mpp projects 2018-06-06 21:04:00 +02:00
Pavel V. Talanov
8185b1bf02 Test accessing file facades from java in mpp project 2018-06-06 21:03:57 +02:00
Pavel V. Talanov
1be477c816 Fix "add member" quick fix when invoked from java on common class
#KT-24115 Fixed
2018-06-06 21:03:56 +02:00
Pavel V. Talanov
9e493d8b73 Mpp tests: allow to test java code in highlighting and quickfix tests 2018-06-06 21:03:55 +02:00
Pavel V. Talanov
0157d7bd5d Mpp utils: remove erroneous cache
Note: can't use Module.cached to calculate data that depends on input
   other than the module itself (isTests in this case)
2018-06-06 21:03:53 +02:00
Pavel V. Talanov
1f957de9d8 Minor: use utils appropriately 2018-06-06 21:03:52 +02:00
Pavel V. Talanov
fa7531f342 Refactor: move and prettify mpp util code 2018-06-06 21:03:51 +02:00
Pavel V. Talanov
05e6c4e0a2 Minor: move utils to more appropriate place 2018-06-06 21:03:50 +02:00
Pavel V. Talanov
e67f449476 Fix exception from kotlin bytecode window on common code
Do not show bytecode window for non-jvm platform modules

 #KT-24159 Fixed
2018-06-06 20:48:18 +02:00
Pavel V. Talanov
d18846201a JavaElementFinder: avoid returning fake light class in findClass*
findClass* are supposed to return a single visible class
    from given scope with given fqname
After sorting FakeFileForLightClass would sometimes be first in the list
    leading to exceptions like KT-24704

  #KT-24704 Fixed
2018-06-06 20:45:41 +02:00
Pavel V. Talanov
86e52f45b1 J2K JavaElementFinder: prettify code 2018-06-06 20:45:41 +02:00
Pavel V. Talanov
6cea843461 J2K JavaElementFinder: autoconvert and fix compilation errors 2018-06-06 20:45:41 +02:00
Pavel V. Talanov
00b1e9281b J2K JavaElementFinder: rename file 2018-06-06 20:45:41 +02:00
Alexey Tsvetkov
451c732b8f Test: speed up tests by minimizing number of tasks to run
E.g. avoid building release variants for Android
(extremely slow due to proguard minification, optimization)
2018-06-06 17:54:51 +03:00
Alexey Tsvetkov
0383584f33 Test: rename file to match class name 2018-06-06 17:54:51 +03:00
Alexey Tsvetkov
0c12b0e5fb Test: refactor Gradle daemon memory test
Currently the test makes more harm than use:
* It is too slow: two executions (with different Gradle versions)
take 5 minute on CI.
* It is unreliable: the test fails on CI for months
with insignificant violation of the memory growth limit.

After this change:
* the memory growth limit is increased;
* the test run count is decreased;
* changes the test to use separate project with minimal amount of classes
(we're not interested in compiler's memory leaks; only Gradle plugin specific ones);
2018-06-06 17:54:51 +03:00
Alexey Tsvetkov
43e7b0425d Test: move Gradle daemon memory test to separate class 2018-06-06 17:54:50 +03:00
Ilya Gorbunov
0f972f2412 Restore default parameter values in JS collection constructors
Even if they now have overloads that will be selected when these parameters are omitted.
This is to preserve compatibility with the libraries compiled against the older library.

#KT-24782 Fixed
2018-06-06 15:32:34 +03:00
Nicolay Mitropolsky
c150878086 172: Uast: testdata fixes 2018-06-06 14:05:31 +03:00
Nicolay Mitropolsky
5c8e4958db Uast: exposing enum constants literal values (#KT-23456) 2018-06-06 14:05:30 +03:00
Nicolay Mitropolsky
12707a6443 Uast: handling resolve to deserialized methods (KT-24679) 2018-06-06 14:05:30 +03:00
Nicolay Mitropolsky
2ede37496c 173: Uast: removing kotlinInternalUastUtils.kt.173
no sense to keep difference
2018-06-06 14:05:30 +03:00
Mikhael Bogdanov
4cf58654b2 Implement toArray lowering 2018-06-06 10:34:51 +02:00
Mikhael Bogdanov
427a8886e4 Reuse new descriptor in bridge lowering 2018-06-06 10:34:51 +02:00
Mikhael Bogdanov
c72a3e08f7 Use field original in ir transformation 2018-06-06 10:34:50 +02:00
Mikhael Bogdanov
a53fa4f6f8 Properly calculate shift for default args in enum constructor call 2018-06-06 10:34:49 +02:00
Roman Artemev
4b8d906e45 Add runtime for JS IR BE 2018-06-05 21:21:18 +03:00
Alexey Tsvetkov
2fecf07dd7 Test: do not expect copy classes task to run with Gradle 4.0+ 2018-06-05 19:27:08 +03:00
Alexey Tsvetkov
141cf43153 Test: remove KotlinGradlePluginMultiVersionIT
We run all tests with multiple Gradle versions now,
so parametrized test is not needed anymore.

Test cases are moved to relevant test classes.

testKaptProcessorPath is removed because kapt1 is not supported anymore.
2018-06-05 19:27:07 +03:00
Alexey Tsvetkov
fdbd3cd8cb Test: remove unsupported Gradle versions from tests 2018-06-05 19:27:07 +03:00
Alexey Tsvetkov
80731437a8 Drop forcing Java task to recompile
We don't support Gradle <= 3.5 at the moment,
it does not make sense to have the code for Gradle < 2.14
2018-06-05 19:27:07 +03:00
Alexey Tsvetkov
0eadc76cb7 Remove unneeded code from Gradle plugin 2018-06-05 19:27:07 +03:00
Alexey Tsvetkov
3dc314d509 Remove com.intellij usages from Gradle plugin 2018-06-05 19:27:07 +03:00
Alexey Tsvetkov
c9e49ed198 Remove unused util 2018-06-05 19:27:07 +03:00
Alexey Tsvetkov
5f2513ee20 Get rid of split package org.jetbrains.kotlin.incremental in Gradle plugin
#KT-18621 fixed
2018-06-05 19:27:07 +03:00
Nicolay Mitropolsky
045cc253ab Uast: KotlinUEnumConstant.returnType now is evaluated from containing сlass
to make it not load additional clsDelegates
2018-06-05 18:00:15 +03:00
Nicolay Mitropolsky
0fb879dfc2 lightAnnotations: KtLightPsiClassObjectAccessExpression added
as implementation of `PsiClassObjectAccessExpression` for class literals in annotations
2018-06-05 18:00:15 +03:00
Mikhail Glukhikh
92727d2945 Downgrade "redundant type check for object" to INFORMATION level 2018-06-05 17:54:30 +03:00
Alexander Podkhalyuzin
116a99ddb8 Fixed Icon link to proper variant 2018-06-05 17:41:47 +03:00
Mikhail Glukhikh
24008cdffb If to when: do not add label to outer loop if not necessary
So #KT-24767 Fixed
2018-06-05 17:02:35 +03:00
Toshiaki Kameyama
b4962a1880 Add getter: don't suggest when property has no type or initializer
So #KT-24632 Fixed
2018-06-05 16:31:28 +03:00
Toshiaki Kameyama
8969e7a6e1 "Remove redundant toString": fix false positive for nested nullable
So #KT-24557 Fixed
2018-06-05 16:03:54 +03:00
Toshiaki Kameyama
4038d4d507 Explicit this inspection: suggest also for synthetic Java property
So #KT-22089 Fixed
2018-06-05 15:52:16 +03:00
Toshiaki Kameyama
6b37e40f99 Add quick-fix for type variance conflict #KT-23082 Fixed 2018-06-05 15:45:53 +03:00
Toshiaki Kameyama
ddf647ae96 Remove redundant receiver in "Change function signature" quick fix
So #KT-12298 Fixed
2018-06-05 15:20:18 +03:00
Toshiaki Kameyama
0cb907d637 Reformat: ChangeMemberFunctionSignatureFix 2018-06-05 15:19:34 +03:00
Toshiaki Kameyama
2c59f96ca4 Introduce "Add remaining when branches" intention #KT-23306 Fixed 2018-06-05 15:19:09 +03:00
Toshiaki Kameyama
bde9a57c9e Don't suggest map{}.filterNotNull() -> mapNotNull{} on primitive array
So #KT-21556 Fixed
2018-06-05 15:18:28 +03:00
Toshiaki Kameyama
e770aed084 Don't suggest "Remove variable" for property with function initializer
So #KT-23752 Fixed
2018-06-05 15:17:14 +03:00
Dmitry Savvinov
b8f8802cff Parse compiler arguments and configure LV properly in Platform.kt 2018-06-05 14:51:35 +03:00
Dmitry Savvinov
5f819b589c Minor: refactor Platform.kt 2018-06-05 14:51:35 +03:00
Mikhail Zarechenskiy
04c13aeae8 [NI] Fix exception on capturing type with inner typealiased typed 2018-06-05 14:05:50 +03:00
Alexander Podkhalyuzin
4883fbfd23 Fixed link to error icon in IDEA 2018.2
#KT-24736 Fixed
2018-06-05 11:00:55 +03:00
Alexander Podkhalyuzin
73ec82e544 Better description of Kotlin plugin
#KT-13948 Fixed
2018-06-05 11:00:09 +03:00
Mikhail Zarechenskiy
4893e466ac Skip test for javac diagnostics
There are problems with sharing the same `txt` file when using custom
 declarations from `kotlin` package
2018-06-05 10:41:44 +03:00
Natalia Selezneva
62929ba6f5 Fix AE in scratch for long lines
^KT-24638 Fixed
2018-06-05 08:41:17 +03:00
Natalia Selezneva
ccacf1bd23 Replace SLRUMap with ConcurrentHashMap
^KT-24645 Fixed
2018-06-05 08:41:17 +03:00
Natalia Selezneva
4767757991 Change the message in the 'new script dependencies' notification 2018-06-05 08:41:17 +03:00
Mikhail Zarechenskiy
ce7f010673 Fix wrong test data 2018-06-04 21:59:03 +03:00
Alexey Sedunov
0f80dd4ecf Navigation: Use local search scope for top-level properties in script
#KT-20465 Fixed
2018-06-04 20:17:44 +03:00
Alexey Sedunov
0110f66529 Project View: Show script declarations in "Show members" mode 2018-06-04 20:17:44 +03:00
Alexey Sedunov
3c267b206b Move: Fix exception on moving top-level declaration from/to script file
#KT-20260 Fixed
2018-06-04 20:17:43 +03:00
Alexey Sedunov
c63854948b Configuration: Fix Kotlin SDK existence check on facet configuration
AS3.1/AS3.2
2018-06-04 20:17:43 +03:00
Alexey Sedunov
24687b18cd Test Support: Support Gradle tests classes with spaces in name
#KT-18319 Fixed
2018-06-04 20:17:43 +03:00
Roman Artemev
90c7d8f485 [JS IR BE] Update test data 2018-06-04 19:31:49 +03:00
Roman Artemev
601f29b781 [JS IR BE] Minor fixes
* Global scope
* Top-level properties
* Refactoring
2018-06-04 19:31:49 +03:00
Roman Artemev
d6d0a7d804 Fix nashorn test runner 2018-06-04 19:31:49 +03:00
Roman Artemev
06a170b05d [JS IR BE] Update test data 2018-06-04 18:59:40 +03:00
Roman Artemev
eeb16a38e8 [JS IR BE] Fix callable reference to make it possible to be bound 2018-06-04 18:59:40 +03:00
Roman Artemev
11c330effd [JS IR BE] Move builder into appropriate package 2018-06-04 18:59:40 +03:00
Roman Artemev
261edd5f4c [JS IR BE] Implement property reference
Add cache for direct (which has no closured parameters) KCallable references
Refactor FunctionReferenceLowering
 * Rename FunctionReferenceLowering -> CallableReferenceLowering
 * Add util method to create value parameters
2018-06-04 18:59:40 +03:00
Mikhail Zarechenskiy
fb1fbf1473 Temporary mute tests on unsigned types for JS backend 2018-06-04 18:37:47 +03:00
Mikhail Zarechenskiy
57ffbd5941 Refactoring: Rename isUnsigned -> isUnsignedNumberLiteral 2018-06-04 18:37:46 +03:00
Mikhail Zarechenskiy
cc19e4cd73 Refactoring: Move blackbox tests about unsigned types to new directory 2018-06-04 18:37:44 +03:00
Mikhail Zarechenskiy
b30b00eedb Configure overload resolution on unsigned types same as for primitives 2018-06-04 18:37:42 +03:00
Mikhail Zarechenskiy
5b5d9dd5a0 Allow unsigned integers overflow values of corresponding signed numbers 2018-06-04 18:37:40 +03:00
Mikhail Zarechenskiy
0da3ae328e Handle case when u-literals are using without unsigned declarations 2018-06-04 18:37:39 +03:00
Mikhail Zarechenskiy
8cd2d2e44c Support WITH_UNSIGNED kind in diagnostics tests, add tests 2018-06-04 18:37:37 +03:00
Mikhail Zarechenskiy
7d5fdb660d Treat number with unsigned literal as UByte & UShort & UInt & ULong 2018-06-04 18:37:36 +03:00
Mikhail Zarechenskiy
656f6cbded Support constant evaluation of unsigned type constructors
#KT-23816 In Progress
2018-06-04 18:37:34 +03:00
Mikhail Zarechenskiy
bf5f710f39 Parse integers with unsigned ('u') suffix 2018-06-04 18:19:34 +03:00
Mikhail Zarechenskiy
e5958d228a Introduce WITH_UNSIGNED directive to use unsigned types in tests 2018-06-04 18:19:30 +03:00
Stanislav Erokhin
8f0b073c08 [NI] Prototype for SAM-conversion.
Supported:
- conversion in resolution parts. Also sam-with-receiver is supported automatically
- separate flag for kotlin function with java SAM as parameters

TODO:
- fix overload conflict error when function type is the same byte origin types is ordered
- consider case when parameter type is T, T <:> Runnable
- support vararg of Runnable

[NI] Turn off synthetic scope with SAM adapter functions if NI enabled
2018-06-04 12:21:56 +03:00
Stanislav Erokhin
4b8e95c243 Minor. Extract preparation for expected type to separate function 2018-06-04 12:21:52 +03:00
Stanislav Erokhin
232d069493 Minor. Use getExpectedType as util function for parameter type calculation
For almost all cases this change do nothing, because if parameter isn't
vararg, then both methods (FlatSignature.argumentValueType &
getExpectedType) return same value. Moreover if it is vararg parameter
and spread operator is not used, then results will be the same.
We can observe difference only when spread operator used
and when we compare two candidates corresponding parameters
for both spread arguments should be vararg parameters.
I.e. old way compares: Int vs String
new way compares: Array<out Int> vs Array<out String>.
2018-06-04 12:21:51 +03:00
Stanislav Erokhin
99e7823352 [NI] Disable test with disabled RefinedSamAdaptersPriority in NI
Such test has no ense in NI because NI it is LV = 1.4 and we cannot
repeat behaviour in 1.3 anyway, so I propose not even support old cases.
Also priority of LANGUAGE directive should be more then key enabled on
all tests -- also fixed.
2018-06-04 12:21:50 +03:00
Stanislav Erokhin
b31d027aed [NI] Report deprecation for function from companion in NI. 2018-06-04 12:21:48 +03:00
Stanislav Erokhin
18b65e7bcf [NI] Update test data 2018-06-04 12:21:47 +03:00
Mikhael Bogdanov
a4c4f048de Support compare for small primitives 2018-06-04 10:50:00 +02:00
Mikhael Bogdanov
340160de65 Don't generate setter accessors for vals 2018-06-04 10:49:59 +02:00
Mikhael Bogdanov
aa8d71f6b9 Support synthetic flag 2018-06-04 10:49:59 +02:00
Mikhael Bogdanov
8767e0924b Support extensions in bridge lowering 2018-06-04 10:49:58 +02:00
Mikhael Bogdanov
5fa54dc854 Fix array constructors coercion type 2018-06-04 10:49:57 +02:00
Mikhael Bogdanov
e58e05f9be Minor. Reformat 2018-06-04 10:49:57 +02:00
Mikhael Bogdanov
50d7e49211 Skip unmapped receiver in inner class lowering 2018-06-04 10:49:56 +02:00
Mikhael Bogdanov
5753f93a57 Support java synthetic properties in DependencyCollector 2018-06-04 10:49:56 +02:00
Alexey Sedunov
8198599ef5 Misc: Eliminate instances of IdeModifiableModelsProviderImpl or dispose them after use 2018-06-04 02:57:54 +03:00
Alexander Podkhalyuzin
e3223ab6d8 Fixed grammar and words in pull request template 2018-06-03 17:01:08 +03:00
Valeriy Zhirnov
e024a7c563 Provide template for pull requests
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
2018-06-03 16:50:01 +03:00
Alexey Tsvetkov
f7b32bdfa7 Refactor managing Gradle daemons for tests
Encapsulate daemon run count within DaemonRegistry to simplify reasoning
about the state.

Never count test process Gradle version as active Gradle process.

Fix the bug when daemon version hit max run count threshold
would be restarted every time after that.
2018-06-01 23:14:34 +03:00
Alexey Tsvetkov
0fd0eb9a18 Do not build release variant for Android Gradle test
This speeds up the test case significally. On my machine the time spent
in test case dropped from 1+ minute to 15 seconds.
2018-06-01 23:13:37 +03:00
Alexey Tsvetkov
87b053958b Make lint not fail on error in Android tests
It fails with meaningless (for us) errors, such as "target version 23
won't be accepted to play store soon".
2018-06-01 23:13:37 +03:00
Alexey Tsvetkov
3ccaae249a Move Android test from foo to com.example package
Otherwise the test `KotlinAndroid32GradleIT.testIncrementalCompile`
failed with Android resource linking failed error:
"attribute 'package' in <manifest> tag is not a valid Android package name: 'foo'."
2018-06-01 23:13:37 +03:00
Alexey Tsvetkov
44a845eca9 Avoid using bound class reference
Bound references require kotlin-reflect 1.1.x on runtime.
However old Gradle versions (e.g. 3.4) can leak 1.0.x reflect
into Gradle classloader, so getting bound reference fails on runtime
(in this case the plugin couldn't connect to the daemon).
2018-06-01 23:13:37 +03:00
Alexey Tsvetkov
42350ffb1a Fix applying subplugin from script
#KT-24497 fixed
2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
6eebcf7f18 Add test for subplugin in nested buildscript
KT-24653
2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
f720501612 Implement fallback compiler search 2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
15a372b0eb Create compiler and plugin classpath configurations in Android plugin too 2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
af8b0ffa6d Resolve compiler classpath using 'kotlinCompilerClasspath' configuration
#KT-24675 fixed
2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
6fe0829cf8 Remove scripting plugin from JVM compiler classpath
#KT-24559 fixed
2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
db66bfd726 Pack scripting plugin into kotlin-scripting-embeddable for use in Gradle 2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
dd731da6d1 Make 'kotlinCompilerPluginClasspath' non-transitive
Previous plugin resolution mechanism was only searching
for exact artifact without transitive dependencies.

The configuration allows resolving transitive dependencies,
but it resolves stdlib which fails because the compiler
loads plugins using parent last classloader.

Non-transitivity can be removed after parent last classloader is
removed.
2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
873de17056 Resolve compiler plugin classpath using 'kotlinCompilerPluginClasspath' configuration
#KT-24653 fixed
        #KT-24676 fixed
2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
0c21b21a88 Move subplugin tests to separate class 2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
1085abedcd Test scripting with Gradle 2018-06-01 23:13:36 +03:00
Alexey Tsvetkov
0b22a3c67b Prevent starting multiple daemons from Gradle
#KT-24560 fixed
2018-06-01 23:13:36 +03:00
Alexey Sedunov
48b55edb03 Configuration: Add non-release repository to main Gradle buildfile
#KT-24725 Fixed
2018-06-01 21:36:39 +03:00
Alexey Sedunov
b826e850fd Configuration: Enable dumb-mode alternative resolve when updating settings.gradle
#KT-24667 Fixed
2018-06-01 21:36:39 +03:00
Alexander Udalov
5478dabb38 Add Maven/Gradle usage examples to kotlinx-metadata-jvm ReadMe 2018-06-01 19:14:42 +02:00
Alexander Udalov
adb129d244 Add ChangeLog for kotlinx-metadata-jvm 2018-06-01 19:14:42 +02:00
Ilya Chernikov
3171968efc Fix native-platform repo after it was suddenly moved in the gradle repo 2018-06-01 17:01:35 +02:00
Pavel V. Talanov
dae8b12872 Mpp: fix production internals not visible from tests in platform modules
Caused by change in mpp resolve
Happened in platform modules that have expectedBy dependencies

#KT-24729 Fixed
2018-06-01 14:15:04 +02:00
Pavel V. Talanov
4279dc9c05 Minor: better name for generated test 2018-06-01 14:15:04 +02:00
Nikolay Krasko
91b86d7fba Remove explicit locks for accessing and creating cached values
Working with user data in cached value manager is already thread safe.
2018-06-01 12:08:48 +03:00
Nikolay Krasko
cc04b72dfd Protect access to SLRUCache for scripts with a lock 2018-06-01 12:08:46 +03:00
Nikolay Krasko
6d7510a6f4 Minor: code cleanup in KotlinCacheServiceImpl.kt 2018-06-01 12:08:44 +03:00
Nikolay Krasko
1e5192bcff Fail with FileComparisonFailure in hierarchy tests 2018-06-01 12:08:43 +03:00
Nikolay Krasko
a5593f1f31 Render entries with outer classifiers in call hierarchy (KT-22698)
#KT-22698 Fixed
2018-06-01 12:08:41 +03:00
Nikolay Krasko
496243c3ce Remove difference in nullable state for loadState() 2018-06-01 12:08:37 +03:00
Ilya Gorbunov
f8217ef28f Extract subclasses of JvmMemberSignature sealed class to top-level
Use more specific subtypes of sealed class in visitors.
2018-06-01 06:43:48 +03:00
Ilya Gorbunov
1a290d0c73 Refactor: make JvmMemberSignature a sealed class
Use JvmMemberSignature.asString instead of toString
2018-06-01 06:43:48 +03:00
Ilya Gorbunov
2f58539200 Refactor: allow to distinguish whether JvmMemberSignature is for field or for method
Introduce a method to create org.jetbrains.kotlin.load.kotlin.MemberSignature directly from JvmMemberSignature.
Create JvmFunctionSignature from JvmMemberSignature.
2018-06-01 06:43:48 +03:00
Ilya Gorbunov
36c658fd8b Introduce JvmMemberSignature to represent name and desc of jvm methods and fields
Return member name and desc in a class in order not to parse that information
from concatenated string when required.
2018-06-01 06:43:48 +03:00
Ilya Gorbunov
eee9f8ab3f Include kotlinp tests into distTest and kotlinx-metadata-jvm tests into coreLibsTest
kotlinp tests: do not fail due to different directory separators on Windows
2018-06-01 06:43:48 +03:00
Ilya Gorbunov
d86947207c Change group of kotlinx.metadata to org.jetbrains.kotlinx
Allow to override version of the resulting artifact with a property.
Setup publishing of the library when its deployment version is specified.
2018-06-01 06:43:48 +03:00
Alexey Sedunov
fbb4914bfb Intentions: Fix insertion of necessary lambda parameter for run/let and apply/also conversions
#KT-22931 Fixed
2018-05-31 15:22:32 +03:00
Alexey Sedunov
f17053f970 Configuration: Create absent Kotlin SDK when configuring Kotlin/JS module
#KT-24412 Fixed
2018-05-31 15:22:31 +03:00
Alexey Sedunov
924db3f23e Configuration: Fix Kotlin SDK existence check on facet configuration
#KT-24072 Fixed
2018-05-31 15:22:31 +03:00
Dmitry Petrov
7b1b557250 psi2ir: Java annotations have no primary constructor 2018-05-31 10:09:31 +03:00
Dmitry Petrov
8094cb7dc5 psi2ir: Generate external dependencies in a loop
There are some cases (superclasses, overridden methods, and so on) where
external dependencies generation can require additional external
dependencies.
2018-05-31 10:09:31 +03:00
Alexey Tsvetkov
cb549cba00 Create kapt configurations before gradle script is evaluated
We cannot create kapt configurations in `KotlinGradleSubplugin.apply`,
because `apply` is invoked after a script is evaluated, so user cannot
refer to kapt configurations in script.

We cannot call `apply` before script's evaluation, because
then we might not be able to determine
if a Gradle plugin corresponding to a subplugin is appled.
For example in case of the following script:
```
apply plugin: "kotlin"
apply plugin: "kotlin-kapt"
```
subplugin's apply will exit early because Gradle plugin "kotlin-kapt"
is not applied yet, when "kotlin"'s apply is evaluated.
2018-05-30 20:24:11 +03:00
Mikhael Bogdanov
4383335168 Update @JvmDefault documentation 2018-05-30 15:24:50 +02:00
Alexander Udalov
b5007c417d Minor, restructure reflection tests a little
To allow their usage in https://github.com/udalov/kotlin-obfuscation-test-app
2018-05-30 13:03:10 +02:00
Dmitry Petrov
7a2bb79777 psi2ir: Use substituted 'hashCopy' for generated data class 'hashCopy' 2018-05-30 12:02:34 +03:00
Dmitry Petrov
cb301763f3 psi2ir: Fix implicit casts generation
Implicit cast from T to S is not required if
  T <: S.makeNullable()
2018-05-30 12:02:34 +03:00
Nikolay Krasko
dac9036969 Remove reload(PsiFile?) usage from KotlinFieldBreakpoint 2018-05-29 21:40:32 +03:00
Nikolay Krasko
439e079c94 Minor: reformat KotlinFindUsagesProvider.kt 2018-05-29 21:40:32 +03:00
Nikolay Krasko
9c305e2431 Fix getting names representation for constructor parameters (KT-23090)
#KT-23090 Fixed
2018-05-29 21:40:32 +03:00
Nikolay Krasko
c5b3092c64 Use same amount of memory for all builds and remove tasks.kt.173 2018-05-29 21:40:31 +03:00
Nikolay Krasko
e6905c9b3d Refactoring: extract function for getting project 2018-05-29 21:40:31 +03:00
Alexey Sedunov
6f8e25eae7 Configuration: Restore dependency on gradle plugin in buildscript block
#KT-24671 Fixed
2018-05-29 18:07:09 +03:00
Nicolay Mitropolsky
cbcc3d2e2e Test for java-keywords in light-annotations (KT-22883)
working with new source-based light annotations
2018-05-29 16:34:10 +03:00
Mikhael Bogdanov
ad717d5335 Support properties in compatibility mode 2018-05-29 15:08:07 +02:00
Mikhael Bogdanov
0498c3b765 Don't copy descriptor for delegation generation
Actually source element for DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL
  was always null cause descriptor was copies with new kind=DECLARATION.
  That causes element recalculation in DiagnosticFactory:
  element = data.classOrigin.element
  So DEFAULT_IMPL_DELEGATION_TO_SUPERINTERFACE_DEFAULT_IMPL is added to EXTERNAL_SOURCES_KINDS
2018-05-29 15:08:07 +02:00
Roman Artemev
9d2092e86d Fix visibility of @JsName-annotated symbols in stdlib-js 2018-05-29 13:57:34 +03:00
Roman Artemev
06009a532b Add test case to detect name clash in stdlib-js 2018-05-29 13:57:34 +03:00
Mikhael Bogdanov
689a492b9a Minor. Fix test data 2018-05-29 12:47:07 +02:00
Mikhael Bogdanov
23a713d46b Rollback 'Don't copy interface member on DefaultImpl delegation generation, keep kind' 2018-05-29 12:47:06 +02:00
Nicolay Mitropolsky
8e2c9358bc Uast: updates for consistency tests and fixes for missed things
we should use `sourcePsi` instead of `psi` for parents matching, because light `psi` will not be tested, and it is not enough to store only PSI as map key to match parent consistency, because some different UElements could have same sourcePsi.
2018-05-29 13:30:52 +03:00
Mikhael Bogdanov
0a26f527f2 Minor. Fix test data 2018-05-29 11:26:36 +02:00
Mikhael Bogdanov
419218b9cf Rename 'jvm-default-mode' to 'jvm-default'. Add description 2018-05-29 11:26:36 +02:00
Mikhael Bogdanov
020573ef3c Don't generate compatibility suffix twice for properties 2018-05-29 09:29:48 +02:00
Mikhael Bogdanov
60f2dbeb8a Support property accessor in compatibility mode 2018-05-29 09:29:48 +02:00
Mikhael Bogdanov
7f4bd549aa Minor. Fix rebase 2018-05-29 09:28:46 +02:00
Mikhael Bogdanov
1d6665d355 Minor. Remove hack 2018-05-28 22:15:54 +02:00
Mikhael Bogdanov
b7bad2bd72 Pass accessorKind into AccessorForCallableDescriptor 2018-05-28 22:15:53 +02:00
Mikhael Bogdanov
7a649e0e74 Convert AccessorForPropertyDescriptor to Kotlin 2018-05-28 22:15:52 +02:00
Mikhael Bogdanov
6d321e7997 Rename AccessorForPropertyDescriptor.java to AccessorForPropertyDescriptor.kt 2018-05-28 22:15:51 +02:00
Mikhael Bogdanov
df13d332b3 Minor. Code clean 2018-05-28 22:15:50 +02:00
Mikhael Bogdanov
15cbb68d47 Convert AccessorForCallableDescriptor to Kotlin 2018-05-28 22:15:50 +02:00
Mikhael Bogdanov
2fa521b62a Convert AccessorForFunctionDescriptor to Kotlin 2018-05-28 22:15:49 +02:00
Mikhael Bogdanov
25af7c14e3 Rename AccessorForFunctionDescriptor.java -> AccessorForFunctionDescriptor.kt 2018-05-28 22:15:48 +02:00
Mikhael Bogdanov
8f19dea4a2 Rename FieldAccessorKind to AccessorKind 2018-05-28 22:15:47 +02:00
Mikhael Bogdanov
ad57ca7d2c Minor. Code clean 2018-05-28 22:15:46 +02:00
Mikhael Bogdanov
340920fe38 Support compatibility mode for @JvmDefault 2018-05-28 22:15:45 +02:00
Mikhael Bogdanov
9b718e83a9 Don't copy interface member on DefaultImpl delegation generation, keep kind
Old logic is redundant and obsolete
2018-05-28 22:15:44 +02:00
Mikhael Bogdanov
4421b41790 Skip annotation classes in $DefaultImpls method delegation logic
Annotation could be safely skipped (as already interfaces) cause
  compiler generates delegation to DefaultImpls only for classes
2018-05-28 22:15:43 +02:00
Mikhael Bogdanov
065780de4c Switch enableJvmDefault to jvmDefaultMode 2018-05-28 22:15:42 +02:00
Ilya Chernikov
bacc2079ed Fix/workaround lazy lcript definition test and related scenarios 2018-05-28 22:10:56 +02:00
Ilya Chernikov
6fdb8746de Fixes after review 2018-05-28 22:10:56 +02:00
Ilya Chernikov
6218b2bcf6 Fix custom script codegen test: add missing classpath entries 2018-05-28 22:10:56 +02:00
Ilya Chernikov
a46dd5b30e Avoid using reflected types in the scripting API
since it causes numerous classloading issues. Using the wrapping types
and reload them in the proper context when needed.
Note: this version supports only classes, but the wrapping type could
be extended to support other types in the future.
+ numerous fixes related to proper loading and handling of the templates.
2018-05-28 22:10:56 +02:00
Ilya Chernikov
4d65f0478b Move scripting codegen code from tests-common to compiler tests
getting rid of dependencies on scripting in the tests-common
2018-05-28 22:10:56 +02:00
Pavel V. Talanov
c54967b1b4 IdeaModuleInfos: cache Module.findImplementedModules
Calling ModuleSourceInfo.expectedBy can be quite costly otherwise
    because creating IdeModifiableModuleProvider is not cheap
2018-05-28 20:02:02 +02:00
Pavel V. Talanov
607fab994c Cache result of collectModulesFromIdeaModel
Cache base module infos from idea model until next root modification
Calculate platform specific module infos (see PlatformModuleInfo)
    on demand based on cached module infos from idea model

 #KT-24144 Fixed
2018-05-28 20:02:02 +02:00
Pavel V. Talanov
406a3888c7 Minor: split getModuleInfo into separate files 2018-05-28 20:02:01 +02:00
Alexey Sedunov
4053278119 Misc: Do not set icon via GUI Designer
Since Designer references icon by filename it fails
due to recent update in IDEA icon files

 #KT-24580 Fixed
2018-05-28 17:36:09 +03:00
Nicolay Mitropolsky
aed63d49ce WrongAnnotations.kt - disabled LAZINESS:Consistency -check
because source-based LightAnnotations produces annotation values from arguments in sources even when they are invalid as parameters. Thus they could be inconsistenct with "compiled" ones and it is not an error.
2018-05-28 17:06:35 +03:00
Nicolay Mitropolsky
da5ef06abf KtLightNullabilityAnnotation evaluated from sources 2018-05-28 17:06:35 +03:00
Nicolay Mitropolsky
eea66bea73 Making LightAnnotation work without clsDelegate (KT-20924, KT-22883) 2018-05-28 17:06:35 +03:00
Anton Bannykh
03e46ce0ca JS: more default arguments fixes (KT-24413, KT-21968 fixed)
MPP-related:
* inherited from interfaces
* inherited body from interface
* default arguments in an interface, implemented by a class delegate
* super call of a method with default argument

Also:
* inheritance from an interface and another interface descendant (KT-21968)
* inheritance through an intermediate interface
2018-05-28 15:27:21 +03:00
Dmitry Savvinov
da7b59984f Move importsDumper to compiler plugin 2018-05-28 13:02:48 +03:00
Dmitry Savvinov
16ee2df585 Fix tests for imports dumper
Remove local absolute paths from testdata, introduce new testrunner to
support relativization of imports dump.
2018-05-28 13:02:47 +03:00
Nicolay Mitropolsky
c97f4539d3 181: ideaCompatibleBuildNumber = "181.3" 2018-05-28 12:05:02 +03:00
Alexander Udalov
06d97cce51 Fix multiple issues when expanding argfiles
- treat a contiguous whitespace sequence as a single argument separator,
  not as several empty-string arguments separated by whitespaces
- fix infinite loop when reading unfinished quoted argument
- do not attempt to perform escape if the backslash is the last
  character in the file
2018-05-28 11:23:32 +03:00
Alexander Udalov
61902e1fd5 Support -Xargfile in all scenarios; refactor & prettify code
Perform command line argument preprocessing in the beginning of
parseCommandLineArguments, so that argfiles are expanded in all
scenarios, not just when the compiler is invoked via
K2{JVM,JS}Compiler.exec
2018-05-28 11:23:32 +03:00
Dmitry Savvinov
43467516ef Support argfiles in kotlin compiler
Using '-Xargfile=path/to/argfile' will substitute
that argument with the content of argfile.

See KT-24472
2018-05-28 11:23:32 +03:00
Neonailol
ede2e227c2 KT-23356 Cross-platform function to convert CharArray slice to String
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
2018-05-26 06:06:53 +03:00
Max Medvedev
16ebcc6e77 Extract function: make name editor focused
#KT-22333 Fixed
2018-05-25 23:30:09 +03:00
Alexey Sedunov
610cc3867b Create Class from Usage: Filter out usages in super type entry list
#KT-22918 Fixed
2018-05-25 23:03:26 +03:00
Alexey Sedunov
35517a8253 Quick Fixes: Fix adding parameter to Java constructor
#KT-24574 In Progress
2018-05-25 23:03:26 +03:00
Alexey Sedunov
6e25db990d Change Signature: Use target declaration as a context for types
#KT-22387 Fixed
2018-05-25 23:03:25 +03:00
Ilya Gorbunov
3245148206 Docs: clarify default element value of CharArray and BooleanArray 2018-05-25 21:53:52 +03:00
Ilya Gorbunov
418db53ba4 Array.copyOf docs: do not use 'primitive default' term, rewrite description
#KT-22298
2018-05-25 21:52:36 +03:00
Valeriy Zhirnov
9239de9a02 KT-22298 Improve docs for Array.copyOf(newSize: Int)
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
2018-05-25 21:52:36 +03:00
Ilmir Usmanov
df4dcc0f8e Ignore data flow info from assert calls
if assertions mode is not LEGACY.

This is done since assertions can be disabled (in both compile time and
runtime) and thus, the data flow info is not reliable anymore.
 #KT-24529: Fixed
2018-05-25 18:58:49 +03:00
Ilmir Usmanov
0cb73e55d0 Split kotlin-stdlib-coroutines into common and java jars
#KT-24532: Fixed
2018-05-25 18:19:19 +03:00
Alexander Udalov
9c5256434c Check function name in isGenericToArray/isNonGenericToArray
#KT-24427 Fixed
2018-05-25 14:55:26 +02:00
Ilya Chernikov
92d848b6e6 Fix scripting plugin commandline processing 2018-05-25 09:51:04 +02:00
Ilya Chernikov
705faa4792 Add lazy discovery test 2018-05-25 09:51:04 +02:00
Dmitry Petrov
ab455d6572 IR: IrSimpleFunction.correspondingProperty: IrProperty?
Non-null for a property accessor, points to a corresponding property.
2018-05-25 09:40:51 +03:00
Dmitry Petrov
216dbf9637 Drop IrDeclarationKind 2018-05-25 09:40:51 +03:00
Dmitry Petrov
2a0e7eb412 IR: split IrUtils.kt into common and backend-specific part 2018-05-25 09:40:51 +03:00
Alexey Sedunov
6a21991009 Configuration: Drop Java -> Kotlin/JS configurator
#KT-24504 Fixed
2018-05-24 22:24:24 +03:00
Alexey Sedunov
6fd060b166 Configuration: Support TeamCity repository for dev-versions 2018-05-24 22:24:23 +03:00
Alexey Sedunov
c64f93b052 Configuration: Add 'mavenCentral() to generated script 'repositories' block
#KT-24586 Fixed
2018-05-24 22:24:23 +03:00
Roman Artemev
6d29aab5e2 [JS IR BE] Implement vararg in JS BE 2018-05-24 21:36:12 +03:00
Roman Artemev
84447d59e1 [JS IR BE] Update test data 2018-05-24 21:07:25 +03:00
Roman Artemev
3ec722eaa1 [JS IR BE] Implement labeled loops 2018-05-24 21:07:09 +03:00
Roman Artemev
6811c87fc7 [JS IR BE] Implement block decomposition lowering 2018-05-24 21:06:49 +03:00
Nikolay Krasko
1eeb202a1a Use background task for Kotlin decompiler (KT-23981)
#KT-23981 Fixed
2018-05-24 20:03:23 +03:00
Nikolay Krasko
6c56a7949c Don't call an additional update check when selecting channel with enter 2018-05-24 20:03:22 +03:00
Nikolay Krasko
468f7f234f Don't show default companion name in inlay type hints (KT-22432)
#KT-22432 Fixed
2018-05-24 20:03:22 +03:00
Nikolay Krasko
918f47e832 Refactoring: extract common code to functions 2018-05-24 20:03:22 +03:00
Nikolay Krasko
0a2bb74187 Refactoring: move compatibility issue fix in decompiler to separate file 2018-05-24 20:03:22 +03:00
Nikolay Krasko
c8654a0033 Minor: reformat and fix warnings in internal package 2018-05-24 20:03:21 +03:00
Nikolay Krasko
39694835ce Do not report lambda return hint twice for postfix and prefix (KT-22653)
#KT-22653 Fixed
2018-05-24 20:03:21 +03:00
Toshiaki Kameyama
5e4d571693 Reformat RemoveModifierFix 2018-05-24 17:29:16 +03:00
Toshiaki Kameyama
0100dfb2fd Add "Remove 'lateinit'" quickfix for INAPPLICABLE_LATEINIT_MODIFIER
So #KT-24295 Fixed
2018-05-24 17:26:54 +03:00
Mikhail Glukhikh
f8f3b1c6f1 Provide language version settings correctly for platform modules
So #KT-24546 Fixed
2018-05-24 16:40:52 +03:00
Ilmir Usmanov
6c3d69f74c Minor: Add KotlinTypeMapper constructor overload 2018-05-24 15:42:53 +03:00
Alexander Udalov
d122406dca Map Kotlin TYPE target to Java TYPE_USE in bytecode
And TYPE_PARAMETER -> TYPE_PARAMETER similarly

 #KT-23857 Fixed
2018-05-24 14:41:22 +02:00
Mikhail Glukhikh
fbb0a3e06c Convert async {}.await() to withContext(DefaultDispatcher) {}
This fixes incorrect transformation related to KT-24235
2018-05-24 15:15:25 +03:00
Mikhail Glukhikh
4ed4754d80 Additional tests for KT-21131 2018-05-24 15:15:23 +03:00
Mikhail Glukhikh
f3c2dd0526 Code inliner: keep main property if it can have side effects
So #KT-24165 Fixed
2018-05-24 15:15:22 +03:00
Mikhail Glukhikh
93a510c05b Code inliner: move lambda outside parentheses always when possible
So #KT-24215 Fixed
2018-05-24 15:15:21 +03:00
Mikhail Glukhikh
bb8c3495b8 Reformat & cleanup: CodeInliner 2018-05-24 15:15:19 +03:00
Mikhail Glukhikh
2d7e274860 Fix importing scope order in ReplaceWithAnnotationAnalyzer
So #KT-22615 Fixed
2018-05-24 15:15:13 +03:00
Mikhail Glukhikh
394a547084 Reformat: ReplaceWithAnnotationAnalyzer 2018-05-24 15:15:10 +03:00
Mikhail Glukhikh
75724c0240 Reformat: CodeToInline 2018-05-24 15:15:09 +03:00
Mikhail Glukhikh
251491757d Reformat: CallableUsageReplacementStrategy 2018-05-24 15:15:08 +03:00
Mikhail Glukhikh
0655e153c3 Reformat: DeprecatedSymbolUsageFixBase 2018-05-24 15:15:07 +03:00
Mikhail Glukhikh
7cb4c91277 Reformat: DeprecatedSymbolUsageFix 2018-05-24 15:15:06 +03:00
Mikhail Glukhikh
8d74ff4799 Fix Java inspection performance tests 2018-05-24 15:13:19 +03:00
Mikhail Glukhikh
18c59578be Light class performance test: rename test file 2018-05-24 15:13:18 +03:00
Mikhail Glukhikh
3b6d610e29 Light class performance test: access field & method types
So #KT-24085 Fixed
2018-05-24 15:13:18 +03:00
Mikhail Glukhikh
75eeb32970 Light class performance test: build also light nested classes
So #KT-24085 In Progress
2018-05-24 15:13:18 +03:00
Mikhail Glukhikh
bb4cf08d0b Light class performance test: evaluate all supertypes / methods / fields
So #KT-24085 In Progress
2018-05-24 15:13:18 +03:00
Mikhail Glukhikh
1861e0a21d Introduce performance test for light classes building (top-level)
So #KT-24085 In Progress
2018-05-24 15:13:18 +03:00
Natalia Selezneva
98fe8eaa42 Minor: add test that output at scratch line with spaces at the beginning is aligned properly 2018-05-24 15:07:37 +03:00
Natalia Selezneva
db63877690 Scratch: take into account only lines with expressions calculating inlay insert offset 2018-05-24 15:07:37 +03:00
Natalia Selezneva
aa7c13e30b Run scratch if there are some compilation error during make 2018-05-24 15:07:37 +03:00
Natalia Selezneva
5a7b58c615 Substring long scratch output with new lines
^KT-24016 Fixed
2018-05-24 15:07:37 +03:00
Natalia Selezneva
94bb19c765 Provide line info for scratch output in scratch toolwindow
^KT-24016
2018-05-24 15:07:37 +03:00
Natalia Selezneva
a505a948d2 Scratch tests: add check for toolwindow output 2018-05-24 15:07:37 +03:00
Natalia Selezneva
bce0a77a94 Scratch: fix duplicating of errors in scratch output toolwindow 2018-05-24 15:07:37 +03:00
Natalia Selezneva
e3b6fad2cd Scratch: test alignment of inlays 2018-05-24 15:07:37 +03:00
Natalia Selezneva
5da0252651 Minor: rename file and rearrange classes 2018-05-24 15:07:37 +03:00
Natalia Selezneva
420da0d213 Introduce ToolWindowScratchOutputHandler 2018-05-24 15:07:37 +03:00
Natalia Selezneva
aa1e604923 Refactoring: move ScratchToolWindowFactory to scratch.output package 2018-05-24 15:07:37 +03:00
Natalia Selezneva
614fa9d0c7 Refactoring: move ScratchFileRenderer to separate file 2018-05-24 15:07:37 +03:00
Natalia Selezneva
afa6110e6a Minor: replace assert with user-friendly error 2018-05-24 15:07:37 +03:00
Natalia Selezneva
75ad78460f Setting for auto-reloading script dependencies isn't loaded from xml on project reopening 2018-05-24 15:07:37 +03:00
Natalia Selezneva
54f9359195 Minor: fixes after review 2018-05-24 15:07:37 +03:00
Sergey Rostov
098e51d104 jps: support dev kit module types (and all other ModuleBasedBuildTargetType). fix brunch 172 2018-05-24 14:59:46 +03:00
Alexander Udalov
bf3419c3bd Introduce OptionalExpectation for annotations missing on some platforms
This commits adds a new annotation OptionalExpectation to the standard
library, which is experimental. To enable its usage, either pass
'-Xuse-experimental=kotlin.ExperimentalMultiplatform' as a compiler
argument, or '-Xuse-experimental=kotlin.Experimental' and also annotate
each usage with `@UseExperimental(ExperimentalMultiplatform::class)`

 #KT-18882 Fixed
2018-05-24 13:14:51 +02:00
Sergey Rostov
ec5110e1f4 jps: support dev kit module types (and all other ModuleBasedBuildTargetType)
#KT-24500 fixed
2018-05-24 11:12:01 +03:00
Mikhail Glukhikh
865f94eb18 Disable "make module experimental" fix on non-JPS modules
Related to KT-24243
2018-05-24 10:50:28 +03:00
Mikhail Glukhikh
d7bb8a7a21 Do not suggest -Xuse...=kotlin.Experimental in experimental world 2018-05-24 10:50:28 +03:00
Mikhail Glukhikh
f2989ee3a6 Experimental fixes: introduce experimental enabling #KT-24243 Fixed 2018-05-24 10:50:28 +03:00
Mikhail Glukhikh
c77c8d872c Experimental fixes: introduce "add -Xuse-experimental" (KT-22760) 2018-05-24 10:50:27 +03:00
Natalia Selezneva
30c62bccb2 Refactoring: do not store scriptModuleInfo inside ScriptDependenciesInfo
Cache for ScriptDependenciesInfo.ForFile is dropped because there is a cache for ScriptModuleInfo, so the facade for dependencies shouldn't be created too often
Cache for ScriptDependenciesInfo.ForProject is stored in a field
2018-05-24 08:47:32 +03:00
Natalia Selezneva
2b322ecf9c Do not store external dependencies in ScriptModuleInfo
There is a cache from ScriptModuleInfo to ScriptDependenciesInfo.
In case when only script dependencies are changed we won't recreate the facade for them and will obtain external dependencies for ScriptModuleInfo stored in ScriptDependenciesInfo. So we cannot store external dependencies inside ScriptModuleInfo. The same problem is with relatedModuleSourceInfo.
2018-05-24 08:47:32 +03:00
Natalia Selezneva
ab743ef759 Scripts: fix NPE during script dependencies update
^KT-24527 Fixed
2018-05-24 08:47:32 +03:00
Natalia Selezneva
f0a7642e1d Optimize ScriptDependenciesUpdater to find scriptDefinition only for files with KotlinFileType 2018-05-24 08:47:32 +03:00
Natalia Selezneva
bb04998159 Scripts: remove loaders when any result was received
^KT-24470 Fixed
2018-05-24 08:47:32 +03:00
Alexey Sedunov
44e7070118 Configuration: Use 'plugins' block in generated/modified Gradle scripts
Follow-up for 172/173/AS3.1/AS3.2 bunches
2018-05-24 02:54:01 +03:00
Alexey Sedunov
efc369dbe4 Misc: KtParsingTestCase fixes for 172/173/AS3.1 bunches 2018-05-24 02:54:00 +03:00
Yan Zhulanow
ece6141891 Pill: Fix module-related path rendering 2018-05-24 01:06:30 +03:00
Yan Zhulanow
0b0089711a Android Extensions: Avoid duplicating variants in compiler plugin options 2018-05-24 01:01:52 +03:00
Yan Zhulanow
015d7f3300 Kapt: Do not retain references to Kotlin compiler classes in customized Javac components
This should fix potential memory leakages.
2018-05-24 01:01:52 +03:00
Yan Zhulanow
99ecedc32e Kapt: Ensure there isn't duplicating entries in the processor loading classpath
(cherry picked from commit 1354a0d)
2018-05-24 01:01:52 +03:00
Yan Zhulanow
aa8c266940 Pill: Add kotlin-scripting-gradle and kotlin-gradle-plugin-integration-tests to JPS model (in 'full' variant) 2018-05-24 01:01:52 +03:00
Yan Zhulanow
b6d59da8a8 Kapt3: Avoid normal compilation in case if no apClasspath entries are passed (#KT-24538) 2018-05-24 01:01:52 +03:00
Yan Zhulanow
dd40b3a15c Kapt: Remove obsolete kapt1-related tests 2018-05-24 01:01:51 +03:00
Yan Zhulanow
6e362f6734 Kapt: Remove kapt1 from Kotlin compiler 2018-05-24 01:01:51 +03:00
Yan Zhulanow
662b79780d Kapt: Remove kapt1 support from Gradle and incremental compilation 2018-05-24 01:01:51 +03:00
Yan Zhulanow
58643ea99d Kapt: Remove annotation processor wrappers for kapt1 (it's obsolete now) 2018-05-24 01:01:51 +03:00
Mikhail Glukhikh
a76bb80e4d Experimental fixes: additional tests, handle local declarations 2018-05-23 19:06:55 +03:00
Mikhail Glukhikh
51fba03253 Experimental fixes: introduce "Add @UseExperimental" #KT-22760 Fixed 2018-05-23 19:00:51 +03:00
Mikhail Glukhikh
f404d6c97a Experimental fixes: introduce "add annotation" (KT-22760) 2018-05-23 18:59:22 +03:00
Sergey Igushkin
721d9df4e0 (minor) Fix testApplyWithFeaturePlugin 2018-05-23 18:41:10 +03:00
Sergey Igushkin
571905824d Add AP option providers of Android Gradle plugin as @Nested to Kapt
Also remove these option providers from the javac task compiler argument
providers so as to avoid output intersections of javac vs kapt.

The options generated by the providers are added to the Kapt subplugin
options as well in order to be passed to Kapt. Since these options
are a list, not a map, pass them without name (Kapt should decode them
into plain arguments). Remove the '-A' prefix as it is there for
command line annotation processor options, but we don't need it, it
is added by Kapt internally.

Issue #KT-23964 Fixed
Issue #KT-24420 Fixed
2018-05-23 18:41:10 +03:00
Simon Ogorodnik
77429b1ca5 Revert: Partial: Add grouping suite and improve whole kotlin tests (fea2559)
Revert occasional change in misc.xml
2018-05-23 17:08:36 +03:00
Alexey Sedunov
1650e69980 Configuration: Use 'plugins' block in generated/modified Gradle scripts
#KT-20665 Fixed
2018-05-23 16:39:20 +03:00
Alexey Sedunov
909ff3a7ec Misc: Migrate to IDEA 181.3 2018-05-23 16:39:20 +03:00
Simon Ogorodnik
78fb775e04 Cleanup duplication 2018-05-23 16:14:39 +03:00
Simon Ogorodnik
ce71e0822c Fix nsToMs 2018-05-23 16:14:38 +03:00
Simon Ogorodnik
391c516ed0 Java inspections test 2018-05-23 16:14:37 +03:00
Simon Ogorodnik
16adf383a5 Use single test project for all tests, instead of copying current 2018-05-23 16:14:36 +03:00
Simon Ogorodnik
fea2559a28 Add grouping suite and improve whole kotlin tests 2018-05-23 16:14:34 +03:00
Mikhail Glukhikh
3e2563ad73 Extract AllKotlinTest from AllKotlinInspectionTest
(cherry picked from commit 7cb31ee)
2018-05-23 16:14:33 +03:00
Simon Ogorodnik
a57a40b5a9 Fix totals 2018-05-23 16:14:33 +03:00
Simon Ogorodnik
9287d2cd24 Fix testFailed reporting 2018-05-23 16:14:31 +03:00
Simon Ogorodnik
750cb38f8c Don't include stacktrace to failure 2018-05-23 16:13:22 +03:00
Simon Ogorodnik
1a015402c8 Fail per file check on first exception 2018-05-23 16:13:21 +03:00
Simon Ogorodnik
c8fbf2d3ac Post-review fixes, add errors reporting to test 2018-05-23 16:13:20 +03:00
Simon Ogorodnik
3221900f69 Change soft refs policy 2018-05-23 16:13:19 +03:00
Simon Ogorodnik
94c8a18f10 Remove dependency from test to performanceTest 2018-05-23 16:13:18 +03:00
Simon Ogorodnik
d2a60164c6 Handle exceptions 2018-05-23 16:13:17 +03:00
Simon Ogorodnik
7b155fc9d4 Increase heap size for test 2018-05-23 16:12:57 +03:00
Simon Ogorodnik
7d9310acf4 Refactor inspection test output 2018-05-23 16:12:55 +03:00
Simon Ogorodnik
740e6fde35 Create performance test for all inspections 2018-05-23 16:12:54 +03:00
Roman Artemev
de9aea6e98 [JS BE] Fix delegation of suspend method member (KT-23094) 2018-05-23 14:59:59 +03:00
Roman Artemev
8862b26bbd Add test case to check delegation of suspend method 2018-05-23 14:59:59 +03:00
Mikhael Bogdanov
f826a253e3 Generate @JvmDefault for property accessors in LIGHT_CLASS MODE 2018-05-23 13:55:38 +02:00
Alexander Udalov
402ceefe60 Regenerate tests 2018-05-23 12:26:10 +02:00
Ilya Gorbunov
3d2a641057 Minor: explicit public visibility 2018-05-23 05:44:34 +03:00
Ilya Gorbunov
d9656a939b Do not produce libraries json declarations dump
It's no longer needed for checking binary compatibility.
Clean build of these libraries is no longer required too.

Cleanup build.gradle of binary-compatibility-validator.
2018-05-23 05:00:57 +03:00
Ilya Gorbunov
ad8c64e127 bcv: refactor: do not convert flags to string representation 2018-05-23 05:00:57 +03:00
Ilya Gorbunov
66a9a90455 bcv: cleanup the old way of reading kotlin visibilities 2018-05-23 05:00:57 +03:00
Ilya Gorbunov
84d96d9537 Use asm:6.0 in kotlinp
Some class files can't be read with asm:4.0.

Make shadowJar when assembling the project.
2018-05-23 05:00:57 +03:00
Ilya Gorbunov
fcf323851e bcv: use kotlinx-metadata-jvm to read kotlin visibilities
It's no longer required to dump kotlin-to-java declaration mapping to json
before using binary-compatibility-validator.

@JvmOverloads are not supported yet, so remove them from test.

Use asm:6.0 in bcv
2018-05-23 05:00:56 +03:00
Ilya Gorbunov
1872550f25 binary-compatibility-validator: add test case for parameters with default values
Move JvmOverloads test there.
2018-05-23 05:00:56 +03:00
Nikolay Krasko
fdc6372776 Remove runtime usage from unused receiver parameter tests 2018-05-23 01:41:02 +03:00
Toshiaki Kameyama
e7a9614fb5 "Unused receiver parameter" inspection: Fix false negative in same class (KT-23897)
#KT-23897 Fixed
2018-05-23 01:41:01 +03:00
Ilya Gorbunov
793d34b913 Suppress errors about non-public primary constructor and forbidden varargs 2018-05-22 22:27:00 +03:00
Ilya Gorbunov
0eee258fce Generate toString implementation for unsigned types 2018-05-22 22:26:56 +03:00
Ilya Gorbunov
e988ea5a1c Implement unsigned arithmetic operations including ulong division and remainder 2018-05-22 22:26:52 +03:00
Ilya Gorbunov
e01895fb0a Implement unsigned/signed conversions 2018-05-22 22:26:47 +03:00
Ilya Gorbunov
89e4fdfa9c Implement unsigned comparisons 2018-05-22 22:26:43 +03:00
Ilya Gorbunov
e4216099b3 Simplify differenceModulo for unsigned operands 2018-05-22 22:26:39 +03:00
Ilya Gorbunov
f2c01a9d9b Generate ranges, progressions and progressioniterators for UInt and ULong 2018-05-22 22:26:36 +03:00
Ilya Gorbunov
5c6719b1e6 Generate arrays of unsigned types 2018-05-22 22:26:32 +03:00
Ilya Gorbunov
4fbc48f83f Generate specialized abstract iterators for unsigned types 2018-05-22 22:26:28 +03:00
Ilya Gorbunov
188d8ab8dd Generate unsigned integers declarations, mostly without implementations
Generate and/or/xor/inv for UByte/UShort using experimental signed counterparts
2018-05-22 22:26:24 +03:00
Ilya Gorbunov
e57e3971b6 Setup separate sourceset for unsigned integer types
Build jar with unsigned types and put it to dist
2018-05-22 22:26:20 +03:00
Ilya Gorbunov
e886460130 Advance bootstrap
Need to use -XXLanguage feature switch
2018-05-22 22:26:14 +03:00
Toshiaki Kameyama
1d0a11cecd "Remove parameter" quick fix makes generic function call incompilable when type could be inferred from removed parameter only
#KT-23511 Fixed
2018-05-22 17:33:26 +03:00
Toshiaki Kameyama
8271e85dbb ReplaceArrayOfWithLiteralInspection: Remove unnecessary parentheses
#KT-21878 Fixed
2018-05-22 17:33:25 +03:00
Mikhail Glukhikh
c95ed9fd20 Result unused: a few enhancements for PSI checks
Related to KT-15063, KT-24433
2018-05-22 17:13:48 +03:00
Mikhail Glukhikh
b8375d4864 Extend "async result unused" to "Deferred result unused" #KT-15063 Fixed 2018-05-22 17:07:05 +03:00
Mikhail Glukhikh
ffcfa51fbf Introduce inspection "async result unused" #KT-24433 Fixed 2018-05-22 16:39:14 +03:00
Mikhail Glukhikh
d0c045e4ba Style fix: AbstractInspectionTest 2018-05-22 16:39:14 +03:00
Mikhail Glukhikh
feaaf5df84 Reformat: AbstractKotlinInspection 2018-05-22 16:39:14 +03:00
Mikhail Glukhikh
2a9108bcd3 Fix "Too long character literal -> string" in ILLEGAL_ESCAPE
Related to #KT-23788
2018-05-22 16:38:29 +03:00
Toshiaki Kameyama
85cd1e938e Add "Too long character literal -> string" fix to ILLEGAL_ESCAPE error
So #KT-23788 Fixed
2018-05-22 16:19:41 +03:00
Mikhail Glukhikh
6d39eb9239 Unnecessary parentheses in function call with lambda: simplify
Related to KT-23452
2018-05-22 16:18:42 +03:00
Toshiaki Kameyama
b8f3d588b7 Unnecessary parentheses in function call with lambda: fix false positive
So #KT-23452 Fixed
2018-05-22 15:45:02 +03:00
Dmitry Petrov
8dbfd85d26 psi2ir: Support class literals in annotations 2018-05-22 15:29:01 +03:00
Alexander Udalov
e7f6ac1e50 Fix data class equals codegen for type parameters with interface bounds
#KT-24474 Fixed
2018-05-22 13:45:21 +02:00
Mikhail Zarechenskiy
542b2abafa Fix migration change for new inference about coroutines
Now it's possible after 9209222

 #KT-23553 Fixed
2018-05-22 10:11:14 +03:00
Dmitry Petrov
c22dfeaf82 KT-24156 Do not optimize for-loops over Strings with custom iterator
'fun CharSequence.iterator()' is an extension function, so one can
overload it with custom implementation.
Other "predefined" containers such as arrays and ranges have member
'fun iterator()', so these containers are not affected.

Check that 'iterator' call corresponds to an extension function
'iterator' defined in package 'kotlin.text' with a receiver of type
'kotlin.CharSequence'.

 #KT-24156 Fixed
2018-05-22 10:02:52 +03:00
Ilmir Usmanov
f568149863 Implement new assert semantics in back-end
Previously, assert was just a regular function and its argument used to
be computed on each call (even if assertions are disabled on JVM).
This change adds support for 3 new behaviours of assert:
* always-enable (independently from -ea on JVM)
* always-disable (independently from -ea JVM)
* runtime/jvm (compile the calls like javac generates assert-operator)
* legacy (leave current eager semantics) - this already existed

Default behaviour is legacy for now.

The behavior is changed based on -Xassertions flag.
 #KT-7540: Fixed
2018-05-21 20:43:37 +03:00
Derek Schaller
3f5a2c6427 Link license files 2018-05-21 18:19:49 +03:00
Mikhail Zarechenskiy
1b809413d2 [NI] Fix updated type for lambda, use original type for substitution
#KT-24367 Fixed
2018-05-21 17:56:11 +03:00
Alexey Tsvetkov
005bdc46eb Update bootstrap compiler 2018-05-20 18:23:10 +03:00
Alexey Tsvetkov
7f865565a6 Improve JPS progress messages
#KT-9218 fixed
2018-05-18 23:50:08 +03:00
Alexey Tsvetkov
6210df977b Fix NPE during lookup map GC
The cause of the issue is unknown, I was not able to reproduce it as
well

    #KT-24337 fixed
2018-05-18 23:50:08 +03:00
Nicolay Mitropolsky
eeab271eff 182: IDEA-SDK fixed to 182.2371.4 2018-05-18 21:24:59 +03:00
Toshiaki Kameyama
5564102a3e Add "Create secondary constructor" quick fix on NONE_APPLICABLE error #KT-22371 Fixed 2018-05-18 18:11:13 +03:00
Toshiaki Kameyama
d32b53362d Reformat UnusedReceiverParameterInspection 2018-05-18 18:11:13 +03:00
Dmitry Savvinov
68dbeeac7a Introduce LanguageFeature.Kind
Mainly, Kind affects 'forcesPreReleaseBinaries' and
'enabledInProgressiveMode' flags, and allows to cover common
combinations of those flags.
2018-05-18 16:16:23 +03:00
Dmitry Savvinov
c33b7377da Add support of internal arguments for language feature settings
Arguments are passed in form '-XXLanguage:+LanguageFeatureName' for enabling
LanguageFeature.LanguageFeatureName, and '-XXLanguage:-LanguageFeatureName'
for disabling.

Note that they do override other settings, including 'language-version'
or extra ('-X') args.
2018-05-18 16:16:23 +03:00
Dmitry Savvinov
ae119a09eb Minor: reformat CommonToolArguments 2018-05-18 16:16:23 +03:00
Dmitry Savvinov
9ba450ffc5 Minor: reformat parseCommandLineArguments, apply intentions 2018-05-18 16:16:23 +03:00
Dmitry Savvinov
9876ecd6df Minor: reformat CommonCompilerArguments 2018-05-18 16:16:23 +03:00
Dmitry Savvinov
e8181c0473 Introduce -Xprogressive 2018-05-18 16:16:23 +03:00
Mikhael Bogdanov
2e9bf49921 Don't skip coercion to nullable Unit in codegen 2018-05-18 12:58:01 +02:00
Mikhael Bogdanov
73bd97a134 Write deprecation flag 2018-05-18 12:58:01 +02:00
Mikhael Bogdanov
61f444f846 Avoid empty clinit generation 2018-05-18 12:58:00 +02:00
Mikhael Bogdanov
aece29a95b Properly generate annotation classes 2018-05-18 12:57:59 +02:00
Mikhael Bogdanov
893e843648 Code clean 2018-05-18 12:57:59 +02:00
Mikhael Bogdanov
083bcade5f Minor. Reformat 2018-05-18 12:57:58 +02:00
Alexander Udalov
11653c6800 Move checkTypePosition to VarianceChecker in frontend
This is a partial revert of 279ff0b, which is no longer needed because
of the previous commit
2018-05-18 11:56:14 +02:00
Alexander Udalov
0e190e885a Remove UnsafeVarianceTypeSubstitution
Looks like it's not really used for anything
2018-05-18 11:56:14 +02:00
Alexey Sedunov
d2bfb8caec Configuration: Add migration of JPS project to new non-jvm source roots 2018-05-18 12:09:40 +03:00
Alexey Sedunov
9fa26c83b6 Configuration: Introduce special source roots for non-JVM Kotlin modules
#KT-5948 Fixed
 #KT-23672 Fixed
2018-05-18 12:09:40 +03:00
Alexey Sedunov
1fb1431257 Configuration: Setup project settings even if library is not detected
#KT-22305 Fixed
2018-05-18 12:09:39 +03:00
Alexey Sedunov
eb14625851 Configuration: Detect platform of libraries added via maven artifact ids
#KT-20511 Fixed
2018-05-18 12:09:39 +03:00
Alexey Sedunov
06f9be1899 Configuration: Unify presentable names of Kotlin configurators
#KT-23658 Fixed
2018-05-18 12:09:39 +03:00
Alexey Sedunov
4a98f1dccc Misc: Follow-up fixes for 172/182 bunches 2018-05-18 12:09:38 +03:00
Alexey Tsvetkov
55b61bdc53 Turn off inter-project IC when unknown task writes to java output dir 2018-05-17 20:55:27 +03:00
Alexey Tsvetkov
ea255ac854 Rebuild when dependency was built non-incrementally 2018-05-17 20:55:27 +03:00
Alexey Tsvetkov
53266300d4 Implement module detection for Gradle IC with Android
#KT-22431 fixed
2018-05-17 20:55:26 +03:00
Alexey Tsvetkov
e5cdc64f4f Track changes for jar files for non-Android Gradle projects 2018-05-17 20:55:26 +03:00
Alexey Tsvetkov
61e330fa57 Track inter-project IC changes for Java 2018-05-17 20:46:52 +03:00
Alexey Tsvetkov
6a45310830 Remove global artifact history cache in Gradle
Each Kotlin task now writes build history to separate file.
A map of output directories to history files is used to get changes for
modified files.

    #KT-22623 fixed
2018-05-17 20:46:52 +03:00
Alexander Udalov
598e89c03d Update bunch files for KotlinTestUtils after 9dbeb79340 2018-05-17 12:43:30 +02:00
Alexander Udalov
d7c77e522c Do not render UnsafeVariance in tests on built-ins
This fixes LoadBuiltInsTest which failed because UnsafeVariance was
rendered in the lazy resolve result, but was not in the deserialized
result (because it has SOURCE retention)
2018-05-17 12:38:57 +02:00
Nikolay Krasko
2754429573 Minor: fix in comment 2018-05-17 12:27:30 +03:00
Nikolay Krasko
580e2972db Initial settings for incompatible API inspection 2018-05-17 12:27:30 +03:00
Nikolay Krasko
3ef67e1d9d Inspection for highlighting problem API usage
It's planned to use this inspection for show patchset branches problems
during development process.
2018-05-17 12:27:29 +03:00
Nikolay Krasko
a95ec598f2 Refactoring: move accessor name generators to companion object for reuse 2018-05-17 12:27:28 +03:00
Nikolay Krasko
0acb7d8200 Minor: reformat files 2018-05-17 12:27:28 +03:00
Alexey Tsvetkov
f9af48c19e Test Java is up-to-date when Kotlin ABI is unchanged 2018-05-16 21:36:48 +03:00
Alexey Tsvetkov
b2d13ac89b Fix Kapt incremental test with Gradle >= 4.3 2018-05-16 21:36:48 +03:00
Alexander Udalov
ed2439c905 Minor, move version declaration to the correct place 2018-05-16 19:16:08 +02:00
Alexander Udalov
e1a4bd01f5 Add anonymousObjectOriginName/lambdaClassOriginName to kotlinx-metadata
#KT-21320
 #KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov
b97379b39b Provide stable JVM names for kotlinx-metadata file facades
#KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov
c87218ac6c Use JvmMetadataVersion/JvmBytecodeBinaryVersion in kotlinx-metadata
#KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov
ffa6b6233b Minor, make BinaryVersion.numbers private
Use BinaryVersion.toArray instead, as in all other usages
2018-05-16 17:16:22 +02:00
Alexander Udalov
1b15619457 Move BinaryVersion to metadata, JVM versions to metadata.jvm
To be used in kotlinx-metadata
2018-05-16 17:16:22 +02:00
Alexander Udalov
e5a5d834ab Add "-verbose" to kotlinp tool, change type parameter name rendering
Only render the actual name of the type parameter in the verbose mode

 #KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov
23d107c11d Support multiple MetadataExtensions instances in kotlinx-metadata
#KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov
c42001f550 Refactor flags in kotlinx-metadata
- rename object Flags to Flag and merge it with MetadataFlag
- use typealias Flags instead of Int
- use top level function "flagsOf" instead of "Flags.invoke" to
  construct a bitmask

 #KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov
002310ff6e Add ReadMe for kotlinx-metadata and kotlinx-metadata-jvm
#KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov
9dbeb79340 Test kotlinx-metadata and kotlinp on compiler test data
#KT-23198
2018-05-16 17:16:21 +02:00
Alexander Udalov
bef759161f Support .kotlin_module files in kotlinx-metadata
#KT-23198
2018-05-16 17:16:21 +02:00
Alexander Udalov
a751d02306 Implement writing visitors for kotlinx-metadata
#KT-23198
2018-05-16 17:16:21 +02:00
Alexander Udalov
4b284a4890 Add kotlinp, a tool to print Kotlin metadata in class/module files
At the moment, it's not published anywhere, but that may change soon

 #KT-23198
2018-05-16 17:16:21 +02:00
Alexander Udalov
e4062f6447 Add kotlinx-metadata library for handling Kotlin metadata
#KT-23198
2018-05-16 17:16:21 +02:00
Ilya Gorbunov
8ab49a70e9 Make dexMethodCount task incremental unless teamcity output is required
Declare details file as output, circumvent task up-to-date check if teamcity statistics output is required.
2018-05-16 17:48:05 +03:00
Ilya Gorbunov
e7b445e4b5 Fix incorrect @returns tag usage and improve padStart/End docs
#KT-24371 Fixed
2018-05-16 17:43:12 +03:00
Ilya Gorbunov
15d21a0532 Remove UnsafeVariance from expected testdata for serialized builtins tests
UnsafeVariance source annotation is no longer serialized as a result of KT-23360
2018-05-16 17:37:02 +03:00
Ilya Gorbunov
a69694a5d5 Advance bootstrap to build 1.2.60-dev-58 2018-05-16 17:37:02 +03:00
Yan Zhulanow
20cb4e91b3 Do not retain proxy-based components for compiler plugin settings in project model 2018-05-16 17:04:03 +03:00
Nicolay Mitropolsky
29ef8650f7 182: gson set to 2.8.4 2018-05-16 13:16:26 +03:00
Mikhail Glukhikh
6a1ddd6c70 Lambda to anonymous: report only from left brace to arrow 2018-05-16 13:01:38 +03:00
Mikhail Glukhikh
f4acaae364 Lambda to anonymous: use type renderer & shorten references 2018-05-16 13:01:38 +03:00
Mikhail Glukhikh
0f2879aa32 Rename: SOURCE_CODE_SHORT_NAMES_IN_TYPES -> *_SHORT_NAMES_NO_ANNOTATIONS 2018-05-16 13:01:37 +03:00
Mikhail Glukhikh
06f7e77006 Introduce new type renderers (no parameters & built-in annotations) 2018-05-16 13:01:37 +03:00
Mikhail Glukhikh
1ba99fde56 "lambda to anonymous": add tests for qualified types (KT-7710) 2018-05-16 13:01:37 +03:00
Mikhail Glukhikh
257664cf1b Make "lambda to anonymous" low-priority (KT-7710) 2018-05-16 13:01:36 +03:00
Mikhail Glukhikh
bd6fdb743c Lambda to anonymous function: use callable builder (KT-7710) 2018-05-16 13:01:36 +03:00
Toshiaki Kameyama
8a20d1bf01 Add intention to convert lambda to anonymous function #KT-7710 Fixed 2018-05-16 13:01:36 +03:00
Nikolay Krasko
8ef4b9a8e1 Don't show type hierarchy for elements without name 2018-05-16 12:55:09 +03:00
Nikolay Krasko
062a212b61 Don't build light classes for local classes with parse errors (KT-24323, EA-107235)
Also use checks for building light classes in `getLightClassDataHolder`.
2018-05-16 12:55:09 +03:00
Nikolay Krasko
15a704fe36 Use comment directive for not generated case to be valid Java file 2018-05-16 12:55:08 +03:00
Nikolay Krasko
f2c642eefb Fight with valid absent, corrupted and missing files in archives (EA-119686)
Inspired by ClassFileViewProvider.
2018-05-16 12:55:08 +03:00
Nikolay Krasko
c35f8d621a Use separate dirs in pill for running IDE to avoid test misbehaviour 2018-05-16 12:55:08 +03:00
Ilya Chernikov
612de2e342 Fix the invalid code after "Fix order of jars" commit 2018-05-16 07:24:21 +02:00
Vyacheslav Gerasimov
a1c551faaf as32: Make use of createIfNecessaryParameter of AndroidModuleInfoProviderImpl.getApplicationResourceDirectories 2018-05-15 22:32:20 +03:00
Vyacheslav Gerasimov
995352c20f Restore j2k.jar in cidr plugin
Excluding it requires more complex refactoring, wip
2018-05-15 22:11:01 +03:00
Ilya Chernikov
b2bda5c017 Enumerate roots for script definitions only if project is initialized
fixes #KT-23805
2018-05-15 19:27:09 +02:00
Ilya Chernikov
4b949ef303 Fix order of jars for the scripting plugin:
if gradle project is being built with JPS, the gradle scripting plugin
is passed in the plugin classpath. Since it is rebased on the embeddable
compiler, it hides expected plugin registrar signature, which leads to
the AbstractMethodError on attempt to load the plugin. Putting incoming
classpath at the end of the resulting one fixes the issue.
Fixes #KT-24448
2018-05-15 19:26:42 +02:00
Alexey Tsvetkov
ea1a4f75ba Fix incremental android extensions test
Weirdly merge resource task was failing when run incrementally
if support library is present
2018-05-15 18:40:54 +03:00
Alexey Tsvetkov
6edba56adb Fix Android IC test
Previously some Kotlin files were recompiled, because Java files
were regenerated.
However this is no longer true for some time since
precise Java tracking was implemented.
2018-05-15 18:40:54 +03:00
Mike
a038a88bfa More correct NOTHING_TO_INLINE description
Strictly speaking, they are not 'lambda parameters', they are 'functional parameters' or 'parameters of functional types'.
Sorry for my pedantry.
2018-05-15 16:27:45 +02:00
Mikhael Bogdanov
f4f01efd1f Avoid descriptors usage in IrFunction flag calculation 2018-05-15 16:07:07 +02:00
Mikhael Bogdanov
e9216625f0 Update logic to $default function lowering (don't skip interface members) 2018-05-15 16:06:31 +02:00
Mikhael Bogdanov
9d36367fbd Minor. Code clean: use class kind utils 2018-05-15 16:06:30 +02:00
Mikhael Bogdanov
678b1101cb Add class kind utils 2018-05-15 16:06:28 +02:00
Mikhael Bogdanov
6590666983 Run ir test in parallel 2018-05-15 16:06:00 +02:00
Mikhael Bogdanov
9546c36c3c Get rid of 'descriptor.isInner()' call 2018-05-15 16:06:00 +02:00
Mikhael Bogdanov
b9da331dcd Migrate DescriptorsFactory.getInnerClassConstructorWithOuterThisParameter() API to symbols 2018-05-15 16:05:59 +02:00
Mikhael Bogdanov
9103b6a51b Migrate DescriptorsFactory.getOuterThisFieldSymbol() API to symbols 2018-05-15 16:05:59 +02:00
Mikhael Bogdanov
ee98556669 Migrate DescriptorsFactory caching to symbols 2018-05-15 16:05:58 +02:00
Mikhael Bogdanov
d4d8fe4995 Migrate DescriptorsFactory.getSymbolForObjectInstance() API to symbols 2018-05-15 16:05:57 +02:00
Mikhael Bogdanov
2631d149b2 Migrate DescriptorsFactory.getFieldDescriptorForEnumEntry() API to symbols 2018-05-15 16:05:55 +02:00
Mikhael Bogdanov
9fad3f25f3 Minor. Reformat 2018-05-15 16:04:47 +02:00
Yan Zhulanow
9277d6a160 Pill: Import Kotlin facets 2018-05-15 16:29:52 +03:00
Yan Zhulanow
215053efc9 Pill: Fetch kotlin compilation arguments 2018-05-15 16:29:51 +03:00
Yan Zhulanow
923fbaaca6 Pill: Fix launching debuggable Android Studio on 'as' bunches 2018-05-15 16:29:50 +03:00
Yan Zhulanow
614033d64c Pill: Import all defined source sets, not only "src" and "test" 2018-05-15 16:29:49 +03:00
Yan Zhulanow
2bf439d3fb Pill: Attach gradle-api dependency 2018-05-15 16:29:48 +03:00
Yan Zhulanow
c439b6d38b Pill: Import common modules as libraries 2018-05-15 16:29:47 +03:00
Yan Zhulanow
33a8843d34 Pill: Download Android jars only if pill.android.tests option is set 2018-05-15 16:29:46 +03:00
Yan Zhulanow
5fc18755ca Pill: Exclude 'build' dirs from excluded projects 2018-05-15 16:29:46 +03:00
Yan Zhulanow
ba5836d666 Pill: Introduce pill{} extension to set extended Pill configuration
Also introduce the flavor concept which allows to specify what part of Kotlin project should be imported.
2018-05-15 16:29:45 +03:00
Dmitry Petrov
a57869993d Fix asserted cast in IrBuilderWithScope.irReturn 2018-05-15 15:43:56 +03:00
Dmitry Petrov
21dfee4565 psi2ir: inferred type for 'when' is Nothing only if it's exhaustive
TODO: fix inference bug
2018-05-15 15:43:56 +03:00
Dmitry Savvinov
70622ff668 Introduce -Xoutput-imports mode of JVM compiler
In this mode, instead of analyzing files and generating bytecode for
them, compiler just saves imports of each file in JSON map of form

'<path to file> -> [<import1>, <import2>, ...]'

It is needed for some external tools, notably for Google3 toolchain.
2018-05-15 15:36:14 +03:00
Mikhail Glukhikh
bec1ae3d94 Reformat: replace with operator assignment 2018-05-15 13:28:08 +03:00
Mon_chi
c49eaf2604 Fix hint text for replace with operator assignment #KT-23559 Fixed 2018-05-15 13:26:23 +03:00
Mikhail Glukhikh
8c3e787584 Convert KFunction to Function in type mismatch fixes #KT-16770 Fixed 2018-05-15 13:22:48 +03:00
Mikhail Glukhikh
25609f1159 Create kotlin file: create abstract class if its name contains Abstract
So #KT-21844 Fixed
2018-05-15 11:30:32 +03:00
Mikhail Glukhikh
1f8e24fa82 Reformat: NewKotlinFileAction 2018-05-15 11:30:30 +03:00
Mikhail Glukhikh
c61b5671c9 Fix testSuspend (protect it from flaky error about disabled coroutines) 2018-05-15 11:30:29 +03:00
Ilya Chernikov
0026a138d3 Add changelog from 1.2.40 - 1.2.41 2018-05-14 21:48:40 +02:00
Ilya Gorbunov
1d0d801744 Minor merge cleanup: remove unused variable 2018-05-14 18:24:31 +03:00
Ilya Gorbunov
864f0fecf6 KT-24353 Include kotlin-test-junit5 into coreLibraries, use JDK_18 to build and test it 2018-05-14 17:37:06 +03:00
evgzakharov
634279621d KT-24353 change junit5 version to minimal possible (5.2.0 -> 5.0.0)
However use the latest version of junit engine for running tests.
2018-05-14 17:36:34 +03:00
evgzakharov
84ee97cae9 KT-24353 add support for junit 5 in kotlin.test 2018-05-14 17:36:34 +03:00
Simon Ogorodnik
6967028fdb KT-24146: Fix inserts imports automatically
Even if "add unambiguous imports on the fly" is off

 #KT-24146 fixed
2018-05-14 17:28:16 +03:00
Denis Zharkov
9de174959e Support androidx under-migration-like nullability annotations
They are hardcoded to avoid having dependency from android.jar on
our annotations' jar with UnderMigration.

Even while it could be a compile-only dependency we need to make sure
that annotated types are read properly without RecentlyNonNull/RecentlyNullable
in the classpath

 #KT-24278 Fixed
2018-05-14 17:16:15 +03:00
Denis Zharkov
e0f09e5571 Minor. Reformat signature enhancement parts 2018-05-14 17:16:15 +03:00
Igor Chevdar
6daabca90b Fixed forgotten receivers during copying 2018-05-14 16:01:13 +03:00
Natalia Selezneva
4ee41d502a Scratch: report errors at the correct line
^KT-24364 Fixed
2018-05-14 15:55:44 +03:00
Natalia Selezneva
6427c79110 Trim last newline in scratch output with REPL
^KT-24362 Fixed
2018-05-14 15:55:39 +03:00
Natalia Selezneva
02fa8b5bab Check for dumb mode before compiling scratch file
^KT-23560
2018-05-14 15:55:35 +03:00
Natalia Selezneva
57b24007ac Log exceptions thrown during Run Scratch Action 2018-05-14 15:55:30 +03:00
Natalia Selezneva
5148a51ea2 Minor: reformat 2018-05-14 15:55:26 +03:00
Nicolay Mitropolsky
31b21a7bc8 182: compilation fix due to quickFixActionMarkers made nullble 2018-05-14 15:05:03 +03:00
Ilya Chernikov
b3219cb762 Implement lazy script definition and light discovery in cli plugin, ...
update appropriate parts of the scripting infrastructure
2018-05-14 11:13:44 +02:00
Dmitry Petrov
0feb50021c IrClass.isInner 2018-05-14 10:37:27 +03:00
Natalia Selezneva
1e92dbf806 Fix tests: attach script reports in cli 2018-05-14 09:21:09 +03:00
Ilya Chernikov
f89d5e94c5 Fix build in 182 branch 2018-05-13 10:59:47 +02:00
Ilya Chernikov
c74924fb8c Fix lz4 dependency...
after snappy was replaced by lz4 in the platform (see the previous commit
with related test for the more info)
2018-05-12 19:02:04 +02:00
Alexey Tsvetkov
38ffd6f85e Add test for missing lz4 dependency
Adds Gradle test for the exception:
`java.lang.ClassNotFoundException: net.jpountz.lz4.LZ4Factory`

The exception breaks IC in Gradle. Gradle compiles non-incrementally as
a fallback strategy, so the build succeeds, but IC is not working.

IC uses persistent hash tables from Intellij as caches.
These tables's buffers are compressed when full.
Previously snappy was used for compression, but 181 platform switched to
LZ4, which was cut out by proguard.

The problem could only be reproduced with Gradle,
since in JPS plugin all caches are managed by JPS process,
which contains the necessary library.

To reproduce the compiler needs to be processed by proguard
(which always happens on TeamCity).
Many classes are needed to trigger the compression.
2018-05-12 19:02:04 +02:00
Vyacheslav Karpukhin
e329af0932 Excluded declarations for classes in CIDR plugin.xml 2018-05-11 19:43:21 +02:00
Zalim Bashorov
0ca6dbcb82 [JS IR BE] remove no longer needed descriptor based utils 2018-05-11 20:27:54 +03:00
Roman Artemev
c9b8aadfff Update test data 2018-05-11 18:50:41 +03:00
Natalia Selezneva
4ee0f401c6 Fix master_172
Remove GradleScriptDefaultDependenciesProvider as unused
2018-05-11 18:46:54 +03:00
Mikhail Glukhikh
1012bdb577 Convert to primary constructor: minor enhancement (KT-19629) 2018-05-11 18:17:42 +03:00
Mikhail Glukhikh
67d2abbe5e Reformat: Convert to primary constructor 2018-05-11 17:36:41 +03:00
Toshiaki Kameyama
a41064295b "Convert to primary constructor": do not move init section down
So #KT-19629 Fixed
2018-05-11 17:36:40 +03:00
Mikhail Glukhikh
9a1253c5c7 Specify type explicitly: suggest also types from overridden
So #KT-22092 Fixed
2018-05-11 17:36:38 +03:00
Mikhail Glukhikh
bf15d22ef1 Reformat: SpecifyTypeExplicitlyIntention 2018-05-11 17:36:37 +03:00
Mikhail Glukhikh
13be7803bb Introduce "redundant async" inspection #KT-24235 Fixed 2018-05-11 17:36:35 +03:00
Mikhail Glukhikh
365c13c38e Extract AbstractCallChainChecker from SimplifiableCallChainInspection 2018-05-11 17:36:29 +03:00
Mikhail Glukhikh
9fa352e5c0 Reformat: simplifiable call chain inspection 2018-05-11 17:36:26 +03:00
Pavel V. Talanov
a584de8a7e Prefer platform specific declarations when searching for library sources
Untested: test infrastructure needed

 #KT-23223 Fixed
2018-05-11 16:25:16 +02:00
Pavel V. Talanov
f6b094781f Mpp resolve: ignore module dependencies on libraries of other platforms
These are not read by the compiler

Untested: test infrastructure needed

 #KT-20406 Fixed
2018-05-11 16:25:14 +02:00
Roman Artemev
24e477c378 Update test data 2018-05-11 17:14:30 +03:00
Roman Artemev
131fb642aa Fix initializer lowering crash during deep copy 2018-05-11 17:14:30 +03:00
Toshiaki Kameyama
449943da01 "Merge with next when": made applicable when delimited by ';' or comment
So #KT-12042 Fixed
2018-05-11 16:37:36 +03:00
Toshiaki Kameyama
cdbd7a7c5a Reformat MergeWhenIntention 2018-05-11 16:36:57 +03:00
Toshiaki Kameyama
4ee9db7a6c Use property access: suppress for reserved words #KT-23775 Fixed 2018-05-11 16:32:44 +03:00
Toshiaki Kameyama
240b9fd97a Reformat: UsePropertyAccessSyntaxIntention 2018-05-11 16:32:06 +03:00
Derek
c12bd9b506 fix gradle license path (#1658) 2018-05-11 16:08:40 +03:00
Alexey Sedunov
805010e75c Misc: Permit refactorings/intentions/quick fixes inside script files
#KT-20123 Fixed
2018-05-11 16:05:20 +03:00
Alexey Sedunov
a5a13b74f5 Create from Usage: Support smart casts on explicit receivers
#KT-24069 Fixed
2018-05-11 16:05:20 +03:00
Alexey Sedunov
a92a4a2a6d Add Parameter Fix: Support smart casts
#KT-24207 Fixed
2018-05-11 16:05:19 +03:00
Alexey Sedunov
a4a10c7ba4 Create from Usage: Fix generation of extensions with nullable receiver
#KT-23796 Fixed
2018-05-11 16:05:19 +03:00
Alexey Sedunov
4e3c1e9f56 Rename: Do not search text occurrences of local declarations
#KT-23838 Fixed
2018-05-11 16:05:19 +03:00
Derek
f8111c9f23 fix bullet point indentation in license readme (#1659) 2018-05-11 16:04:45 +03:00
Sergey Igushkin
2a46648e3e In Android MPP target, add common module dependency to api configuration
Since Android considers the `compile` configuration as deprecated and
reports a warning when a dependency is added to it, use the `api`
configuration when dealing with an Android platform module.

Issue #KT-23719 Fixed
2018-05-11 16:03:33 +03:00
Natalia Selezneva
37d7c36b11 Fix missing internal template declaration in plugin.xml 2018-05-11 15:51:52 +03:00
Natalia Selezneva
9535c82149 Backport ScriptSeverity.FATAL to old script API
(cherry picked from commit dceb063)
2018-05-11 15:51:47 +03:00
Natalia Selezneva
41653e9a50 Introduce separate cache for scripts
^KT-22588 Fixed
2018-05-11 15:51:42 +03:00
Natalia Selezneva
71703636bc Optimization: do not load dependencies for scripts not under expected location 2018-05-11 15:51:37 +03:00
Natalia Selezneva
61c31ce030 Refactoring: move logic that script shouldn't be highlighted if there are any FATAL error to KotlinHighlightingUtil 2018-05-11 15:51:33 +03:00
Natalia Selezneva
3cc3ca97ac Show notification in the editor when new script dependencies available
^KT-23616 Fixed
2018-05-11 15:51:28 +03:00
Natalia Selezneva
d422eb6833 Add a delay to reload script dependencies
^KT-23616
2018-05-11 15:51:24 +03:00
Natalia Selezneva
3eac391793 Add setting to reload script dependencies on file change
^KT-23616
2018-05-11 15:51:19 +03:00
Natalia Selezneva
082916be70 Refactoring of ScriptDependenciesUpdater
Extract classes for sync and async dependencies loading
2018-05-11 15:51:14 +03:00
Natalia Selezneva
97848f2812 Minor: reformat 2018-05-11 15:51:09 +03:00
Natalia Selezneva
3f8245988e Remove GradleScriptDefaultDependenciesProvider as unused 2018-05-11 15:51:04 +03:00
Florian Steitz
8453ed1803 [KT-10456] Move tests from StringNumberConversionJVMTest to StringNumberConversionTest 2018-05-11 15:42:11 +03:00
Florian Steitz
d7bada0c29 [KT-10456] Added JS implementation for Int.toString(radix) and similar overloads 2018-05-11 15:42:11 +03:00
Sergey Igushkin
284b5b9860 (minor fix) Remove extra underscore from module names 2018-05-11 15:37:17 +03:00
Vyacheslav Karpukhin
d56ba1e7a4 Excluded declarations for classes in CIDR plugin.xml 2018-05-11 13:28:22 +02:00
Nicolay Mitropolsky
05be8f7536 UastKotlinPsiVariable: hashCode nullability fix (EA-119715) 2018-05-11 12:57:23 +03:00
Nikolay Krasko
bea77900ff Fix NPE in KotlinCompletionCharFilter (EA-120148) 2018-05-11 12:00:43 +03:00
Nikolay Krasko
c469a4d9b9 Bad condition for cast in KotlinStatementsSurrounder (EA-119701) 2018-05-11 12:00:43 +03:00
Nikolay Krasko
9e2412b887 Create dummy method for light class without reformat (EA-115803) 2018-05-11 12:00:43 +03:00
Nikolay Krasko
c9f31099f2 Fix binary compatibility issue after moving ModuleTestSourceInfo
Compatibility check revealed problem in truth-postfix-plugin.

b06adbf4e6/plugin/src/main/kotlin/com/github/droibit/plugin/truth/postfix/utils/TemplateUtils.kt
2018-05-11 12:00:43 +03:00
Roman Artemev
d71ff1818d Add test 2018-05-11 11:33:23 +03:00
Roman Artemev
455edae7de Fix name clashing between constructors in function reference lowering 2018-05-11 11:33:23 +03:00
Roman Artemev
4f2d5baa5d [KT-24335]
Fix inheritance from interface which is also inherited from an external interface
Add test case
2018-05-11 11:26:34 +03:00
Dmitry Petrov
93f5fe2451 IrField is 'final' if corresponding property is 'val' 2018-05-11 11:24:46 +03:00
Dmitry Petrov
d83849eec5 IR: IrValueSymbol.owner: IrValueDeclaration 2018-05-11 11:24:46 +03:00
Dmitry Petrov
1592aa499f IR: IrFunctionSymbol.owner: IrFunction
This requires some class hierarchy juggling around
IrFunction and IrReturnableBlock.
2018-05-11 11:24:46 +03:00
Dmitry Petrov
f500329dac IR: IrFunction.name 2018-05-11 11:24:46 +03:00
Dmitry Petrov
729efaf912 IR: IrConstructor.isPrimary
NB this is required for Kotlin/JS.
2018-05-11 11:24:46 +03:00
Dmitry Petrov
a6057fb499 IR: {IrClass, IrFunction, IrProperty, IrField}.isExternal 2018-05-11 11:24:46 +03:00
Dmitry Petrov
9717345e3b IR: IrField.isFinal 2018-05-11 11:24:46 +03:00
Vyacheslav Gerasimov
9721ca8d09 as32: Update compiler.pro for AS 3.2 C14 2018-05-10 23:28:42 +03:00
Nikolay Krasko
6f6237aedb Unneeded bunch file for autowiredConstructor.test in 172 2018-05-10 23:28:41 +03:00
Nikolay Krasko
4e26b04bb2 Remove unneeded files after move to 181 from 173 2018-05-10 23:28:41 +03:00
Vyacheslav Gerasimov
c1f5ebb28e as32: Fix usages of AppResourceRepository in AS 3.2 C14 plugin 2018-05-10 23:28:41 +03:00
Vyacheslav Gerasimov
4adc0a94ab as32: Update to 181 platform api 2018-05-10 23:28:41 +03:00
Vyacheslav Gerasimov
ab25145458 as32: Restore uast to 181 platform state 2018-05-10 23:28:41 +03:00
Vyacheslav Gerasimov
daa860651f as32: Update AS 3.2 version to 3.2.0.13 2018-05-10 23:28:41 +03:00
Alexey Tsvetkov
c026c7f24b Filter out non-Java files from kapt inputs
#KT-23878 fixed
2018-05-10 22:01:06 +03:00
Alexey Tsvetkov
5f3c57e69a Filter out generated Java files from stubs generation inputs 2018-05-10 21:58:35 +03:00
Anton Bannykh
23fb5107c7 JS: fix Long inlining (private, companion) (KT-24189 fixed). 2018-05-10 21:06:50 +03:00
Toshiaki Kameyama
da92c844a6 Might be 'const': fix false positive in object literal #KT-23756 Fixed 2018-05-10 20:42:32 +03:00
Mikhail Glukhikh
84d71e5a8c "Wrap with let": minor enhancement (related to KT-6364) 2018-05-10 20:41:53 +03:00
Toshiaki Kameyama
b6564ed19a "Wrap with let": fix for nullable extension function call #KT-6364 Fixed 2018-05-10 20:28:14 +03:00
Sergey Igushkin
093842932f Filter some characters out of module names passed to Kotlin from Gradle
This addresses the cases when a module name contains a slash
 (e.g. when the Gradle project name was set this way to point
Gradle to the directory), which led to Kotlin module file being placed
under a subdirectory of META-INF and thus undiscoverable for the
compiler and reflect.

Additionally, this fix removes characters \n, \r, \t whose
presence in a module name caused compilation failures.

Issue #KT-20608 Fixed
2018-05-10 19:17:03 +03:00
Mikhail Glukhikh
a8ad980910 If to when: label break / continue if necessary #KT-11427 Fixed 2018-05-10 18:46:24 +03:00
Mikhail Glukhikh
2812601e2d Reformat: add loop label 2018-05-10 18:46:18 +03:00
Mikhail Glukhikh
73a756084e Reformat: if to when 2018-05-10 18:46:17 +03:00
Ilya Gorbunov
d9d7b87fd9 Reformat kotlin.test library 2018-05-10 16:27:15 +03:00
Vyacheslav Gerasimov
06aaa990be Build: Exclude maven from CIDR plugin artifact 2018-05-08 21:49:08 +03:00
Vyacheslav Gerasimov
3d7f2f663f Build: Extract maven ide module from kotlin-plugin.jar to standalone jar 2018-05-08 21:49:08 +03:00
Vyacheslav Gerasimov
f666db74f9 Build: Exclude standalone kotlin compiler and jps from CIDR artifact 2018-05-08 21:49:08 +03:00
Vyacheslav Gerasimov
f2b323fbe3 Build: Extract jps-common ide module from kotlin-plugin.jar to standalone jar 2018-05-08 21:49:08 +03:00
Vyacheslav Gerasimov
4d4ff636d2 Build: Extract jvm ide module from kotlin-plugin.jar to standalone jar 2018-05-08 21:49:07 +03:00
Vyacheslav Gerasimov
80f5a1d44d Build: Exclude j2k from CIDR plugin artifact 2018-05-08 21:49:07 +03:00
Vyacheslav Gerasimov
282f2a46b1 Build: Exclude kapt from CIDR plugin artifact 2018-05-08 21:49:07 +03:00
Vyacheslav Gerasimov
42cfacdf0c Build: Extract j2k to standalone jar 2018-05-08 21:49:07 +03:00
Vyacheslav Gerasimov
8773e2d6f3 Build: Fix zipCidrPlugin destination file name, missed zip extension 2018-05-08 21:49:07 +03:00
Toshiaki Kameyama
3aab68d635 Add "Make variable immutable" quickfix for const #KT-24263 Fixed 2018-05-08 18:37:10 +03:00
Toshiaki Kameyama
d1c2ea4095 Reformat: QuickFixRegistrar 2018-05-08 18:37:10 +03:00
Toshiaki Kameyama
e26ab28d45 Reformat: ChangeVariableMutabilityFix 2018-05-08 18:37:10 +03:00
Mikhail Glukhikh
e141f4f407 Convert array to vararg: extract text variants to constants 2018-05-08 18:37:09 +03:00
Toshiaki Kameyama
da92eb63a0 Add intention replacing vararg with array and vice versa #KT-23419 Fixed 2018-05-08 18:37:09 +03:00
Mikhail Glukhikh
e933bb8220 Unused symbol suppression: get annotation descriptors via entries
Otherwise we miss use-site targeted annotations,
and getUseSiteTargetedAnnotations does not help
So #KT-20332 Fixed
2018-05-08 18:37:09 +03:00
Mikhail Glukhikh
59c019cb00 Reformat: unused symbol inspection 2018-05-08 18:37:08 +03:00
Mikhail Glukhikh
78ed39856e UnnecessaryVariableInspection: do not show dialogs #KT-22989 Fixed 2018-05-08 18:37:08 +03:00
Mikhail Glukhikh
39c0b57724 Reformat: UnnecessaryVariableInspection 2018-05-08 18:37:08 +03:00
Mikhail Glukhikh
de85235bd7 Reformat: KotlinInlineValHandler 2018-05-08 18:37:07 +03:00
Mikhail Glukhikh
5246c54dad Do not suggest removing empty parentheses if lambda is on the next line
So #KT-15195 Fixed
2018-05-08 18:37:07 +03:00
Mikhail Glukhikh
6968540889 Reformat: RemoveEmptyParenthesesFromLambdaCallIntention 2018-05-08 18:37:07 +03:00
Nicolay Mitropolsky
24b8d12eca 182: fixing SlicePanel compilation after isToShowCloseButton method removal 2018-05-08 18:35:04 +03:00
Ilya Chernikov
e727e20973 [minor] Improve daemon exceptions logging 2018-05-08 15:59:45 +02:00
Alexey Tsvetkov
89da660186 Replace assertContains with assertTasksExecuted/assertTasksUpToDate 2018-05-08 15:24:45 +03:00
Alexey Tsvetkov
f00e243822 Reformat :kotlin-gradle-plugin-integration-tests 2018-05-08 15:24:45 +03:00
Alexey Tsvetkov
39c000bb4d Add vararg overloads for Gradle test utils 2018-05-08 15:24:45 +03:00
Nicolay Mitropolsky
cf43be9fa3 UAST: replacing deprecated JvmDeclarationUElement with JvmDeclarationUElementPlaceholder (#KT-23887)
To make it possible to delete `JvmDeclarationUElement` in IDEA-182
2018-05-08 15:21:13 +03:00
Nikolay Krasko
7b80fb0431 Mark actions as internal to prevent "Other" group creation (KT-24268)
#KT-24268 Fixed
2018-05-08 13:04:27 +03:00
Nikolay Krasko
b19ad7e94c Reformat: idea.highlighter package 2018-05-08 13:04:27 +03:00
Nicolay Mitropolsky
732e25a3f0 KotlinElementActionsFactory: fix for getting names from dead pointers (EA-116215) 2018-05-08 12:57:29 +03:00
Mikhail Zarechenskiy
37a8844050 Update bunch files for kotlinInternalUastUtils
After 5815e790ba and d6405c8147
2018-05-08 12:03:17 +03:00
Mikhail Zarechenskiy
eee59cb23c Fix deserialization of inline functions from inline classes
This fixes:
 CompileKotlinAgainstInlineKotlinTestGenerated$InlineClasses.testInlineFunctionInsideInlineClassesBox 

 Consider the following binary dependency:

 inline class UInt(val u: Int) {
    inline fun foo() {}
 }

 Now, if we want to inline function `foo`, we have to load it from bytes
 as ASM method and to do this we should know the container of this function.

 Note that because of inline class, actual signature of this function
 would be `foo(I)` and it will be stored in UInt$Erased class, not `UInt`
2018-05-08 11:54:24 +03:00
Natalia Selezneva
7fe21f3035 Do not throw exception when script template doesn't have required annotation
^KT-23746 Fixed
2018-05-08 11:40:51 +03:00
Natalia Selezneva
522587dc5d Align checkbox labels in scratch panel
^KT-24315 Fixed
2018-05-08 11:40:51 +03:00
Natalia Selezneva
e5a40c8c7f Scratch: substring output and print it to separate tool window if it is too long
^KT-24016 In Progress
2018-05-08 11:40:51 +03:00
Natalia Selezneva
613ea94376 Allow reference search in scratches
^KT-23563 Fixed
^KT-23587 Fixed
2018-05-08 11:40:51 +03:00
Natalia Selezneva
db2bcff390 Restore scratch options after IDE restart
^KT-23441 Fixed
2018-05-08 11:40:51 +03:00
Natalia Selezneva
178dad3b4e Refactoring: introduce file attribute utils 2018-05-08 11:40:51 +03:00
Natalia Selezneva
bed5a3c8f3 Scratch: find correct line to report error at
^KT-23480 Fixed
EA-117936 Fixed
2018-05-08 11:40:51 +03:00
Natalia Selezneva
62fadd9086 Scripts: GradleScriptTemplateProvider should be the first in the contributors list.
This is needed to avoid broking .gradle.kts support by external plugins
2018-05-08 11:40:51 +03:00
Dmitry Savvinov
58eb117ae1 Improve message of exception thrown from codegen
Don't lose information about which file caused crash.
2018-05-08 11:28:40 +03:00
Natalia Selezneva
47bafb8c75 Regenerate IntentionTestGenerated 2018-05-08 09:10:51 +03:00
Natalia Selezneva
1aecd2058c Fix testdata after 534cbae4ef
^KT-14391
2018-05-08 09:02:35 +03:00
Vyacheslav Gerasimov
838f1f91fc Build: Extract android ide modules from kotlin-plugin.jar to standalone jars
So we could exclude them in IDEs which don't have android plugin (AppCode, CLion)
2018-05-08 00:26:04 +03:00
Vyacheslav Gerasimov
ec1a9d9907 Move uast service registration to jvm.xml 2018-05-08 00:25:22 +03:00
Vyacheslav Gerasimov
da9175febd Build: Exclude uast and lint artifacts from CIDR plugin
There is no java in CIDR platform and java dependent modules should be excluded
2018-05-08 00:25:07 +03:00
Vyacheslav Gerasimov
e6f64519e4 Build: Copy uast to idea plugin as separate artifacts 2018-05-08 00:24:22 +03:00
Sergey Igushkin
8fda174fb0 Add the compiler classpath of the KotlinCompile task as KaptTask's input
KaptTask was not declaring the compiler classpath (which it takes from
compileKotlin task for calling the compiler) as input. This commit fixes
that and adds a test that checks compiler classpath input checks for the
kapt tasks.

Issue #KT-23879 Fixed
2018-05-07 15:55:55 +03:00
Sergey Igushkin
352fb4a1c8 Add a user-friendly report that the JDK tools are missing
Issue #KT-20214 Fixed
2018-05-07 15:47:11 +03:00
Mikhail Zarechenskiy
50116fd8fc Fix coercion result for inline classes, add comment 2018-05-07 15:25:48 +03:00
Mikhail Zarechenskiy
b25a1d9522 Support inline functions inside inline classes 2018-05-07 15:25:46 +03:00
Mikhail Zarechenskiy
5c57c799fc Fix generation of elvis with null constant for inline classes 2018-05-07 15:25:45 +03:00
Mikhail Zarechenskiy
043c3d9a97 Prohibit properties with backing fields inside inline classes 2018-05-07 15:25:43 +03:00
Mikhail Zarechenskiy
29d15b9990 Prohibit varargs on parameters of inline class types 2018-05-07 15:25:42 +03:00
Mikhail Zarechenskiy
d3c1c11dc5 Prohibit initializer blocks inside inline classes 2018-05-07 15:25:40 +03:00
Mikhail Zarechenskiy
6a120d2f85 Require presence of public primary constructor for inline class 2018-05-07 15:25:38 +03:00
Mikhail Zarechenskiy
096fe1c411 Don't report diagnostics on the whole declaration, use main keyword 2018-05-07 15:25:37 +03:00
Mikhail Zarechenskiy
ed4fd2bb2f Mark inline classes feature as experimental 2018-05-07 15:25:35 +03:00
Mikhail Zarechenskiy
71de2e3265 Report diagnostics for inline classes even if the feature is unsupported
This would help for those who use inline classes by suppressing error
 about unsupported feature
2018-05-07 15:25:34 +03:00
Mikhael Bogdanov
8834ea74f2 Revert "Don't generate reified inline function as privates"
This reverts commit 56859f7
2018-05-07 14:14:07 +02:00
Mikhael Bogdanov
56859f7b87 Don't generate reified inline function as privates
#KT-18563 Fixed
2018-05-07 12:49:31 +02:00
Mikhael Bogdanov
99284316d6 Don't shrink psi utils class
Shrinker removes all unused private methods
 that could be reified inline functions

 #KT-23402 Fixed
2018-05-07 12:19:09 +02:00
Toshiaki Kameyama
534cbae4ef KT-14391 RemoveUnnecessaryParenthesesIntention lost comment
on closing parenthesis

 ^KT-14391 Fixed
2018-05-07 12:40:57 +03:00
Alexander Udalov
143c3ccb95 Disallow usages of experimental markers as qualifiers
Only allow explicit imports of markers, but not of nested classes
declared in them
2018-05-07 11:37:31 +02:00
Alexander Udalov
d27657e8f6 Minor, move loadWasExperimentalMarkerClasses closer to usage 2018-05-07 11:37:31 +02:00
Alexander Udalov
2fea2135f8 Add TYPEALIAS target to UseExperimental 2018-05-07 11:37:31 +02:00
Alexander Udalov
7d74508529 Report experimental diagnostics on inaccessible (wrt SinceKotlin) API
If a declaration is annotated both with SinceKotlin and WasExperimental
and the SinceKotlin version makes it inaccessible, the experimental
checker must regard it as experimental, with markers specified in the
WasExperimental annotation arguments. So only errors/warnings about the
experimentality are going to be reported in this case, and no error that
the declaration is unavailable because of a low API version
2018-05-07 11:37:31 +02:00
Alexander Udalov
1f0d3d9c7c Load WasExperimental values correctly for associated declarations
For example, if a class is `@SinceKotlin("X")
@WasExperimental(M::class)`, then its constructor should also be
accessible if API < X, provided that the opt-in to M is given
2018-05-07 11:37:31 +02:00
Alexander Udalov
9995438b37 Forbid non-intended usages of Experimental and markers
Experimental and UseExperimental can only be used as annotations or
qualifiers (to allow "Experimental.Level.*"); experimental markers can
only be used as annotations or qualifiers, or as left-hand side of a
::class literal in arguments to UseExperimental/WasExperimental.

This is needed because we're not yet sure of the design of this feature
and would like to retain the possibility to drop these declarations
(Experimental, UseExperimental) altogether. If they were going to be
used as types, it would be problematic because we can't simply delete
something from stdlib, should deprecate it first. With this change,
these declarations can only be used if the user has opted into using the
experimental API somehow (for example, with
`-Xuse-experimental=kotlin.Experimental`), so we won't stop conforming
to our deprecation policy if we decide to remove these declarations in
the future
2018-05-07 11:37:31 +02:00
Alexander Udalov
ed6f044fb0 Add internal WasExperimental for stdlib
Usages of declarations annotated with WasExperimental are allowed even
if the API version requirement is not satisfied, provided that the
opt-in to all mentioned markers is given. This is needed for smooth
graduation of API in kotlin-stdlib
2018-05-07 11:37:31 +02:00
Alexander Udalov
fdc4313860 Minor, fix bodyUsagesAndInline.kt test data 2018-05-07 11:37:31 +02:00
Ilmir Usmanov
fad5596ef9 Minor: remove builtins from kotlin-stdlib-coroutines.jar 2018-05-07 10:34:50 +03:00
Ilmir Usmanov
5e4ce4f880 Remove coroutineContext from kotlin.coroutines.experimental.intrinsics package
#KT-22400: Fixed
2018-05-07 10:28:54 +03:00
Mikhail Zarechenskiy
54ca2cbbe0 Introduce original for ReceiverValue and use it inside coroutine checker 2018-05-04 19:54:14 +03:00
Mikhail Zarechenskiy
b23e9f771b [NI] Fix checking for the same instance inside for suspend functions 2018-05-04 19:53:54 +03:00
Mikhail Zarechenskiy
64b10d827d [NI] Refactoring: rename NonFixedType -> StubType 2018-05-04 19:08:22 +03:00
Mikhail Zarechenskiy
5187f6b060 [NI] Improve performance of resolution part for postoned variables 2018-05-04 19:08:21 +03:00
Mikhail Zarechenskiy
a30a1f2a96 [NI] Update calls after inference for coroutines 2018-05-04 19:08:21 +03:00
Mikhail Zarechenskiy
99a95f31d3 [NI] There is no need in copying constraint storage as it read-only 2018-05-04 19:08:20 +03:00
Mikhail Zarechenskiy
e0ca3421ca [NI] Use only receiver from coroutine call to mark postponed variable 2018-05-04 19:08:20 +03:00
Mikhail Zarechenskiy
59c4b9ad2f [NI] Make it possible to use nullable non-fixed type 2018-05-04 19:08:20 +03:00
Mikhail Zarechenskiy
9209222112 [NI] Introduce inference for coroutines and builder-like constructions 2018-05-04 19:08:19 +03:00
Mikhail Glukhikh
54fc846dea Minor: fix parcel test (related to KT-21129) 2018-05-04 18:16:57 +03:00
Mikhail Glukhikh
e76debb12b Report UNUSED_PARAMETER in setter #KT-21129 Fixed 2018-05-04 18:04:57 +03:00
Mikhail Glukhikh
bcc1c02e73 Cleanup: constructor consistency checker 2018-05-04 17:53:00 +03:00
Mikhael Bogdanov
643e4f5c5a Get rid of descriptors in TailrecLowering 2018-05-04 16:35:44 +02:00
Mikhael Bogdanov
dc68936e69 Get rid of descriptors in StaticDefaultFunctionLowering 2018-05-04 16:35:44 +02:00
Mikhael Bogdanov
489808ec38 Get rid of descriptors in PropertiesLowering 2018-05-04 16:35:43 +02:00
Mikhael Bogdanov
17e2f1a61e Get rid of descriptors in LateinitLowering 2018-05-04 16:35:42 +02:00
Mikhael Bogdanov
74fa7ee676 Minor. Code clean 2018-05-04 16:35:42 +02:00
Mikhael Bogdanov
fdbc863e60 Minor. Reformat 2018-05-04 16:28:12 +02:00
Sergey Igushkin
e82170a04e Tracks and match source sets for MPP after the plugins are applied
Since the custom source sets may be added after the plugins are applied in both common and platform module, we need to handle `.all { ... }` source sets in both modules and add common sources to the platform module once a match is found.

Issue #KT-22510 Fixed
2018-05-04 15:37:08 +03:00
Dmitry Savvinov
97d455729b Add -Xdump-perf 2018-05-04 15:00:43 +03:00
Dmitry Savvinov
9996a1bc7e Rewrite performance statistics collection
This commit introduces notion of 'PerformanceManager' in CLI, suitable
for collecting performance metrics of the compiler. It:

- provides `notifyX{Started/Finished}` API, where 'X' is some
measurable event (previously there were just ad hoc manual time
measurements using System.nanoTime() and stuff)

- collects measurements, so that later they can be reported in an
appropriate way (previously measurements were reported immediately to
MessageCollector as plain strings)

- allows overriding to collect metrics, specific for just one target
platform compilation

Also, common logic of compiler performance statistics collection was
extracted from platform-compilers (K2JVMCompiler) to common classes
(CLICompiler), to allow other platform-compilers (e.g. K2JSCompiler)
re-use it.
2018-05-04 15:00:43 +03:00
Dmitry Savvinov
c3745c9040 Drop -Xrepeat flag
This flag hadn't been maintained for a long time and isn't working
properly at the moment.
2018-05-04 15:00:43 +03:00
Dmitry Savvinov
e3073be726 Minor: reformat KotlinToJvmBytecodeCompiler 2018-05-04 15:00:43 +03:00
Alexander Udalov
c57864e46c Require "-Xuse-experimental=kotlin.Experimental" on usages of Experimental
Since we're not yet sure of the design of Experimental/UseExperimental,
we're making them "experimental" themselves in some sense, in that the
user is required to provide the magic argument
"-Xuse-experimental=kotlin.Experimental" to be allowed to use either
Experimental or UseExperimental. This is more convenient than the
previous approach of "-language-version 1.3
-Xskip-metadata-version-check" because it's simpler and does not cause
pre-release binaries to be produced
2018-05-04 13:48:24 +02:00
Alexander Udalov
2a61d42fc1 Refactor and simplify ExperimentalUsageChecker 2018-05-04 13:48:24 +02:00
Alexander Udalov
4f53a54115 Drop Experimental.Impact, simplify related code and tests
See https://github.com/Kotlin/KEEP/issues/95#issuecomment-383889404

Drop Experimental.changesMayBreak, Experimental.Impact, the concept of
signature/body usage, same module exemption. Make the majority of tests
single-module because there is now no difference in the checker between
usages from the same module or from another module
2018-05-04 13:48:24 +02:00
Alexander Udalov
1719eecb67 Minor, init slice debug names for FilesByFacadeFqNameIndexer 2018-05-04 13:48:24 +02:00
Mikhael Bogdanov
12ba1b002c Refactor SharedVariablesManager: get rid of descriptors in API 2018-05-04 12:33:44 +02:00
Mikhael Bogdanov
f1c0db346a Code clean 2018-05-04 12:33:35 +02:00
Sergey Rostov
9fafe0473c jps (refactor): reimplement KotlinModuleBuildTarget data binding using CompileContext 2018-05-04 11:14:45 +03:00
Sergey Rostov
91b703d529 jps: common modules metadata compiler
(cherry picked from commit cde333d)
2018-05-04 11:05:13 +03:00
Sergey Rostov
41dcc9ad4d jps: minor: refine kotlin.jps.model package
(cherry picked from commit 2a31e78)
2018-05-04 11:05:12 +03:00
Sergey Rostov
a390fc36e2 jps: Refactor module/project settings getters/setters
(cherry picked from commit d29ffa0)
2018-05-04 11:05:12 +03:00
Sergey Rostov
75e6be7802 jps(refactor): Extract platform related code
#KT-23656 Fixed

(cherry picked from commit 18a751d)
2018-05-04 11:05:12 +03:00
Ilya Chernikov
22439250e2 Use kts file extension instead of kt in tests...
since all "kt" files are now considered - definitely non-scripts
2018-05-03 22:15:10 +02:00
Ilya Chernikov
24e8e7c40d Eliminate script dependencies queries for non-scripts 2018-05-03 22:15:10 +02:00
Ilya Chernikov
d4070cc4d7 Return null on directories in script definition wrappers for files 2018-05-03 22:15:10 +02:00
Ilya Chernikov
9eab7a627d Add script API libs sources to the IDEA plugin 2018-05-03 22:15:10 +02:00
Alexander Udalov
64f5c2c9a3 Refactor and simplify AbstractCustomScriptCodegenTest
Remove copy-paste, use CodegenTestCase's infrastructure as much as
possible, use InTextDirectiveUtils instead of regexps
2018-05-03 22:15:10 +02:00
Alexander Udalov
c48bb9c981 Minor, drop unused parameter in CodegenTestCase, add testJdkKind 2018-05-03 22:15:10 +02:00
Ilya Chernikov
48cf0bd949 Fixes and refactorings after review 2018-05-03 22:15:10 +02:00
Ilya Chernikov
dff4be9e04 Implement script environment variables in backend, add simple test 2018-05-03 22:15:09 +02:00
Ilya Chernikov
a9600e34bf Add test infrastructure for custom scripts testing, add receiver test 2018-05-03 22:15:09 +02:00
Ilya Chernikov
57db77a295 Refactor script infrastructure for easier usage and testability:
- add script annotation for specifying default configuration for a script
- add support for this annotation in the default configurator
- rename configurator accordingly
- add default implementation of the refineConfiguration method
- make property bag class open
2018-05-03 22:15:09 +02:00
Ilya Chernikov
516924cda1 Add support for script environment variables to the frontend 2018-05-03 22:15:09 +02:00
Ilya Chernikov
15f9ad9531 Implement quick non-script detection and lazy script discovery..
so ".kt" and ".java" files are not considered as scripts and quickly
filtered out, and for the other files the the checks are implemented
using sequences, mechanisms provided to supply script definitions
lazily, and script discovery is implemented using this mechanisms.
2018-05-03 22:15:09 +02:00
Ilya Chernikov
969340167f Apply scripting plugin in gradle plugin by default 2018-05-03 22:15:09 +02:00
Ilya Chernikov
a29411a211 Process script templates everywhere properly:
- add options to disable scripting plugin and standard script definition
- move standard definition adding logic into appropriate place
- fix logic of scripting plugin loading
- add standard script definition on the environment creation to
  ensure compatibility with all usages
- fix testdata
- some minor fixes
2018-05-03 22:15:09 +02:00
Toshiaki Kameyama
b5da48c566 Don't report suspicious callable reference on invoke with parameters
So #KT-23465 Fixed
2018-05-03 18:47:12 +03:00
Toshiaki Kameyama
13356d32fd Redundant SAM-constructor: highlight nested class name with outer class
So #KT-11156 Fixed
2018-05-03 18:32:44 +03:00
Toshiaki Kameyama
204c68070a Reformat RedundantSamConstructorInspection 2018-05-03 18:31:34 +03:00
Toshiaki Kameyama
c43311ba9a Move to constructor: change default use-site target: property -> field
So #KT-23801 Fixed
2018-05-03 18:12:11 +03:00
Toshiaki Kameyama
012227dd73 Reformat MovePropertyToConstructorIntention 2018-05-03 18:11:23 +03:00
Toshiaki Kameyama
633679ac16 Preserve comments in "Remove variable" quick fix #KT-23753 Fixed 2018-05-03 18:09:22 +03:00
Alexey Tsvetkov
61edfaced5 Speed up pill
Pill runs 10x faster on my machine after the change
2018-05-03 18:03:18 +03:00
Toshiaki Kameyama
66d738848b Convert foreach to for loop: place caret on the variable declaration
So #KT-7822 Fixed
2018-05-03 17:54:56 +03:00
Toshiaki Kameyama
3221fbdca9 Don't "Remove explicit type" for callable with function initializer
So #KT-12168 Fixed
2018-05-03 17:46:47 +03:00
Toshiaki Kameyama
5204c73bec Quick-fix "use spread operator": make working with mapOf #KT-14556 Fixed 2018-05-03 17:11:33 +03:00
Toshiaki Kameyama
a7110a1517 Add intention to indent a raw string #KT-9943 Fixed 2018-05-03 17:05:14 +03:00
Alexander Udalov
a2d45062c2 Fix another non-determinism in CommonSupertypes 2018-05-03 16:02:49 +02:00
Mikhail Glukhikh
e07f83ddbc "Redundant Unit" inspection: new tests, simplification & fixes
Related to KT-23977 and KT-24066
2018-05-03 16:12:20 +03:00
Toshiaki Kameyama
6e150d27f1 "Redundant Unit" inspection: fix for Unit returned as Any
So #KT-24066 Fixed
2018-05-03 16:12:19 +03:00
Toshiaki Kameyama
c44cab4565 "Redundant Unit" inspection: Fix for labeled return #KT-23977 Fixed 2018-05-03 16:12:19 +03:00
Mikhael Bogdanov
b4853d9293 Minor. Reformat 2018-05-03 12:04:47 +02:00
Mikhael Bogdanov
eefc49a617 Use symbols to find local declarations in codegen 2018-05-03 12:04:45 +02:00
Mikhael Bogdanov
f0e4420259 Don't recreate ir declarations to set body 2018-05-03 12:04:45 +02:00
Mikhael Bogdanov
35df7966cf Use symbols in IrGet/SetValue in JvmSharedVariablesManager 2018-05-03 12:04:32 +02:00
Mikhael Bogdanov
bb6c837f6b Use symbols in IrGet/SetValue in EnumClassLowering 2018-05-03 11:38:52 +02:00
Mikhael Bogdanov
5a2e62dd4f Use symbols in IrGet/SetValue 2018-05-03 11:38:50 +02:00
Mikhael Bogdanov
077f3a4ed2 Minor. Reformat 2018-05-03 11:27:57 +02:00
Mikhael Bogdanov
ed44327569 Properly set parents in JvmLower 2018-05-03 11:23:57 +02:00
Mikhael Bogdanov
e793a7eea7 Use symbols in synthetic accessor to access accessor parameters 2018-05-03 11:23:56 +02:00
Mikhael Bogdanov
92e02e35fc Convert FrameMap to Kotlin and extract base logic 2018-05-03 11:23:56 +02:00
Mikhael Bogdanov
76bab8f3b0 Rename FrameMap.java to FrameMap.kt 2018-05-03 11:23:55 +02:00
Natalia Selezneva
49a1788728 Update testData after switching on kotlin internal mode in tests 2018-05-03 11:32:52 +03:00
Mikhail Zarechenskiy
5815e790ba Minor, use utility to get default type for number type constructor 2018-05-03 11:04:55 +03:00
Mikhail Zarechenskiy
d6405c8147 Fix exception on mapping internal types to UAST types with NI
#EA-119071 Fixed
2018-05-03 11:04:54 +03:00
Ilmir Usmanov
f507a26a12 Generate decomposed lambda params in suspend lambda's local variables
Unlike ordinary lambdas, suspend lambdas do the computation in
doResume(Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;
method. As you can see, there are no decomposed parameters. As a result,
they used not to be generated.
To fix the issue, I add decomposed parameters to value parameters while
generating local variables table.

In addition, when generating suspend lambda for inline, the codegen
does not take this kind of parameters into account. This is also fixed.

 #KT-18576: Fixed
2018-05-03 10:35:13 +03:00
Alexander Udalov
712a796637 Fix MultiModuleHighlightingTestGenerated.testUseCorrectBuiltInsForCommonModule
Add dependency from a_jvm8 on stdlib. Otherwise, `getEmptyList` from
a_common was resolved to have an error return type
2018-05-02 16:56:54 +02:00
Alexander Udalov
ac4edbba5b Regenerate tests 2018-05-02 16:17:14 +02:00
Alexander Udalov
f59963ef73 Simplify test case on deterministic null-checks 2018-05-02 14:40:15 +02:00
Denis Vnukov
c5373c9029 Ensure deterministic insertion of checkExpressionValueIsNotNull.
Kotlinc source’s file DescriptorUtils.kt demonstarted non-deterministic
insertion of checkExpressionValueIsNotNull for value returned by
CallableDescriptor::getOriginal(). It was difficult to reproduce
this behavior on ф smaller example, but I added a test which was
failing once in 5-10 times while I was testing manually.

I believe this bug is close to KT-23704.

This PR addresses non-determinism to a degree when I can run 120
Compilations with './gradlew dist' and get same classes in all
jars in 'dist'.

NOTE that thew fact that insertion of checkExpressionValueIsNotNull may
depend on order of the types seems suspicios. This CL only addresses
non-determinism part, but I believe it’s worth looking into this more
from semantics point of view.
2018-05-02 14:36:04 +02:00
Alexander Udalov
10da41b136 Regenerate tests 2018-04-30 18:51:28 +02:00
Alexander Udalov
c63cd430d1 Fix no-arg constructor generation for actual class 2018-04-30 15:26:50 +02:00
Alexander Udalov
adb15d2d1a Do not report JvmOverloads warning on actual function with expected defaults
#KT-23910
2018-04-30 15:26:50 +02:00
Alexander Udalov
056c41bc00 Minor, improve kdoc of default args utilities in ArgumentsUtils.kt 2018-04-30 15:26:50 +02:00
Alexander Udalov
a8488cf298 Fix JvmOverloads generation for actual methods
`countDefaultParameters` uses `hasDefaultValue` to compute the number of
parameters which have default values, which handles actual parameters
(who have default values in the expected declaration) correctly. Thus,
`getRemainingParameters` should use it as well to determine the list of
parameters to be skipped in each generated overload

 #KT-23910 Fixed
2018-04-30 15:26:50 +02:00
Alexander Udalov
516e7df4b7 Reformat DefaultParameterValueSubstitutor, fix inspections 2018-04-30 15:26:49 +02:00
Nicolay Mitropolsky
efd743284e CommonIntentionActionsTest.testRemoveConstructorParameters test fix for 181, 182, as32 2018-04-29 11:48:28 +03:00
Nikolay Krasko
398795b832 Fix AddRequireModuleTest in 181
- Application is null before setUp call in individual run
- Inline "module.info.add.requires.family.name" as 181 has other constant
- isScriptDependenciesUpdaterDisabled call seems to be useless
2018-04-28 22:27:35 +03:00
Nikolay Krasko
af930b8364 Review and fix raw string quotes inserting and remove (KT-2582)
- Add more tests
 - Fix inserting close quotes after multiline string in file end
 - Use parent instead of parentOfType where possible
 - Add bunch files

 #KT-2582 Fixed
2018-04-28 22:27:34 +03:00
Steven Spungin
8252b35ed5 Add support for closing and deleting raw strings (KT-2582)
#KT-2582 Fixed
2018-04-28 22:27:34 +03:00
Nikolay Krasko
5216dfcc59 Add internal errors to test data in multi module tests
Tests started to fail after 82a21b3955.
2018-04-28 22:24:39 +03:00
Ilya Gorbunov
2c9c6eb746 Reformat stdlib: new coroutines 2018-04-28 18:58:56 +03:00
Mikhail Glukhikh
2854e6b7a1 Reformat: BranchedFoldingUtils 2018-04-28 18:44:29 +03:00
Toshiaki Kameyama
89981ecbbb Lift Assignment: process lambda assignments in when correctly
So #KT-23346 Fixed
2018-04-28 18:44:29 +03:00
Ilya Gorbunov
7438d12ad7 Move builtins generators to their own source set
Make them depend on bootstrap stdlib.
This is to prevent recompiling the entire project when we need just to
generate builtins sources.
2018-04-28 17:38:13 +03:00
Ilya Gorbunov
a704a1b6d0 Allow to create new sourcesets with our helper
New sourceSet is created if it doesn't exist, instead of being silently ignored.
Fix receiver of `none()`: it was applied on sourceSetName rather than on the sourceSet,
therefore it was a no-operation.
2018-04-28 17:35:30 +03:00
Denis Zharkov
8e1b0c5ab7 Optimize memory footprint for PartialBodyResolveFilter
There is a single PartialBodyResolveFilter instance per module
and each of them were containing just the same sets of available
in project Nothing-typed functions (including duplicating String instances),
in case of Kotlin project it might sum up to 27M of heap.

The solution is to share the global sets between all modules in a project
2018-04-28 17:12:52 +03:00
Denis Zharkov
26714d56d8 Use WeakKeySoftValueMap in ResolveElementCache
Otherwise results are effectively retained in the maps until we're close
to OutOfMemory.
While we mostly need them for a short time (especially in the case we
run resolution during usages search).

The possible problem is that the values may become too short-living,
but now using these maps is a conventional solution for similar tasks in
Java resolve
2018-04-28 17:12:52 +03:00
Denis Zharkov
96ab705de1 Use PsiField::computeConstantValue to avoid building AST 2018-04-28 17:12:52 +03:00
Denis Zharkov
bb45959470 Avoid switching to AST in CodegenAnnotatingVisitor for light classes 2018-04-28 17:12:52 +03:00
Denis Zharkov
2a713a972d Postpone computing AST when it's used only for reporting 2018-04-28 17:12:52 +03:00
Denis Zharkov
0788afe92c Avoid computing AST for IdentifierChecker
Basically, it's unnecessary to check anything when analysing stubs,
but it's complicated now to avoid that, so we just postpone
computing AST until reporting happens
2018-04-28 17:12:52 +03:00
Mikhail Glukhikh
6e8247f7cf Fix leaking this test in 181 branch 2018-04-28 15:46:37 +03:00
Roman Artemev
d9fdddceb9 Update test data 2018-04-27 20:02:59 +03:00
Roman Artemev
8bc80a9829 Fix secondary constructor lowering 2018-04-27 20:02:57 +03:00
Roman Artemev
8721990a7f Implement access to members of super class 2018-04-27 20:02:56 +03:00
Roman Artemev
cf31e544eb Implement default interface members 2018-04-27 20:01:45 +03:00
Roman Artemev
d861fb498f Implement string plus operator 2018-04-27 20:00:41 +03:00
Roman Artemev
01fea13467 Fix name clashing between local variables 2018-04-27 20:00:41 +03:00
Roman Artemev
997328f584 Refactoring and fixes 2018-04-27 20:00:40 +03:00
Roman Artemev
deab0a017b Add support for inner clases 2018-04-27 20:00:40 +03:00
Roman Artemev
746eb4b93e Implement object class in JS BE 2018-04-27 20:00:39 +03:00
Roman Artemev
17ee38a0b7 Refactor secondary constructor lowering using new builders 2018-04-27 20:00:38 +03:00
Roman Artemev
752cbf2714 Implemented KFunction interface 2018-04-27 20:00:32 +03:00
Roman Artemev
09c54f1da3 Add symbol & IR builders to JS backend 2018-04-27 19:53:47 +03:00
Roman Artemev
c1a4aeb67f Lift InnerClassesLowering from JVM to common since it is used by every backend in the same way 2018-04-27 19:53:47 +03:00
Roman Artemev
ed0c26ef07 Implement function literals in JS BE 2018-04-27 19:53:47 +03:00
Nikolay Krasko
c83ff5e75f Remove files introduced in 181 from 173 branch 2018-04-27 19:45:23 +03:00
Nikolay Krasko
6683e07112 181: [Tests] Revert "Allow different diagnostics in Javac tests - workaround for IDEA-184289"
It is fixed in 181
2018-04-27 18:29:57 +03:00
Vyacheslav Gerasimov
c16a5c2538 Switch .bunch file to 181 2018-04-27 18:25:23 +03:00
Vyacheslav Gerasimov
8c88ac69df Cleanup .181 bunch files 2018-04-27 18:25:21 +03:00
Vyacheslav Gerasimov
bc403ce744 Switch to 181 platform 2018-04-27 18:25:17 +03:00
Mikhail Glukhikh
df59af8ee8 Move sort modifiers test to inspection local group
This should fix test in 181 branch
2018-04-27 17:26:56 +03:00
Mikhail Glukhikh
8f0c53d0de If then to elvis: handle nullability even with implicit receiver
So #KT-22741 Fixed
2018-04-27 17:26:50 +03:00
Mikhail Glukhikh
49165bdbef Cleanup: better visibility 2018-04-27 17:26:37 +03:00
Mikhail Glukhikh
7601aaf89f Reformat IfThenToElvisIntention 2018-04-27 17:26:36 +03:00
Denis Zharkov
b75024e3e0 Fix memory leak related to diagnostics computation within light classes
Before this change, when somebody has requested the exact light class
we also store LazyJvmDiagnostic for it in a map inside DiagnosticHolder.

The problem is that LazyJvmDiagnostic retains a lot of memory:
GenerationState, bindingContext, etc.

At the same time, it commonly happens that light classes are being computed from Java resolve and diagnostics are obviously
unnecessary there.

The solution has two parts:
1. We don't retain diagnostics until somebody explicitly requested them
2. We force computation of LazyJvmDiagnostic to avoid retaining
backend's parts

The solution has a kind of drawback: for an opened in editor Kotlin file,
we'll run back-end twice for contained classes (analysis parts should be reused, though)

 #KT-24048 Fixed
2018-04-27 16:13:59 +03:00
Natalia Selezneva
26f1d6ae7c Update Icon for .kts and .gradle.kts files
^KT-23431 Fixed
2018-04-27 13:52:31 +03:00
Natalia Selezneva
9107ef6490 New Script File Action
^KT-10935 Fixed
2018-04-27 13:52:26 +03:00
Natalia Selezneva
1d8d1e847a Minor: add debug name for ErrorGradleScriptDefinition 2018-04-27 13:52:22 +03:00
Natalia Selezneva
ec63efec3c Debugger: refactor list of breakpoints for the line with lambdas.
^KT-24136 Fixed

Rename main line breakpoint to "Line"
Change icon for lambda-breakpoint
Move "all breakpoint" to the end of the breakpoints list
2018-04-27 13:52:06 +03:00
Nikolay Krasko
8bce29df3a Show plugin installation status in Kotlin Updates settings (KT-23980)
#KT-23980 Fixed
2018-04-27 13:08:28 +03:00
Nikolay Krasko
bf82da7584 Perform auto-check initial and checks after switching channels (KT-23980)
#KT-23980 Fixed
2018-04-27 12:16:37 +03:00
Nikolay Krasko
64845ac3b7 Better UI for configure plugin updates (KT-23980)
- Control with Alt + Letter
 - Don't stretch channel combobox
 - Focus on label selection

 #KT-23980 Fixed
2018-04-27 12:16:37 +03:00
Nikolay Krasko
748e213598 Move Kotlin update channel setting to settings dialog (KT-23980)
#KT-23980 Fixed
2018-04-27 12:16:37 +03:00
Nikolay Krasko
144c41576e Refactoring: inline KotlinInternalMode.enabled 2018-04-27 12:16:37 +03:00
Nikolay Krasko
82a21b3955 Move Kotlin internal actions to Internal menu and unify modes (KT-23975)
#KT-23975 Fixed
2018-04-27 12:16:36 +03:00
Ilya Chernikov
5af490f5e5 Remove script discovery files from example projects to avoid discovery problems:
- exception during loading of the definition with maven dependencies
- shading of the gradle script definition (if not fixed by the previous commit)

The discovery files should be restored after fixing/rewriting the discovery
and implementing definition prioritization in IDEA plugin
2018-04-27 09:03:15 +02:00
Ilya Chernikov
51888154e1 Change custom script examples file extensions:
fixes shadowing of the gradle script definitions after these example
script defs are loaded via discovery mechanisms
2018-04-27 09:03:15 +02:00
Ilya Gorbunov
ecf0d7ec0d Reformat stdlib tests and samples
#KT-5558
2018-04-27 05:28:57 +03:00
Ilya Gorbunov
add09e0f2e Reformat stdlib: js part
#KT-5558
2018-04-27 05:28:48 +03:00
Ilya Gorbunov
e3883d8d6d Reformat stdlib: jvm part
#KT-5558
2018-04-27 05:28:38 +03:00
Ilya Gorbunov
c53a2d57c3 Reformat stdlib: common code
#KT-5558
2018-04-27 00:50:16 +03:00
Ilya Gorbunov
ad43c0f4cb Reformat stdlib: collections
#KT-5558
2018-04-27 00:49:06 +03:00
Ilya Gorbunov
bea94d1d59 Update line numbers of inlined stdlib functions after updating copyright
This should not be needed, see KT-23862
2018-04-26 21:57:50 +03:00
Ilya Gorbunov
3354d44fce Fix false positives in CodeConformanceTest on identifiers like readCopyright 2018-04-26 21:57:50 +03:00
Ilya Gorbunov
ffc975550f Add/update copyrights in kotlin-stdlib-gen 2018-04-26 21:57:50 +03:00
Ilya Gorbunov
2e12834b6a Update copyrights in kotlin.test library
Change line number in StackTraceJVMTest due to the added copyright
2018-04-26 21:57:50 +03:00
Ilya Gorbunov
d3156c33be Update copyrights in builtin sources
Read copyright template from .idea/copyright/apache.xml profile
2018-04-26 21:57:50 +03:00
Ilya Gorbunov
502418e690 Put copyrights to the generated standard library sources
Read copyright template from .idea/copyright/apache.xml profile
2018-04-26 21:57:50 +03:00
Ilya Gorbunov
e21c235bbb Add or update copyrights in the standard library sources 2018-04-26 21:57:50 +03:00
Ilya Gorbunov
40cd02bba6 idl2k: read copyright from profile and put it in the generated files
Also reword autogenerated warning a bit.
2018-04-26 21:57:50 +03:00
Nicolay Mitropolsky
8e91f31182 UnimplementedKotlinInterfaceMemberAnnotator: use modifier list to be compatible with 172 2018-04-26 20:40:26 +03:00
Vyacheslav Gerasimov
72c9dc7d35 Build: Remove buildSrc/intellij-sdk/build.gradle.kts.182 2018-04-26 19:33:01 +03:00
Nicolay Mitropolsky
e8af8edf87 AnnotationUtil.kt.172 removed (should be equal to master) 2018-04-26 19:29:18 +03:00
Simon Ogorodnik
9e6cf5708e Fix J2K plain-text copy conversion test in 181 2018-04-26 17:37:29 +03:00
Mikhael Bogdanov
ec0b9aa343 Skip @JvmDefault in UnimplementedKotlinInterfaceMemberAnnotator
#KT-23967 Fixed
2018-04-26 15:36:42 +02:00
Mikhael Bogdanov
5efc9f2257 Revert "Get rid of 'BRIDGE' flag on $default functions"
Removed bridge flag triggers problem with Spring Boot: KT-23973
 This reverts commit cdcb651

 #KT-23973 Fixed
2018-04-26 15:36:42 +02:00
Pavel V. Talanov
a4e327c137 Mpp: KT-23457, fix importing common classes into common modules
Add test for KT-23457
NOTE: fixes 'importClassInCommon' test
Other test cases added to increase coverage

 #KT-23457 Fixed
2018-04-26 15:33:51 +02:00
Pavel V. Talanov
64a28dd542 QuickFixMultiModuleTest: fix test code
Adjust test data
2018-04-26 15:33:48 +02:00
Vyacheslav Gerasimov
c10c5a44d1 Remove exclusions from kotlin-stdlib dependency of published artifacts
Log warning about it, this is probably a project configuration bug and should be checked.
2018-04-26 16:11:56 +03:00
Denis Zharkov
003f381fcd Replace default-type dependencies to :kotlin-stdlib with distJar
Use distJar configuration instead.
It's necessary because currently when using default-type, subproject
starts having a transitive dependency to :kotlin-stdlib-common
and that leads to exception from KT-20897 when building light classes

This change might be reverted once KT-23942 is fixed

 #KT-23942 Submitted
2018-04-26 16:11:27 +03:00
Mikhael Bogdanov
655b737a1e Don't use descriptors for static check 2018-04-26 14:28:14 +02:00
Mikhael Bogdanov
096c9e440b Initialize parameters in irFunctions 2018-04-26 14:28:13 +02:00
Mikhael Bogdanov
ec4ff2f2b5 Minor. Reformat 2018-04-26 14:28:13 +02:00
Mikhael Bogdanov
6ca55bafdf Properly inline default methods 2018-04-26 14:28:12 +02:00
Mikhael Bogdanov
97ad3f9ddd Generate $default functions for inline ones in JVM-backend 2018-04-26 14:28:11 +02:00
Mikhael Bogdanov
e6c88755e9 Minor. Code clean 2018-04-26 14:28:10 +02:00
Mikhael Bogdanov
a8dacccdd3 Minor. Reformat 2018-04-26 14:28:09 +02:00
Ilya Gorbunov
579822c114 Regenerate w3c declarations to get new MDN references 2018-04-26 14:09:05 +03:00
Zalim Bashorov
5c40892c57 [JS IR BE] Right support for inc and dec on primitive numbers 2018-04-26 13:46:50 +03:00
Zalim Bashorov
6725f085c7 [JS IR BE] Deprecate Name.toJsName and remove dummyScope 2018-04-25 22:21:25 +03:00
Zalim Bashorov
27988cd2f4 Remove the version of fail.kt that was "hacked" for JS IR BE tests 2018-04-25 22:21:22 +03:00
Zalim Bashorov
34587d9192 [JS IR BE] unmute tests 2018-04-25 22:20:43 +03:00
Zalim Bashorov
a6f4594679 [JS IR BE] Intrinsicify kotlin.js.js 2018-04-25 22:20:41 +03:00
Zalim Bashorov
8d89a93c44 [IR JS BE] Add core.kt to list of compiling files for JS IR BE tests 2018-04-25 22:18:58 +03:00
Zalim Bashorov
9c25b21510 Minor: remove useless comments from JsIrBackendContext 2018-04-25 22:18:57 +03:00
Zalim Bashorov
8871cf660c [stdlib-js] Split core.kt in stdlib-js into few files to simplify using part of it in JS IR BE related tests 2018-04-25 22:18:57 +03:00
Jim S
cebee7b5e1 Add context to generateSynthetic* in SyntheticResolveExtension 2018-04-25 20:18:10 +03:00
Jim S
d63a2462ef Eliminate duplicate call to genSyntheticClassOrObject
As far as I can tell (and admittedly I'm not an expert in the Kotlin compiler code), it looks like the new logic iterates over all contributed descriptors, which renders the old logic (which explicitly invokes getCompanionObjectDescriptor) obsolete.  We ran into this last year when rebasing on top of 527ccaff16 and - after a quick conversation with @sandwwraith (email chain dated December 12, 2017) - we unblocked ourselves by deleting the old code from our local repository.  Now we're looking to upstream our changes, thus this PR.

Old code:
```
         // Generate synthetic (non-declared) companion if needed
         ClassDescriptor companionObjectDescriptor = descriptor.getCompanionObjectDescriptor();
         if (companionObjectDescriptor instanceof SyntheticClassOrObjectDescriptor) {
             genSyntheticClassOrObject((SyntheticClassOrObjectDescriptor) companionObjectDescriptor);
         }
```

New code:
```
        // Generate synthetic nested classes
        Collection<DeclarationDescriptor> classifiers = descriptor
                .getUnsubstitutedMemberScope()
                .getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS, MemberScope.Companion.getALL_NAME_FILTER());
        for (DeclarationDescriptor memberDescriptor : classifiers) {
            if (memberDescriptor instanceof SyntheticClassOrObjectDescriptor) {
                genSyntheticClassOrObject((SyntheticClassOrObjectDescriptor) memberDescriptor);
            }
        }
```

Change-Id: Icb51ee6e56b9928108cc121c78fa50c6354a4b31
2018-04-25 20:18:08 +03:00
Sergey Igushkin
1596d7b636 Stop removing JavaCompile tasks from project.tasks in common modules
When the JavaCompile tasks were removed from a common project, some of
the dependencies on them remained. This could lead to an error during
dependencies resolution, such as the one in KT-23092. To an even greater
confusion, the remaining dependencies anyway led to the task being
added to the task graph.

Issue #KT-23092 Fixed
2018-04-25 19:49:19 +03:00
Sergey Igushkin
2b41a0d30e Use archivesBaseName for module names in MPP common modules as well.
Issue #KT-23574 Fixed
2018-04-25 19:43:58 +03:00
Ilmir Usmanov
4396b4259e Minor: Fix compilation of android tests 2018-04-25 19:15:16 +03:00
Alexey Tsvetkov
1778cc6a39 Fix incremental compilation with Java 9+
#KT-23901 fixed
2018-04-25 16:05:48 +03:00
Ilmir Usmanov
31a8f1ce9d Minor: Add missing method in 172 patchset 2018-04-24 21:48:57 +03:00
Nikolay Krasko
ac97075020 Check only one class in JS decompiler tests to reuse test data
JVM tests check only single class result, in order to reuse test data
JS tests should do the same. CHECK_PACKAGE is introduced to override
this behaviour explicitly.
2018-04-24 18:51:27 +03:00
Ilmir Usmanov
ce40c3fb21 Take coroutinesPackage into account in bunch files
#KT-23362
2018-04-24 18:14:04 +03:00
Raluca Sauciuc
258cba2cf8 More fixes for Android Studio 3.2 compatibility 2018-04-24 16:46:33 +03:00
Mikaël Peltier
76cd20c574 KT-23721 Emit an error when 'tools.jar' is not into plugin classpath
- Since warnings are discarded when there are others errors, replace the
current warning by an error to always display the message and inform the
user that its annotation processor is badly configured.

Fix of https://youtrack.jetbrains.com/issue/KT-23721
2018-04-24 16:10:03 +03:00
Mikhail Zarechenskiy
d2d92a2153 [NI] Fix exception, don't try to get parent on root fqName
#EA-119579 Fixed
2018-04-24 15:22:29 +03:00
Roman Artemev
61e051cafa Update test data 2018-04-24 14:04:16 +03:00
Roman Artemev
ec57a335f7 Temporally hacked js assert to make depending tests work 2018-04-24 13:52:16 +03:00
Nicolay Mitropolsky
efdc5701d9 Uast: removing SimpleKotlinRenderLogTest.kt.181 2018-04-24 12:35:26 +03:00
Toshiaki Kameyama
e58d9c5507 Add intention for converting to block comment and vise versa
So #KT-23137 Fixed
2018-04-24 11:57:56 +03:00
Mikhail Glukhikh
3351b00870 SimpleKotlinRenderLogTest: delete identical branch file (AS32) 2018-04-24 10:31:59 +03:00
Mikhail Glukhikh
f9858bf597 SimpleKotlinRenderLogTest: add (forgotten) changes into branches 2018-04-24 10:30:10 +03:00
Ilmir Usmanov
39f4a449ad Remove JvmVersion from kotlin-stdlib-coroutines 2018-04-23 22:20:41 +03:00
Ilmir Usmanov
9cad474f5a Update bootstrap compiler to latest green 2018-04-23 21:52:01 +03:00
Ilmir Usmanov
3cceb13d04 Update inliner test after changing bootstrap compiler 2018-04-23 21:52:00 +03:00
Ilmir Usmanov
f60787d57c Move coroutines to kotlin.coroutines package: tests
Introduce COMMON_COROUTINES_TEST directive.
Every test with this directive is run twice: one time with
language version 1.2 and kotlin.coroutines.experimental package
and the other time with language version 1.3 and kotlin.coroutines
package. Each run is a separate method: with suffixes _1_2 and _1_3
respectively.
However, since codegen of release coroutines is not supported in JS
backend, we generate only one method: with suffix _1_2.
 #KT-23362
2018-04-23 21:51:59 +03:00
Ilmir Usmanov
30ab1e2b35 Move coroutines to kotlin.coroutines package: stdlib
Copy everything from kotlin.coroutines.experimental to
kotlin.coroutines. The latter is separate source set to be packed into
separate kotlin-stdlib-coroutines.jar
 #KT-23362
2018-04-23 21:51:58 +03:00
Nicolay Mitropolsky
ebdee1f24c 182: JvmDeclarationSearcher-implementation for Kotlin based on light-classes
#KT-23764
2018-04-23 21:37:58 +03:00
Mikaël Peltier
b1ef670818 KT-23931 Avoid infinite loop into RedundantGotoMethodTransformer
- Follow-up of 9fb0f59813 to avoid
infinite loop during redundant goto otpimization.

Fix of https://youtrack.jetbrains.com/issue/KT-23931
2018-04-23 20:25:43 +03:00
Pavel V. Talanov
7daf44a806 Fix bunch files after mpp changes 2018-04-23 18:56:36 +02:00
Alexander Udalov
3ce9c03249 Minor, ignore build directories when checking copyrights 2018-04-23 18:42:33 +02:00
Alexander Udalov
dfd76502ab Minor, move serializeToByteArray to module 'metadata.jvm' 2018-04-23 18:42:33 +02:00
Alexander Udalov
52a9cc06e0 Remove StringTable.serializeTo, add JvmProtoBufUtil.writeData
StringTable.serializeTo was effectively only used for JvmStringTable,
but was declared in StringTable because of the usage in
DescriptorSerializer.serialize (which, in turn, was only used from JVM
codegen)
2018-04-23 18:42:33 +02:00
Alexander Udalov
58b7643065 Render .kjsm files in incremental tests
Otherwise they, being binary files, are displayed as text, which is
unreadable
2018-04-23 18:42:33 +02:00
Alexander Udalov
965e3ebab2 Do not serialize SOURCE-retained annotations
Also, fix the value of "hasAnnotations" flag to reflect if there are any
_non-source_ annotations on a declaration.

Unfortunately, after this change
IncrementalJsCompilerRunnerTestGenerated$PureKotlin.testAnnotations
starts to fail because of the following problem. The problem is that
annotations on property accessors are not serialized yet on JS (see
KT-14529), yet property proto message has setterFlags field which has
the hasAnnotations flag. Upon the full rebuild of the code in that test,
we correctly write hasAnnotations = true, but annotations themselves are
not serialized. After an incremental build, we deserialize property
setter descriptor, observe its Annotations object which happens to be an
instance of NonEmptyDeserializedAnnotationsWithPossibleTargets. Now,
because annotations itself are not serialized, that Annotations object
has no annotations, yet its isEmpty always returns false (see the code).
Everything worked correctly before the change because in
DescriptorSerializer.hasAnnotations, we used Annotations.isEmpty and the
result was the same in the full rebuild and in the incremental scenario.
But now we're actually loading annotations, to determine their
retention, and that's why the setterFlags are becoming different here
and the test fails

 #KT-23360 Fixed
2018-04-23 18:42:33 +02:00
Alexander Udalov
7bac9b62c7 Reformat VersionRequirement and move to 'metadata' 2018-04-23 18:42:33 +02:00
Alexander Udalov
361f686124 Move ModuleMapping and BinaryModuleData to metadata.jvm 2018-04-23 18:42:32 +02:00
Alexander Udalov
d0544a148a Minimize dependencies of ModuleMapping
Prepare it to be moved to metadata.jvm
2018-04-23 18:42:32 +02:00
Ilya Gorbunov
6b800c4230 Remove conditional-preprocessor compiler module 2018-04-23 19:05:13 +03:00
Ilya Gorbunov
2c74b91de4 Remove JvmVersion annotation and its usages 2018-04-23 19:05:13 +03:00
Dmitry Petrov
1eca402332 Use correctElementType to determine array element type for withIndex
Rather unkind "gotcha" in ASM API.

 #KT-23900 Fixed Target versions 1.2.50
2018-04-23 18:00:12 +03:00
Nikolay Krasko
5817a7fdac Prevent endless processing of problem pending events
If some pending event processing caused exception in PerModulePackageCacheService,
log the problem and consider event processed. Otherwise it is going to
be stuck there forever.
2018-04-23 16:41:14 +03:00
Nikolay Krasko
00119c309c Don't call findChild on invalid file in ImplicitPackagePrefixCache 2018-04-23 16:41:14 +03:00
Nikolay Krasko
3f6022d74e Don't show several lambda return inlay hints for elvis (KT-22436)
Don't show inlay hints on binary expression operands

 #KT-22436
2018-04-23 16:41:14 +03:00
Nikolay Krasko
2a7f195bbc Fix FoldingAfterOptimizeImportsTest for case-sensitive file systems
Broken in b6699d7522
2018-04-23 16:41:13 +03:00
Nikolay Krasko
d085f3e474 Don't call elementAtCaret for file usage test (fix for 181)
Fix testPropertyFileUsages test in 181.

Starting from 181, call `elementAtCaret` with zero offset returns
null element, when file starts with comment. Test fails because
of that.

fdebc4084b
2018-04-23 16:41:13 +03:00
Nikolay Krasko
ffca06d8a8 Drop specific behaviour in AbstractFindUsagesTest.kt for 172
It's OK to run find usages test under progress manager.
2018-04-23 16:41:13 +03:00
Nikolay Krasko
c6f8c868ce Minor: remove unused FIND_FILE_USAGES directive 2018-04-23 16:41:13 +03:00
Alexey Tsvetkov
2b4aa74c0b Add test cases for FQ-name parsing in IC 2018-04-23 15:03:42 +03:00
Leonid Startsev
01b40d4d02 Review fixes:
Use `StorageManager.createLazyValue` instead of default lazy delegate
Introduce `initialize` method instead of exposing type parameters
2018-04-23 14:39:17 +03:00
Leonid Startsev
666553e413 Add correct type parameter information to synthetic declarations
Needed by kapt due to https://github.com/Kotlin/kotlinx.serialization/issues/76
2018-04-23 14:39:17 +03:00
Alexey Tsvetkov
adc3e61742 Make assertion message more readable in JPS test
The test was failing recently on CI, but assertion message
does not give enough info: arrays' sizes are not equal,
so there were extra warnings, but what they were?
2018-04-22 23:05:59 +03:00
Nicolay Mitropolsky
06e65e5f48 182: removing Spring from Kotlin-Ultimate
because all necessary functionality is already in IDEA-Ultimate
2018-04-21 11:25:49 +03:00
Mikhail Glukhikh
00a9dea7cb KotlinAbstractUElement+KotlinUElementWithComments(172): add imports 2018-04-21 11:04:13 +03:00
Ilya Gorbunov
c239d346f7 Correctly indent upper bound separator in the generated stdlib code 2018-04-20 23:14:57 +03:00
Ilya Gorbunov
5381d0ed58 Move sequence operation classification higher than sample
Otherwise it gets eaten by that @sample tag.
2018-04-20 22:40:35 +03:00
Ilya Gorbunov
908d2d6975 Introduce kotlin-stdlib-generator dsl block for specifying sample reference 2018-04-20 22:40:35 +03:00
Mikhail Glukhikh
5dd7ff4d7f Up KotlinAbstractUElement / UElementWithComments / UVariable in branches 2018-04-20 21:29:55 +03:00
Mikhail Glukhikh
3e1d05f146 Update KotlinUMethod for 172/181/as32 branches 2018-04-20 21:23:05 +03:00
Pavel V. Talanov
521357a22d Add tests for KT-20824, KT-23745, KT-23124, KT-20605, KT-23760
#KT-20824 Fixed
 #KT-23745 Fixed
 #KT-23124 Fixed
 #KT-20605 Fixed
 #KT-23760 Fixed
2018-04-20 20:00:12 +02:00
Pavel V. Talanov
94fe170b7b MPP: analyze platform sources with expectedBy common sources
This allows to emulate current compiler behaviour

Introduce CombinedModuleInfo which is a combination of several other modules intended to be analyzed together
2018-04-20 20:00:11 +02:00
Pavel V. Talanov
94dfcba5c5 Minor: adjust quick fix test data to avoid "conflicting overloads" 2018-04-20 20:00:07 +02:00
Pavel V. Talanov
3949fc70c9 Adjust test data for previously ignored tests 2018-04-20 20:00:05 +02:00
Pavel V. Talanov
5ddb7c71d1 Mpp resolve: fix actual/expect declaration lookup
Previously we would look fo expect declaration in common dependencies
    as opposed to looking inside the module exclusively
2018-04-20 20:00:04 +02:00
Pavel V. Talanov
cdb49511e6 Mpp highlighting test: make generated, adjust test data
Note: this spawns new test cases which were ignored previously
2018-04-20 20:00:02 +02:00
Pavel V. Talanov
5a85f2437d Mpp test utils: allow to setup dependencies on stdlib and fulljdk
Allow to specify jjvm8 as platform
2018-04-20 20:00:00 +02:00
Mikhail Glukhikh
c69dd98c86 Build fix: quick-fix tests (forgotten actions) 2018-04-20 20:55:27 +03:00
Mikhail Glukhikh
a25e971d19 UAST: property delegates consistency #KT-22527 Fixed 2018-04-20 20:39:56 +03:00
Mikhail Glukhikh
f179b2ba13 Test for KT-22527 2018-04-20 20:39:54 +03:00
Mikhail Glukhikh
29c16f9561 Improve KotlinUElementWithComments & use it in most KotlinUElements
Related to KT-22135
2018-04-20 20:39:45 +03:00
J.T. Gilkeson
7a538accff Fix problem with trimEnd wiping out spans in SpannableStringBuilder
If I pass in a CharSequence with different spans, the original trimEnd using substring incorrectly wiped out the spans.
changing to subSequence correctly preserves the span data

#KT-23920 Fixed
2018-04-20 18:04:13 +03:00
Alexey Sedunov
36975786e8 Gradle: Import project dependency with non-default configuration by its artifacts 2018-04-20 16:57:43 +03:00
Dmitry Jemerov
2a684684a5 Pass canChangeWhitespaceOnly flag in reformat inspection
Otherwise IDEA will run preformat and postformat processors, which don't
expect to run outside of EDT (IDEA-185991)
2018-04-20 15:38:35 +02:00
Alexey Sedunov
38808118b1 Misc: Update test data for MavenUpdateConfigurationQuickFixTest (181/182) 2018-04-20 16:19:25 +03:00
Dmitry Petrov
54cf11fd0a Skip empty string entries when generating string template expression
#KT-19738 Fixed Target versions 1.2.50
2018-04-20 14:52:14 +03:00
Dmitry Petrov
22c2d8b563 Introduce a separate StackValue class for lateinit local vars
Local lateinit var differs in behavior from a simple local var,
and logic that relies of 'instanceof Local' checks assuming that all
instances of Local are simple local vars can produce faulty code
(as in KT-23260, where a local lateinit var was not explicitly put on
stack when passed as an argument to an inline function, thus causing
null propagation).

 #KT-23260 Fixed Target versions 1.2.50
2018-04-20 14:51:34 +03:00
Dmitry Petrov
7be4f5d31f Minor: reformat code in InlineCodegen 2018-04-20 14:51:34 +03:00
Nikolay Krasko
c86e157a48 Fix KotlinFileStructureTestGenerated in 181
Use common code for 173 and 181.
2018-04-20 14:37:02 +03:00
Nikolay Krasko
846a1a0179 Remove deprecated marker for JVM debugging in Kotlin code (KT-23886)
#KT-23886 Fixed
2018-04-20 14:37:01 +03:00
Nikolay Krasko
b6699d7522 Postpone analyze and remove direct working with BindingContext in folding
#KT-5206 Fixed
2018-04-20 14:37:01 +03:00
Aaron Nwabuoku
3a83983bfc Support code folding for standard library collection factory functions (KT-5206)
#KT-5206 Fixed
2018-04-20 14:37:01 +03:00
Mikhail Glukhikh
c4cdc0543d KT-23266 (forgotten change): modify plugin.xml for all branches 2018-04-20 13:17:06 +03:00
Mikhail Zarechenskiy
4f3fde2334 Regenerate tests 2018-04-20 13:06:22 +03:00
Mikhail Zarechenskiy
4a1c63cbbd [NI] Rename: isVariableReceiverForInvoke -> isForImplicitInvoke 2018-04-20 13:06:21 +03:00
Mikhail Zarechenskiy
397cc4f772 [NI] Support implicit invoke calls on parenthesized receivers 2018-04-20 13:06:21 +03:00
Mikhail Zarechenskiy
1e7682afc0 Minor, rename property according to the style 2018-04-20 13:06:20 +03:00
Mikhail Zarechenskiy
f039ec3625 Refactoring: get rid KotlinCallKind inside ResolutionKind 2018-04-20 13:06:20 +03:00
Alexey Sedunov
898105a5fa [REVERT/172] Test Support: Implement proper detection of existing TestNG configurations 2018-04-20 12:57:36 +03:00
Vyacheslav Gerasimov
0c6fb77637 Build: Set dependency on :dist for js.tests project test tasks 2018-04-20 11:35:55 +03:00
Vyacheslav Gerasimov
09a347b2d4 Disable assertion in RecompilableScriptFunctionData for js tests
which fails due to a bug in nashorn

 #KT-23637 Fixed
2018-04-20 11:35:42 +03:00
Ilya Gorbunov
481620ba32 Suppress dokka warnings for external classes exposing JS API to Kotlin
Usually MDN link in the class description is enough.
2018-04-20 06:39:01 +03:00
Swapnil Sankla
b93e385181 Add sample for setOf method
Ilya Gorbunov: Improve sample to illustrate stable iteration order and set equality.
2018-04-20 06:03:05 +03:00
Ilya Gorbunov
c5aed06110 Clarify docs for downTo and until 2018-04-20 05:25:31 +03:00
Ilya Gorbunov
501d969a38 Improve docs wording of zip function 2018-04-20 02:44:48 +03:00
Ilya Gorbunov
0eae27e03f Add samples for zip on sequences and strings 2018-04-20 02:00:36 +03:00
TakuyaKodama
2d4e591b5d Add samples for zip on arrays and collections
Write the sample references in the template and run the generator
2018-04-20 02:00:36 +03:00
Alexey Tsvetkov
137698d967 Minor: move BuildTimeReporter from buildSrc to report.gradle.kts 2018-04-19 21:03:32 +03:00
Ilya Gorbunov
b1f6ba703d Remove obsolete ant build scripts 2018-04-19 20:46:15 +03:00
Alexey Sedunov
48984fb3bf Maven: Support "javaParameters" tag in Kotlin/JVM configurations (181) 2018-04-19 19:11:54 +03:00
Alexey Sedunov
4819fc337d Misc: Fix dialog text for CallableRefactoring implementations
#KT-23778 Fixed
2018-04-19 19:06:48 +03:00
Alexey Sedunov
f69a807ae6 Change Signature: Fix original method info for Java method used in Kotlin
#KT-23714 Fixed
2018-04-19 19:06:48 +03:00
Alexey Sedunov
53a4baac8b Safe Delete: Do not replace SafeDeleteOverrideAnnotation for Java methods
#KT-23613 Fixed
2018-04-19 19:06:48 +03:00
Alexey Sedunov
4938825e19 Test Support: Implement proper detection of existing TestNG configurations
#KT-8407 Fixed
2018-04-19 19:06:48 +03:00
Alexey Sedunov
3b5227d6ea Maven: Support "javaParameters" tag in Kotlin/JVM configurations
#KT-23845 Fixed
2018-04-19 19:06:47 +03:00
Alexey Tsvetkov
7606cfd84f Print short build time summary after build 2018-04-19 18:23:10 +03:00
Claus Holst
84f0b327b1 KT-17608 Kotlin plugin says missing apply() call for SharedPreferences.Editor in With expression (#1164) 2018-04-19 16:29:27 +03:00
Alexey Sedunov
0f588955a9 Misc: Fix test data after updating to IDEA 181.3870.7 2018-04-19 15:27:56 +03:00
Zalim Bashorov
9c5e3ac629 Regenerate tests after rebase to master 2018-04-19 14:27:20 +03:00
Zalim Bashorov
d40b0b556c Regenerate tests after fix usages of IGNORE_BACKEND_WITHOUT_CHECK 2018-04-19 13:18:31 +03:00
Zalim Bashorov
09d5a0cb89 Fix usages of IGNORE_BACKEND_WITHOUT_CHECK 2018-04-19 13:17:28 +03:00
Zalim Bashorov
ad2ea8f999 Remove IGNORE_BACKEND_WITHOUT_CHECK and introduce DONT_RUN_GENERATED_CODE
Support DONT_RUN_GENERATED_CODE in JS Box tests.

IGNORE_BACKEND_WITHOUT_CHECK is removed because of
it's often wrongly used and in most cases can be
replaced with IGNORE_BACKEND or DONT_RUN_GENERATED_CODE
or with combination of them.
2018-04-19 13:17:28 +03:00
Zalim Bashorov
d03a128aa5 [JS IR BE] mute failed tests 2018-04-19 13:17:28 +03:00
Zalim Bashorov
ab03ab84bb Regenerate tests 2018-04-19 13:17:27 +03:00
Zalim Bashorov
a63b2e1bbd Some changes in test generating infrastructure:
* add separate run function for each test class to simplify and deduplicate generated code
* move the code that process IGNORE_BACKEND directive to the separate function, outside of generated code.
** it reduces size and complexity of a generated code
** it allows to mute and unmute tests w/o regenerate tests
* add an ability to generate IGNORE_BACKEND directive automatically, it's disabled by default
* add an ability to remove IGNORE_BACKEND directive automatically, it's enabled by default
* remove whitelists
2018-04-19 13:17:22 +03:00
Zalim Bashorov
4227d8e73a Remove accidentally left test classes: BytecodeTextTestGenerated and JsTypedArraysBoxTestGenerated 2018-04-19 13:17:22 +03:00
Zalim Bashorov
86fe2cc404 Minor: reformat DeprecatedSymbolUsageFixSpecialTest.kt 2018-04-19 13:17:21 +03:00
Toshiaki Kameyama
fee74273aa Invert if condition intention: do not remove line breaks #KT-11740 Fixed 2018-04-19 10:00:46 +03:00
Toshiaki Kameyama
dce5cb3ce9 Reformat InvertIfConditionIntention 2018-04-19 10:00:12 +03:00
Ilya Gorbunov
20b2277951 Minor: fix docs of internal getProgressionLastElement 2018-04-19 05:40:55 +03:00
Alexey Tsvetkov
701f96998a Remove unused SourceInfo interface 2018-04-19 05:18:54 +03:00
Alexey Tsvetkov
87558873b5 Fix source element for JsSwitch generated from 'when'
Before this change we set JsSwitch source to subject's JsExpression.
We ignore these types of source elements during:
1. js ast serialization (see 'JsAstSerializer.extractLocation');
2. source map generation (see 'SourceMapBuilderConsumer.addMapping').

However we might add indent during source generation
(see 'JsToStringGenerationVisitor.pushSourceInfo').

That seemingly broken 'testEnumEntryRemoved' in
'IncrementalJsCompilerRunnerTestGenerated.ClassHierarchyAffected',
because deserialized ast during incremental build would not
have source element at all (JsExpression was ignored), but ast
during rebuild would have JsExpression source element.
2018-04-19 05:18:54 +03:00
Alexey Tsvetkov
b0e8c85e88 Compare JS source maps in readable way in IC tests 2018-04-19 05:18:54 +03:00
Alexey Tsvetkov
dee8b403e3 Turn sourcemap generation on 2018-04-19 05:18:54 +03:00
Ilya Gorbunov
4f80f6d715 Sort .js files before passing them to merger to ensure stable output
#KT-23705 Fixed
2018-04-19 01:22:13 +03:00
Vyacheslav Gerasimov
c4da0e572d Remove comment about TeamCityBuild.xml from build.gradle.kts.182 2018-04-18 22:39:21 +03:00
Nicolay Mitropolsky
46ff4f2bbf 182: KotlinElementActionsFactory: "value"-parameters in generated java-annotations is putted without explicit parameter name #KT-23644 2018-04-18 21:17:24 +03:00
Mikhail Glukhikh
de0cbf5844 Join parameter/argument list: use document to delete whitespaces
Otherwise fix has no effect in IDE. Related to KT-23266
2018-04-18 20:45:31 +03:00
Toshiaki Kameyama
03902030ed Add intentions to put arguments / parameters on one line #KT-23266 Fixed 2018-04-18 20:45:31 +03:00
Ilya Gorbunov
96581f1ecb Do not read manifest properties into build script, remove allProjectsRecursive
Neither this helper, nor manifest properties are used in the build.
2018-04-18 19:41:22 +03:00
Vyacheslav Gerasimov
1753ae8d57 Remove obsolete TeamCityBuild.xml 2018-04-18 19:17:16 +03:00
Toshiaki Kameyama
3992f0215c "map.put() to assignment": handle case with labeled return inside
So #KT-23194 Fixed
2018-04-18 18:50:15 +03:00
Mikhail Glukhikh
77f62f1666 Move to separate file: minor optimization, related to KT-23321 2018-04-18 18:41:24 +03:00
Toshiaki Kameyama
a8d0e8995d Don't suggest to move type to separate file for sealed classes
So #KT-23321 Fixed
2018-04-18 18:41:23 +03:00
Vyacheslav Gerasimov
02578bc378 Add dependency on com.intellij.modules.androidstudio to AS 3.1 & 3.2 plugin.xml 2018-04-18 18:31:39 +03:00
Vyacheslav Gerasimov
8f1defa267 Fix plugin.xml formatting 2018-04-18 18:25:42 +03:00
Vyacheslav Gerasimov
cec554ead2 182: Remove snappy-in-java from IntellijCoreDependencies 2018-04-18 18:00:05 +03:00
Vyacheslav Gerasimov
2a04d08d3e Build: Use fromEmbeddedComponents helper in :prepare:android-lint 2018-04-18 17:53:32 +03:00
Vyacheslav Gerasimov
3b472f4411 Build: Use lazy from with trailing lambda in fromEmbeddedComponents
configurations shouldn't be resolved at project configuration step
2018-04-18 17:53:32 +03:00
Vyacheslav Gerasimov
49bb722f70 Remove update_dependencies from .idea/ant.xml 2018-04-18 17:53:32 +03:00
Nicolay Mitropolsky
0aa236d1ac 182: KotlinElementActionsFactory.createAddFieldActions no more generates private @JvmField and lateinit @JvmField 2018-04-18 17:41:35 +03:00
Alexander Udalov
789a6f9c63 Add test for deterministic bridge order
The test didn't fail before fixin the issue (in the previous commit),
but may still be useful in the future

 #KT-23707 Fixed
2018-04-18 15:55:33 +02:00
Denis Vnukov
e3829a70b0 Stable order of synthesized bridges.
In some cases when several bridge methods are generated, their order
is undetermenistic. For example for class ClassLowerWithContext in the
following example

```
interface IrElement
class IrClassContext

interface IrElementVisitor<out R, in D> {
    fun visitElement(element: IrElement, data: D): R
}

interface IrElementTransformer<in D> : IrElementVisitor<IrElement, D> {
    override fun visitElement(element: IrElement, data: D): IrElement =
            element.also { throw RuntimeException() }
}

abstract class ClassLowerWithContext : IrElementTransformer<IrClassContext?>
```

kotlin compiler synthesizes two additional bridges:

  public IrElement visitElement(IrElement, IrClassContext);
  [bridge] public Object visitElement(IrElement, Object);
  [bridge] public IrElement visitElement(IrElement, Object);

Unfortunately the behavior is not deterministic and not easy to reproduce.
2018-04-18 15:36:33 +02:00
Mikhail Glukhikh
5212b97047 Remove reformatting in intentions isApplicable via createByPattern 2018-04-18 16:15:57 +03:00
Mikhail Glukhikh
ef3ba5f0b1 Test local inspections on the fly via highlighting
Fixes problem with INFORMATION highlight type in batch mode (IDEA 181).
It's no more required to report INFORMATIONs in unit tests in batch.
2018-04-18 16:14:43 +03:00
Mikhail Glukhikh
b6661710dd Use expression body: reformat 2018-04-18 16:14:08 +03:00
Mikhail Glukhikh
28fe30c70d Use expression body: extend range if default level is INFORMATION
So #KT-23167 Fixed
2018-04-18 16:13:54 +03:00
Nikolay Krasko
f62e0dc5f7 Use com.intellij.modules.idea as dependency to forbid install in AS
`com.intellij.modules.idea` was introduced in 182 to distinguish
AS and IDEA installation (IDEA-187502).

Dependency should be removed in CLion and AppCode installation.
2018-04-18 15:49:41 +03:00
Nikolay Krasko
78a5fa766f Remove com.intellij.modules.remoteServers dependency from AS 3.2
Otherwise plugin won't be compatible with AS.
2018-04-18 15:49:40 +03:00
Nikolay Krasko
1ad2ed6761 Add com.intellij.modules.cidr.lang module dependency for CLion and AppCode
Otherwise after removing java dependency it would be possible to
install plugin non only in CLion and AppCode, but also in WebStorm,
PHPStorm, etc.
2018-04-18 15:49:40 +03:00
Nikolay Krasko
c4917d6d1c Use only hard dependency to java module and use include for jvm.xml (KT-23638)
Trick with both optional/non-optional dependency doesn't work in IDEA,
as it doesn't do an additional check optional dependency is found.

See com.intellij.ide.plugins.PluginManagerCore#checkDependants(
  IdeaPluginDescriptor, Function<PluginId, IdeaPluginDescriptor>,
  Condition<PluginId>, Set<PluginId>)

 #KT-23638 Fixed
2018-04-18 15:49:40 +03:00
Alexey Sedunov
03cca448d3 Misc: Make test superclass abstract 2018-04-18 14:37:23 +03:00
Nikolay Krasko
349f16aa64 Fix AbstractScratchRunActionTest.kt and remove usages of projectDisposable 2018-04-18 13:59:36 +03:00
Toshiaki Kameyama
ff63ba4dc1 Add inspection: redundant internal in local anonymous object / class
So #KT-23617 Fixed
2018-04-18 11:17:52 +03:00
Mikhail Glukhikh
1d3ba5641d "Main should return Unit": report on identifier, delete block body type 2018-04-18 11:16:03 +03:00
Toshiaki Kameyama
1cd438c3f7 Add inspection "main should return Unit" #KT-16085 Fixed 2018-04-18 10:59:23 +03:00
Ilya Gorbunov
8784d89f38 Use kotlin-stdlib-sources.jar in tests
Instead of deprecated kotlin-runtime-sources
2018-04-18 05:22:40 +03:00
Alexey Sedunov
3f147aabb0 Misc: Extract AbstractConfigureKotlinInTempDirTest superclass (181/AS32) 2018-04-17 20:38:00 +03:00
Alexey Sedunov
183559dcfa Misc: Extract AbstractConfigureKotlinInTempDirTest superclass
This avoids duplicating runs of ConfigureKotlinInTempDirTest
2018-04-17 17:46:50 +03:00
Pavel V. Talanov
33a312c26d Do not throw when trying to resolve java outside project model
#KT-23444 Fixed
 #KT-22825 Fixed
2018-04-17 16:19:49 +02:00
Mikhail Zarechenskiy
4af8833f08 Render unwrapped suspend function in backend
Hierarchy of specially wrapped suspend function may have inconsistent
 overridden descriptors: some of them may be wrapped, some unwrapped.
 To mitigate this problem, currently it's proposed to render only
 unwrapped functions, which are always have stable overridden descriptors

 #KT-23809 Fixed
2018-04-17 16:24:13 +03:00
Mikhail Zarechenskiy
c216749eb6 [NI] Fix substitutor for anonymous types with captured type parameters 2018-04-17 16:06:55 +03:00
Juan Chen
b7fa06cca4 Add "Convert Java to Kotlin" to ProjectViewPopupMenu and
EditorTabPopupMenu.
2018-04-17 15:36:55 +03:00
Alexey Sedunov
01b0518a61 Gradle Support: Declare 'gradleFrameworkSupport' extension point
This fixes exception in the New Project wizard (IDEA 172)

 #KT-23835 Fixed
2018-04-17 13:37:52 +03:00
Dmitry Petrov
d3a1d93460 Type translation, initial import 2018-04-17 10:35:52 +03:00
Dmitry Petrov
d1fe32a486 IrType: basic interface & implementation 2018-04-17 10:35:52 +03:00
Yan Zhulanow
b665a1b2b6 Android Extensions: Create application resource directories if missing (181, as31) 2018-04-16 20:42:58 +03:00
Mikhail Zarechenskiy
3318549622 [NI] Fix smartcasts computation for dot-qualifier expressions 2018-04-16 18:13:12 +03:00
Mikhail Glukhikh
55da251ffc Resolve problem with too long command line path in Gradle Windows 2018-04-16 17:08:27 +03:00
Vyacheslav Gerasimov
8b5faca2d1 Delete obsolete update_dependencies.xml 2018-04-16 16:23:28 +03:00
Alexey Sedunov
e58f8763fe Minor: Fix NPE in tests which doesn't use facets 2018-04-16 16:14:01 +03:00
Nikolay Krasko
9bce8759bb Remove accidentally added *.173.as32 files 2018-04-16 15:55:53 +03:00
Nikolay Krasko
ecd2db3b48 Remove bunch files that are equal to base files 2018-04-16 15:55:53 +03:00
Vyacheslav Gerasimov
b06e644753 as32: Fix tests compilation for AS 3.2 C10 2018-04-16 15:48:12 +03:00
Zalim Bashorov
e1ba08e03d [JS IR BE] add new items to whitelist and regenerate tests 2018-04-16 14:34:44 +03:00
Zalim Bashorov
ac42a0a23e [JS IR BE] don't materialize Unit for toplevel expressions 2018-04-16 14:34:44 +03:00
Zalim Bashorov
8408bada76 [JS IR BE] basic support for the case when IrBlock is used as expression
In this case compiler generates comma separated expressions.
2018-04-16 14:34:43 +03:00
Zalim Bashorov
77ac0a5d95 [JS IR BE] use most of new intrinsics in IR -> IR 2018-04-16 14:34:43 +03:00
Zalim Bashorov
48219e4a9a [JS IR BE] support new intrinsics in IR -> JS 2018-04-16 14:34:43 +03:00
Zalim Bashorov
76e102a2d2 [JS IR BE] declare more intrinsics
* jsGt
* jsGtEq
* jsLt
* jsLtEq
* jsUnaryPlus
* jsUnaryMinus
* jsPrefixInc
* jsPostfixInc
* jsPrefixDec
* jsPostfixDec
* jsAnd
* jsOr
* jsBitAnd
* jsBitOr
* jsBitXor
* jsBitNot
* jsBitShiftR
* jsBitShiftRU
* jsBitShiftL
* jsInstanceOf
2018-04-16 14:34:42 +03:00
Zalim Bashorov
2ed82f136c [JS IR BE] move intrinsic for Object.create calls to JsIntrinsics 2018-04-16 14:34:42 +03:00
Zalim Bashorov
89aefb2e3f [JS IR BE] add basic support for some binary and equality operations; add some intrinsic infrastructure 2018-04-16 14:34:41 +03:00
Zalim Bashorov
1f7d818307 [JS IR BE] use mapTo instead of map when translate call arguments 2018-04-16 14:34:41 +03:00
Zalim Bashorov
194f5d575a [JS IR BE] use IrMemberAccessExpression.valueArgumentsCount instead of descriptor based IrFunctionSymbol.parameterCount and remove last one 2018-04-16 14:34:40 +03:00
Nikolay Krasko
1fb2b40684 Fix 182 branch after QueryExecutor and subclasses update
Parameter taking Processor<T> were replaced with Processor<? super T>.
aaed1ccb91
c6b40a53ee

Instead of updating all usages, use ExecutorProcessor to avoid
different source code for different IDEAs.
2018-04-14 15:29:38 +03:00
Vyacheslav Gerasimov
879c7f3837 as32: Revert KotlinCallerChooser to 173 state 2018-04-13 21:33:17 +03:00
Vyacheslav Gerasimov
16b314f860 as32: Remove JavaBuilderExtension from AS 3.2 C10 2018-04-13 21:33:16 +03:00
Vyacheslav Gerasimov
76cbdf08aa as32: Update AndroidResourceReferenceAnnotator to AS 3.2 C10 2018-04-13 21:33:15 +03:00
Vyacheslav Gerasimov
8efee7bd9c as32: Revert uast to the state of idea 173, AS 3.2 C10 has uast from idea 173 2018-04-13 21:33:15 +03:00
Vyacheslav Gerasimov
a6bd0f618e as32: Remove platform-api & platform-impl from build scripts
since they are not present in AS 3.2 C10
2018-04-13 21:33:14 +03:00
Vyacheslav Gerasimov
00b5d5fa05 as32: Setup versions for AS 3.2 C10 2018-04-13 21:33:13 +03:00
Vyacheslav Gerasimov
4299455dc1 as32: Update to AS 3.2 C10 2018-04-13 21:33:03 +03:00
Vyacheslav Gerasimov
6fab21f916 Bunch: update bunch structure as32 <- 181 2018-04-13 20:55:37 +03:00
Alexey Sedunov
0647ffca36 MPP: Show error popups for module names in the New Kotlin/Multiplatform wizard
#KT-23261 Fixed
2018-04-13 20:23:08 +03:00
Alexey Sedunov
e51b6927b6 Refactor: Introduce JTextComponent.onTextChange() function 2018-04-13 20:23:07 +03:00
Alexey Sedunov
62f654b3d2 Introduce Variable: Avoid explicit types for expression of anonymous type
#KT-12078 Fixed
2018-04-13 20:23:07 +03:00
Alexey Sedunov
c7e72af170 Override/Implement Members: Copy @Experimental-annotated annotations
#KT-22922 Fixed
2018-04-13 20:23:06 +03:00
Alexey Sedunov
c1d8ba9c2b Parameter Info: Do not render nullability annotations
#KT-23408 Fixed
2018-04-13 20:23:06 +03:00
Alexey Sedunov
e5b915661a Rename: Do not suggest camel names for backquoted non-identifiers
#KT-22888 Fixed
2018-04-13 20:23:05 +03:00
Alexey Sedunov
ea66e1e3f7 Copy: Fix exception on copying KtFile to non-KtFile
#KT-22669 Fixed
2018-04-13 20:23:05 +03:00
Alexey Sedunov
bf106d01b8 Find Usages: Restrict search scope of private top-level declarations
#KT-7622 Fixed
2018-04-13 20:23:04 +03:00
Mikhail Glukhikh
c172810d1d Simplify boolean with constants optimization: use partial analysis 2018-04-13 19:11:55 +03:00
Toshiaki Kameyama
90be6235f7 Expand Selection on opening curly brace should select the entire block right away #KT-18769 Fixed 2018-04-13 13:23:42 +03:00
Nikolay Krasko
2227d205c7 Bunch: update "MoveLambdaOutsideParentheses: intention -> inspection"
decf9939fe
2018-04-13 10:45:32 +03:00
Nikolay Krasko
0253fe7c16 Bunch: update after "Wire StorageManager into a ..."
934c56a4da
2018-04-13 10:45:28 +03:00
Alexander Udalov
30b9caeae6 Fix NPE in data class 'equals' codegen
Do not perform the optimization from 0a11385006 for data class
properties of nullable types
2018-04-12 22:19:30 +02:00
Nikolay Krasko
579b773388 172: Remove 172 specific from psiModificationUtils.kt and KtPsiFactory.kt 2018-04-12 19:29:01 +03:00
Nikolay Krasko
2260f66e02 Unify usage of ProgressManager.progressIndicator 2018-04-12 19:29:01 +03:00
Alexander Udalov
1b1e4ab970 Fix stdlib test path in GenerateRangesCodegenTestData
This fixes `./gradlew generateTests`
2018-04-12 18:28:17 +02:00
Alexey Tsvetkov
ea8f2b5cd8 Clear MockApplication in ClassesFqNamesTest 2018-04-12 18:26:50 +03:00
Ilya Gorbunov
9c7fefba69 Restore default values in actual functions that have default values in expect
Suppress error about default argument values in actuals.
The suppression can be removed when/if KT-23548 is implemented.

This is to avoid degrading experience in docs and IDE when working with
these functions.
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
f7546c809d Minor: use common implementation of doubleTotalOrderEquals for tests 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
2826733e87 Put common sources into kotlin-stdlib-sources going into dist 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
136e6b64f2 In tests use stdlib sources from jar rather than from original locations 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
7ccbd36304 Set module name for common projects, this isn't done automatically yet 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
0e4925a20f Remove UNUSED_PARAMETER warning suppression from actual declarations 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
ac3de447ae Do not use code preprocessing anymore 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
37787f9769 Stdlib docs build: use multiplatform sources 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
9dd87d89ba Remove default values in actual functions that have default values in expect
Remove suppressions about default values in expect declarations
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
f7b2eba680 Do not mix expect/non-expect overloads of minOf/maxOf
Workaround for KT-22520
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
912c69aaa3 Suppress expect-actual mismatch for relaxed array extensions
Due to KT-21937
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
38be99daa3 Build stdlib-jdk7/8 tests as multiplatform manually 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
9b38e5e7b5 stdlib tests: move JVM-only test source files 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
ba873e2b46 stdlib tests: provide expect/actual helper functions 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
ee9608f8db stdlib-js: add actual modifiers where required 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
1be55db681 stdlib-common: remove common migration typealias for Volatile annotation
Otherwise it gets to jvm stdlib as new API.
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
0164f9b730 stdlib-common: correct common exception type declarations 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
10be42ddaa stdlib-common: suppress missing Comparator SAM constructor in JVM 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
d97707d6f7 Add JvmMultifileClass to preserve public API surface 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
23d0e5f2e1 Workarounds to build parts of stdlib as kotlin-runtime and mock runtime
Fix source paths of kotlin-stdlib-minimal-for-tests
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
7c74083f09 runtime-jvm: add actual modifiers where required 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
22255a5cc4 stdlib-jvm: move JVM specific sources, add actual modifier where required
Update copyright path after moving JVM sources
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
93f7a46ba4 stdlib-jvm: build as multiplatform, move project to jvm subfolder
Fix path with stdlib-jvm artifacts for public api test
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
0fb3393ee1 stdlib-js: build as multiplatform 2018-04-12 17:53:00 +03:00
Ilya Gorbunov
69ebb3bfb0 Switch to the new stdlib source generation scheme
Remove old generated sources for stdlib-jvm and stdlib-js
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
ae62cd6570 Do not produce original kotlin-stdlib public api dump anymore
It was produced from the kotlin-stdlib of 1.0 which was separate from the kotlin-runtime.
The actual dump is in kotlin-stdlib-runtime-merged.txt
2018-04-12 17:53:00 +03:00
Ilya Gorbunov
70236d4824 Build standard library for JVM from a single source set
Add explicit imports for kotlin.* and kotlin.text.* to prevent typealiases
conflicting with their aliased types from default imports.
2018-04-12 17:53:00 +03:00
Mikhail Zarechenskiy
cfc940af66 Avoid deprecated access by short name though companion object 2018-04-12 17:35:07 +03:00
Raluca Sauciuc
89d61ee12d Support androidx packages
... in the IDE plugin and the Android extensions compiler.

Change-Id: Iffd58351b0592e12ffc937c06d871d26958fe161
2018-04-12 16:29:13 +03:00
Mikhail Zarechenskiy
612baacc25 Make useless elvis diagnostic more consistent for new and old inference
Also, remove diagnostics that can be covered by usual USELESS_ELVIS diagnostic
2018-04-12 14:38:55 +03:00
Anton Bannykh
4e11555c46 JS: fix BasicIrBoxTest constructor & regenerate the tests 2018-04-12 13:52:21 +03:00
Dmitry Savvinov
934c56a4da Wire StorageManager into a ClassTypeConstructorImpl and ClassDescriptorImpl 2018-04-12 13:44:10 +03:00
Mikhail Glukhikh
1477e67076 Optimize KtPropertyAccessor.hasBlockBody() 2018-04-12 11:03:41 +03:00
Mikhail Glukhikh
876563ca91 Move lambda outside: use INFORMATION for named and multiple lambdas case 2018-04-12 11:03:40 +03:00
Mikhail Glukhikh
b0553a3863 Move lambda outside parentheses: fix inspection text / formatting 2018-04-12 11:03:40 +03:00
kenji tomita
decf9939fe MoveLambdaOutsideParentheses: intention -> inspection #KT-21413 Fixed 2018-04-12 11:03:40 +03:00
Nicolay Mitropolsky
83573ed517 181: Uast: more implementations of UCallExpressionEx 2018-04-12 10:29:07 +03:00
Alexey Tsvetkov
bd50ad87ba Use KotlinCoreEnvironment for parsing Kotlin in IC
Creating and disposing CoreApplicationEnvironment on each call leads to
problems with parallel builds, while KotlinCoreEnvironment
avoids disposing application environment in case of parallel builds.

    #KT-23694 fixed
2018-04-11 19:56:15 +03:00
Alexey Tsvetkov
13ac64b84a Move parseFileUtils to incremental-compilation-impl 2018-04-11 19:56:15 +03:00
Denis Zharkov
1442dd6c2b Avoid exponential complexity in LexicalScope::findLocalVariable
There was an exponential complexity in case we have a chain
of nested LexicalScopeWrapper instances:
we were walking through the chain and on each step running
the algorithm recursively.

Such a case is possible in scripts where each line contains LexicalScopeWrapper

The fix looks safe to me because delegate was used there
for checking !is ImportingScope && !is LexicalChainedScope

In all other means, being recursively run the algorithm does the same job.

 #KT-22740 Fixed
2018-04-11 17:53:19 +03:00
Denis Zharkov
a3c8afade5 Minor. Reformat ScopeUtils.kt 2018-04-11 17:53:19 +03:00
Nikolay Krasko
d93dff5657 Bunch: update QuickFixMultiFileTestGenerated.java.172 2018-04-11 17:20:37 +03:00
Toshiaki Kameyama
52d72ab920 Fix AE exception in "Convert too long character literal to string"
So #KT-23608 Fixed
2018-04-11 17:00:38 +03:00
Toshiaki Kameyama
1cbaab1531 Preserve annotation arguments in "Add use-site target" intention
So #KT-23634 Fixed
2018-04-11 17:00:38 +03:00
Toshiaki Kameyama
a5aad22fe7 Don't report "Redundant Companion reference" on accessing nested object
So #KT-23620 Fixed
2018-04-11 17:00:37 +03:00
Toshiaki Kameyama
94c5344fd1 Check explicit type specification in "Might be const" inspection
So #KT-23303 Fixed
2018-04-11 17:00:37 +03:00
Felix Guo
9539212180 Take Java source file into account in "Add annotation target"
So #KT-22860 Fixed
2018-04-11 17:00:37 +03:00
Nikolay Krasko
5559a6edd3 Fix quick fix, refactoring and slice tests - ignore bunch files 2018-04-11 16:28:45 +03:00
Nikolay Krasko
a3d01443b9 Update bunch plugin.xml after adding "Refactor sealed sub-class to object"
df7968678a
2018-04-11 16:28:45 +03:00
Nikolay Krasko
672169f3be Forgotten bunch file commit reminder 2018-04-11 16:28:45 +03:00
Nikolay Krasko
c8fb384465 Fix call to static PlatformTestCase.createModuleAt in 181 2018-04-11 16:28:45 +03:00
Vyacheslav Gerasimov
b98b02b56e 182: Suppress proguard warnings for com.intellij.util.SVGLoader
Depends on apache batick which has lots of dependencies, probably should be refactored out in idea
2018-04-11 16:28:44 +03:00
Vyacheslav Gerasimov
2514800ce0 182: Suppress proguard warnings for new guava nullability annotations 2018-04-11 16:28:44 +03:00
Vyacheslav Gerasimov
d9f9bf7564 182: Set picocontainer version to 1.2 2018-04-11 16:28:44 +03:00
Yan Zhulanow
6d5e49eeae 182: Android Extensions: Create application resource directory storage if absent 2018-04-11 16:28:44 +03:00
Nicolay Mitropolsky
abe0ca3bd1 182: multiPlatformSetup.kt: createTempDir is non-static in 182 2018-04-11 16:28:44 +03:00
Nicolay Mitropolsky
7a2fc4301b 182: CommonIntentionActionsTest updated to new ExpectedParameter 2018-04-11 16:28:43 +03:00
Nicolay Mitropolsky
001c5d6e3e 182: PsiReferenceBase nullability change fixes 2018-04-11 16:28:43 +03:00
Nicolay Mitropolsky
e7c3086db7 182: dep javax.annotation:jsr250-api:1.0 added to compiler/frontend.java 2018-04-11 16:28:43 +03:00
Nicolay Mitropolsky
072af7304f 182: jdk.internal.org.objectweb.asm.Opcodes -> org.jetbrains 2018-04-11 16:28:43 +03:00
Vladislav.Soroka
a1023953b4 182: KT-23383 Optional plugin dependency for kotlin gradle plugin 'java' subsystem dependent features 2018-04-11 16:28:43 +03:00
Nicolay Mitropolsky
c7c565ffa7 182: velocity-dependency fix for idea 182 2018-04-11 16:28:43 +03:00
Nicolay Mitropolsky
316826ef9b 182: CommonIntentionActionsTest-tests fix after createPropertyActions dropping in platform 2018-04-11 16:28:42 +03:00
Nicolay Mitropolsky
1b783070b5 182: generic PopupChooserBuilder<T> compilation fix 2018-04-11 16:28:42 +03:00
Nicolay Mitropolsky
fdb98fd4ab 182: KotlinOutputChecker.myTestName compilation fix 2018-04-11 16:28:42 +03:00
Nicolay Mitropolsky
41c30f06bb 182: KotlinElementActionsFactory.createAddAnnotationActions implementation (KT-22876) 2018-04-11 16:28:42 +03:00
Alexey Tsvetkov
d5f26f2d8d 182: Add oro version for 182 2018-04-11 16:28:41 +03:00
Alexey Tsvetkov
2f4dcd609c 182: Remove deprecated StoragePathMacros usages
Deprecated `StoragePathMacros.PROJECT_CONFIG_DIR` and
`StoragePathMacros.PROJECT_FILE` were removed in Intellij.
2018-04-11 16:28:41 +03:00
Alexey Tsvetkov
619663cc88 182: Remove com.android.annotations.NonNull usage from TestUtils.java
It is not present in Intellij (182.*) anymore.
Also `org.jetbrains.annotations.NotNull` seems OK here as well.
2018-04-11 16:28:41 +03:00
Alexey Tsvetkov
4fc89631a5 182: Update Guava version 2018-04-11 16:28:41 +03:00
Nicolay Mitropolsky
29b7e460dd 182: fixup: compilation fix: PlatformTestCase.myFilesToDelete made non-static in Platform 2018-04-11 16:28:41 +03:00
Nicolay Mitropolsky
44605580f3 182: compilation fix: PlatformTestCase.myFilesToDelete made non-static in Platform
some code from `PlatformTestCase` were copy-pasted to `KotlinLightCodeInsightFixtureTestCaseBase` because `PlatformTestCase` is not in it's type hierarchy, and thus we cant use these methods from `PlatformTestCase` when they became non-static
2018-04-11 16:28:40 +03:00
Nicolay Mitropolsky
22186c05b4 182: KotlinDecompilerServiceImpl and KtParsingTestCase compilation fixes 2018-04-11 16:28:40 +03:00
Vyacheslav Gerasimov
9e64b240ac 182: Set since-build to "182.1" & until-build to "182.*" 2018-04-11 16:28:40 +03:00
Vyacheslav Gerasimov
b37496c3fc 182: Fix compilation for idea 182, nullability changes mostly 2018-04-11 16:28:39 +03:00
Vyacheslav Gerasimov
ff1ce44c8b 182: Fix build scripts for idea 182 2018-04-11 16:28:39 +03:00
Vyacheslav Gerasimov
67d4ba200a 182: Build against idea 182-SNAPSHOT 2018-04-11 16:28:39 +03:00
Vyacheslav Gerasimov
75b2a29a91 182: Build: Add versions for 182 platform 2018-04-11 16:28:39 +03:00
Vyacheslav Gerasimov
1c9a2c5d30 182: Build: Support idea SNAPSHOT version 2018-04-11 16:28:39 +03:00
Vyacheslav Gerasimov
8af4ae0409 182: == 181 -> 182 ^^^ == 2018-04-11 16:28:39 +03:00
Yan Zhulanow
2e4b04bac5 181: Fix API wrapper in Android extensions 2018-04-11 16:28:38 +03:00
Nicolay Mitropolsky
6e1edb420e 181: StringTemplateExpressionManipulatorTest compilation fix 2018-04-11 16:28:38 +03:00
Alexey Tsvetkov
39f7ecc9a3 181: Reimplement constant search in JPS
The API in Intellij have been changed after the PR was merged
(see 8227d8e2dd)

This commit implements new API.
Also mocked Kotlin constant search is removed from JPS tests.
Mocked Java search is in place, but now
it is does not use hardcoded file and constant names.

   #KT-16091 fixed
2018-04-11 16:28:38 +03:00
Alexey Tsvetkov
5ed66c3998 181: Update Idea to 181.4203.6 2018-04-11 16:28:38 +03:00
Alexey Tsvetkov
8d2508e351 181: Fix oromatcher dependency 2018-04-11 16:28:38 +03:00
Vyacheslav Gerasimov
1b36724495 181: Set until-build to "181.*" 2018-04-11 16:28:37 +03:00
Alexey Sedunov
25d19b45e9 181: Safe Delete: Do not delegate class search to Java
This fixes tests failing in IDEA 181
2018-04-11 16:28:37 +03:00
Vyacheslav Gerasimov
4cf804f30f 181: Restore broken android lint quickfixes 2018-04-11 16:28:37 +03:00
Vyacheslav Gerasimov
207247347e 181: Fix test data for android lint based tests 2018-04-11 16:28:37 +03:00
Nicolay Mitropolsky
94d18581e3 181: FakeFileForLightClass made return "virtualFile" from "ktFile" 2018-04-11 16:28:37 +03:00
Nicolay Mitropolsky
44a37f5dad 181: Uast: KotlinAccessorCallExpression.methodIdentifier fix 2018-04-11 16:28:36 +03:00
Alexey Sedunov
7413e09dc1 181: Move: Replace deprecated method call 2018-04-11 16:28:36 +03:00
Alexey Sedunov
bd6b96341f 181: Move: Remove unnecessary runSynchronouslyWithProgress() call
This method is already invoked under progress manager
2018-04-11 16:28:36 +03:00
Alexey Sedunov
ffc059a0a1 181: Misc: Update Move test data 2018-04-11 16:28:36 +03:00
Vyacheslav Gerasimov
212d218bc6 181: Fix test runtime for 181 platform compiler tests 2018-04-11 16:28:36 +03:00
Vyacheslav Gerasimov
ae338566c2 181: Fix test data for android lint based tests 2018-04-11 16:28:35 +03:00
Nicolay Mitropolsky
585348c590 181: LightClasses: using viewProvider from KtFile
#KT-22929
2018-04-11 16:28:35 +03:00
Nicolay Mitropolsky
1125926009 181: Revert "Fix OOM in tests for 181 (Temporary workaround)"
This reverts commit 5cf45ef
2018-04-11 16:28:35 +03:00
Nicolay Mitropolsky
f0a85eeefb 181: IDEA updated to 181.3870.7 2018-04-11 16:28:35 +03:00
Nicolay Mitropolsky
55753d79e8 181: using InjectedFileViewProvider for light-files in language-injections
#KT-22929
2018-04-11 16:28:34 +03:00
Nicolay Mitropolsky
5951fbb390 181: KotlinFinalClassOrFunSpringInspection dropped 2018-04-11 16:28:34 +03:00
Nicolay Mitropolsky
4d65147373 181: KotlinSpringClassAnnotator dropped 2018-04-11 16:28:34 +03:00
Nicolay Mitropolsky
f539ed76a8 181: SpringKotlinAutowiringInspection dropped 2018-04-11 16:28:34 +03:00
Nicolay Mitropolsky
9bac6c5a71 181: Light annotations made strictly non-physical (KT-22565)
(cherry picked from commit cf6e21d)
2018-04-11 16:28:34 +03:00
Nicolay Mitropolsky
5a1a6a3780 181: ultimate: smali dependency added 2018-04-11 16:28:33 +03:00
Simon Ogorodnik
d361e0f5ea 181: Try to fix OOM in 181 by rising Xmx 2018-04-11 16:28:33 +03:00
Nikolay Krasko
48d357136d 181: Idea update to 181.3494.3 (Fixup on rebase) 2018-04-11 16:28:33 +03:00
Alexey Sedunov
4934b45b61 181: Change Signature: Restore node generation method
#KT-22817 Fixed
2018-04-11 16:28:33 +03:00
Alexey Sedunov
aee9938c70 181: Kotlin Ultimate: Update NodeJS plugin version 2018-04-11 16:28:33 +03:00
Nikolay Krasko
8e147bf3f0 181: Idea update to 181.3494.3 2018-04-11 16:28:32 +03:00
Nicolay Mitropolsky
7e5b417955 181: Uast: don't use com.intellij.psi.util.parentOfType (KT-22734) 2018-04-11 16:28:32 +03:00
Simon Ogorodnik
3fd9ec1b18 181: Fix OOM in tests for 181 (Temporary workaround) 2018-04-11 16:28:32 +03:00
Nicolay Mitropolsky
8cde41850e 181: Uast: support for object literals 2018-04-11 16:28:32 +03:00
Nicolay Mitropolsky
036c0fd6a4 181: Uast: fixes for non-leaf identifiers 2018-04-11 16:28:32 +03:00
Nicolay Mitropolsky
8a4ef83b3d 181: Uast: identifiers testdata updates 2018-04-11 16:28:31 +03:00
Vyacheslav Gerasimov
327cff0876 181: Set until-build to "182.*" 2018-04-11 16:28:31 +03:00
Nicolay Mitropolsky
f40ea754cb 181: Uast: identifiers fixes for KotlinUFunctionCallExpression and AbstractKotlinUVariable 2018-04-11 16:28:31 +03:00
Alexey Sedunov
7988fcabcc 181: Misc: Refine nullability to match changes in the platform 2018-04-11 16:28:31 +03:00
Nicolay Mitropolsky
8ce65dc715 181: Uast: weak consistency check and fixes for UIdentifiers 2018-04-11 16:28:31 +03:00
Vyacheslav Gerasimov
1bf12841ae 181: Set 'versions.intellijSdk' to '181.3007.14' 2018-04-11 16:28:30 +03:00
Nicolay Mitropolsky
224480ac5e 181: UAST: UAnchorOwner and type-specific javaPsi support 2018-04-11 16:28:30 +03:00
Nicolay Mitropolsky
ffe33844b7 181: compilation fix: KotlinCallerChooser and KotlinAwareMoveClassesOrPackagesToNewDirectoryDialog 2018-04-11 16:28:30 +03:00
Nicolay Mitropolsky
26a0dbe910 181: KotlinElementActionsFactory: makes elements public by removing other visibility modifiers 2018-04-11 16:28:30 +03:00
Nicolay Mitropolsky
e48b905075 181: Uast: getArgumentForParameter(i: Int) implementation for Kotlin (IDEA-184046) 2018-04-11 16:28:29 +03:00
Nicolay Mitropolsky
1507eed1cf 181: Uast: Constructors.identifiers.txt testdata fix 2018-04-11 16:28:29 +03:00
Vyacheslav Gerasimov
a0e20eefc6 181: Fix dependencies for 181 2018-04-11 16:28:29 +03:00
Vyacheslav Gerasimov
95c854121a 181: Fix compilation MockUpdateParameterInfoContext 2018-04-11 16:28:29 +03:00
Vyacheslav Gerasimov
283ac840c2 181: Add smali plugin required by android plugin to test runtime 2018-04-11 16:28:29 +03:00
Nikolay Krasko
d32c9ada59 181: Remove deprecated API from language injection in 181 2018-04-11 16:28:28 +03:00
Nicolay Mitropolsky
aae4bb1e1f 181: KotlinElementActionsFactory fix for switching on new API
one test is still falling (
2018-04-11 16:28:28 +03:00
Nicolay Mitropolsky
96ac913a6d 181: Uast: parents for UIdentifiers from toUElement 2018-04-11 16:28:28 +03:00
Nicolay Mitropolsky
4e078fe94b 181: Android-related compilation fix (klint.AndroidLintInspectionBase) 2018-04-11 16:28:28 +03:00
Nicolay Mitropolsky
984c2329b4 181: Uast: KotlinUIdentifier almost everywhere (KT-21688) 2018-04-11 16:28:28 +03:00
Nicolay Mitropolsky
9efa79f352 181: Uast: KotlinUIdentifier introduced to store proper sourcePsi (KT-21688) 2018-04-11 16:28:28 +03:00
Nicolay Mitropolsky
c3decbb62c 181: KotlinCoreEnvironment: set ideaCompatibleBuildNumber = "181.1" 2018-04-11 16:28:27 +03:00
Vyacheslav Gerasimov
5f96b5c4d0 181: build fix: IdeaForkJoinWorkerThreadFactory.setupForkJoinCommonPool
now has parameter headless
2018-04-11 16:28:27 +03:00
Vyacheslav Gerasimov
8e20d540d5 181: Fix RunConfigurationTest.kt, nullability changed in 181 platform 2018-04-11 16:28:27 +03:00
Vyacheslav Gerasimov
f31b56a936 181: Fix compatibility after AS 3.0 was merged to 181 2018-04-11 16:28:27 +03:00
Nicolay Mitropolsky
e322c2d70b 181: yet another PersistentStateComponent-related compilation fix 2018-04-11 16:28:26 +03:00
Alexander Podkhalyuzin
f5e0dfaf8c 181: Parameter state in PersistenceStateComponent is not null now in platform 2018-04-11 16:28:26 +03:00
Nicolay Mitropolsky
1f0f99dc82 181: KotlinTestUtils compilation fix: ShutDownTracker.invokeAndWait removed 2018-04-11 16:28:26 +03:00
Vyacheslav Gerasimov
b61ba4a87a 181: Set correct since-build for Idea 181 plugin 2018-04-11 16:28:26 +03:00
Nicolay Mitropolsky
fe9138f658 181: Using setText instead of text = in EditorTextField after nullability changes in platform 2018-04-11 16:28:26 +03:00
Nicolay Mitropolsky
f291873cf8 181: compilation fix when access progressIndicator in ProgressManager by adding !! 2018-04-11 16:28:25 +03:00
Nicolay Mitropolsky
395a817ada 181: compilation fixes related to BackspaceHandlerDelegate and DocumentWindowImpl changes in IDEA 181 2018-04-11 16:28:25 +03:00
Nicolay Mitropolsky
52acefbb18 181: fix for KotlinDebuggerTestCase compilation 2018-04-11 16:28:25 +03:00
Nicolay Mitropolsky
6ce2c079a7 181: UAST: lazy computation made SYNCHRONIZED in UAST
because of UElement caching in platform, which leads to multithreaded usage
2018-04-11 16:28:25 +03:00
Vyacheslav Gerasimov
e3387953f2 181: == 173 -> 181 ^^^ == 2018-04-11 16:28:25 +03:00
Raluca Sauciuc
cab1813dcd as32: Fix compilation to match changes in SdkConstants (#1533)
... and match the intended semantics for AndroidxName.

Change-Id: If2148ab8cefcc124a72f63458b7dbddf1a6cfe04
2018-04-11 16:28:24 +03:00
Vyacheslav Gerasimov
86f8174093 as32: Set intellijEnforceCommunitySdk for AS 2018-04-11 16:28:24 +03:00
Vyacheslav Gerasimov
6929764672 as32: Set since-build to "173.4548.28" for AS 3.2 C3 2018-04-11 16:28:24 +03:00
Vyacheslav Gerasimov
054ae37ef4 as32: Fix fqname constant usages for AS 3.2 C3 2018-04-11 16:28:24 +03:00
Raluca Sauciuc
25e193546d as32: Android framework resource refactoring fixes
Change-Id: I5dc44306eb315bc9463aaf3d55ad1a75c1e12015
2018-04-11 16:28:24 +03:00
Vyacheslav Gerasimov
86e221f867 as32: Build against AS 3.2 C3 2018-04-11 16:28:23 +03:00
Vyacheslav Gerasimov
b83da08708 as32: Fix compilation against AS 3.2 C2 2018-04-11 16:28:23 +03:00
Vyacheslav Gerasimov
7b69459ad0 as32: Update to AS 3.2 C2 2018-04-11 16:28:23 +03:00
Vyacheslav Gerasimov
2d65e5a60c as32: Fix gradle plugin dependencies for AS 3.2 2018-04-11 16:28:23 +03:00
Vyacheslav Gerasimov
4c76ae12d1 as32: Build against AS 3.2 2018-04-11 16:28:23 +03:00
Vyacheslav Gerasimov
302ff12444 as32: == as31 -> as32 ^^^ == 2018-04-11 16:28:23 +03:00
Yan Zhulanow
5efe6b40af as31: Fix Android-related compilation problems 2018-04-11 16:28:22 +03:00
Nikolay Krasko
fac4be2c1f as31: Remove remoteServers dependency to make compatible with AS 2018-04-11 16:28:22 +03:00
Vyacheslav Gerasimov
1ea093c0bc as31: Set until-build to "173.4301.25" for AS 3.1 2018-04-11 16:28:22 +03:00
Nicolay Mitropolsky
60fe6a911f as31: KotlinTestUtils: resolving PathUtil conflict 2018-04-11 16:28:22 +03:00
Nicolay Mitropolsky
0f6df38211 as31: fixup: Kotlin Facet: Configure facet based on Android build variant (in AS) 2018-04-11 16:28:22 +03:00
Nicolay Mitropolsky
a300682f04 as31: facetUtils.kt compilation fix (configureSdkIfPossible-nullability) 2018-04-11 16:28:21 +03:00
Vyacheslav Gerasimov
e2578b6a17 as31: Add smali plugin required by android plugin to test runtime 2018-04-11 16:28:21 +03:00
Vyacheslav Gerasimov
00d9dc7cc0 as31: Fix GenerateTests.kt compilation for AS 2018-04-11 16:28:21 +03:00
Vyacheslav Gerasimov
b250d20dde as31: Disable ultimate for Android Studio 2018-04-11 16:28:21 +03:00
Vyacheslav Gerasimov
fd0045cf6b as31: Fix build scripts for AS 3.1 2018-04-11 16:28:21 +03:00
Vyacheslav Gerasimov
25fddaacfb as31: Fix compilation ResourceReferenceAnnotatorUtil 2018-04-11 16:28:20 +03:00
Vyacheslav Gerasimov
ec460d88a7 as31: Fix compilation KotlinAndroidGradleLibraryDataService.kt for AS 3.1 2018-04-11 16:28:20 +03:00
Vyacheslav Gerasimov
06efb037fd as31: Fix test data for testAddArrayOfTypeForJavaAnnotation 2018-04-11 16:28:20 +03:00
Vyacheslav Gerasimov
c78c82a366 as31: Fix GradleFacetImportTest for AS 2018-04-11 16:28:20 +03:00
Simon Ogorodnik
d58b0798cc as31: Fix AbstractImportsTest, add missing project parameter
Settings by default taken from per-project settings manager
instead of app settings
2018-04-11 16:28:20 +03:00
Vyacheslav Gerasimov
9bb3bb2777 as31: Remove duplicate registration of KotlinUastBindingContextProviderService
from android-lint.xml, it is already registered in plugin.xml
2018-04-11 16:28:20 +03:00
Vyacheslav Gerasimov
4c498b004f as31: Fix test data for android lint based tests for AS 3.0 2018-04-11 16:28:19 +03:00
Vyacheslav Gerasimov
e12e63572c as31: Fix TypeParameterFindViewByIdInspection for AS 3.0 2018-04-11 16:28:19 +03:00
Nikolay Krasko
589487951c as31: Remove ultimate settings from AS branch 2018-04-11 16:28:19 +03:00
Ilya Gorbunov
f22093ee7b as31: Comment out some new code in ClasspathRootsResolver
Relates to disabled modular JDK9 support.
2018-04-11 16:28:18 +03:00
Yan Zhulanow
48ae0651c6 as31: Add typealias for AndroidGradleModel
(cherry picked from commit f6c6845)

(cherry picked from commit d13c2c2)
2018-04-11 16:28:18 +03:00
Simon Ogorodnik
e9caa54afa as31: Remove dependencies on jps/test 2018-04-11 16:28:18 +03:00
Simon Ogorodnik
647ff74612 as31: Disable maven for AS30 2018-04-11 16:28:18 +03:00
Alexey Sedunov
6636c4376b as31: Kotlin Facet: Configure facet based on Android build variant (in AS)
#KT-19958 Fixed
2018-04-11 16:28:18 +03:00
Alexey Sedunov
a9cdccc6de as31: Misc: Fix compilation 2018-04-11 16:28:18 +03:00
Dmitry Jemerov
8568bde4df as31: Fix compilation
(cherry picked from commit bc0bc0e)
2018-04-11 16:28:17 +03:00
Mikhael Bogdanov
554b834f2c as31: Revert "Fix codegen tests on JDK 9 with jdkKind = FULL_JDK" 2018-04-11 16:28:17 +03:00
Dmitry Jemerov
932e9c74b6 as31: No Maven in AS 2018-04-11 16:28:17 +03:00
Dmitry Jemerov
abce7170be as31: Implement ConvertJavaToKotlinProvider
(cherry picked from commit 34dfa24)
2018-04-11 16:28:17 +03:00
Vyacheslav Gerasimov
38b38511a0 as31: Fix KotlinAndroidLineMarkerProvider for AS 3.0 2018-04-11 16:28:17 +03:00
Vyacheslav Gerasimov
13b192cd47 as31: Moved getRequiredVersion to KotlinAndroidQuickFixProvider 2018-04-11 16:28:16 +03:00
Vyacheslav Gerasimov
11ee744340 as31: Drop custom Kotlin Android lint, register quickfixes with extension point 2018-04-11 16:28:16 +03:00
Dmitry Jemerov
686d8a1756 as31: Compilation fixes for as24 2018-04-11 16:28:16 +03:00
Vyacheslav Gerasimov
ab532732ed as31: Fix compilation AndroidResourceReferenceAnnotator 2018-04-11 16:28:15 +03:00
Vyacheslav Gerasimov
02f842f8b5 as31: Revert "Quickfix to enable language feature works for Maven project"
This reverts commit aabd560eef.
2018-04-11 16:28:15 +03:00
Vyacheslav Gerasimov
3dcca14a50 as31: Revert "Quickfix to enable coroutine support works in Maven projects"
This reverts commit 7346fee513.
2018-04-11 16:28:15 +03:00
Vyacheslav Gerasimov
78140fb304 as31: Fix compilation JavaRuntimePresentationProvider 2018-04-11 16:28:15 +03:00
Vyacheslav Gerasimov
7d7fff52b8 as31: Fix build for AS 2.4.0.3
(cherry picked from commit a79f7a7)
2018-04-11 16:28:15 +03:00
Pavel V. Talanov
8eb80a8f4a as31: Add step to patch plugin xml so that it only works in Android Studio
(cherry picked from commit fcee4eb)

(cherry picked from commit 14f7731)

(cherry picked from commit b1f5df2)
2018-04-11 16:28:14 +03:00
Vyacheslav Gerasimov
7c30e80382 as31: Kotlin Facet: Configure facet on Gradle project sync in Android Studio 2.3
#KT-15909 Fixed

(cherry picked from commit 6a490bc681)
2018-04-11 16:28:14 +03:00
Vyacheslav Gerasimov
6bca651848 as31: Fix compilation for Android Studio 2.4 2018-04-11 16:28:14 +03:00
Vyacheslav Gerasimov
a4699add8e as31: Fix gotoResourceHelper: MyReferredResourceFieldInfo now requires module 2018-04-11 16:28:14 +03:00
Vyacheslav Gerasimov
b6abe84357 as31: Fix ResourceFoldingBuilder for AS 2.4 2018-04-11 16:28:14 +03:00
Yan Zhulanow
bb4b1f5b9c as31: Remove Maven components from all-open and no-arg plugins 2018-04-11 16:28:13 +03:00
Yan Zhulanow
72e66f6175 as31: Disable Maven and JPS modules which is not available in AS 2018-04-11 16:28:13 +03:00
Nikolay Krasko
e1fe148561 as31: Run AS properly 2018-04-11 16:28:13 +03:00
Nikolay Krasko
9f8ab7b98e as31: == 173 -> as31 ^^^ == 2018-04-11 16:28:13 +03:00
Natalia Selezneva
5ba337e998 172: Replace missing property from GradleConstants 2018-04-11 16:28:13 +03:00
Nicolay Mitropolsky
9af4f8c66b 172: psiModificationUtils.kt: compilation fixes 2018-04-11 16:28:13 +03:00
Nikolay Krasko
ef6c8c6a10 172: Revert "UAST: support for JvmDeclarationUElement"
This reverts commit db6a2390a22d4b35246cc4c6d246a5d7752f3506.
2018-04-11 16:28:12 +03:00
Nikolay Krasko
e2fb63729d 172: Revert "Data Inflow: Support grouping by leaf expressions"
This reverts commit d5af2db2f259c7d55d38be73b9a5136e3aefd580.
2018-04-11 16:28:12 +03:00
Mikhael Bogdanov
b785aca98e 172: Fix compilation 2018-04-11 16:28:12 +03:00
Nikolay Krasko
cdc0f60fe8 172: Restore KotlinCommonCodeStyleSettings behaviour for 172 Idea
There are no soft margins in CommonCodeStyleSettings.
2018-04-11 16:28:12 +03:00
Nikolay Krasko
ca7f25d52f 172: Fix compilation in 172 after AbstractApplicationUsagesCollector rename
See c299f7d10a93a055cc868a9d9d20d68cc47c35e3 to intellij_community
2018-04-11 16:28:12 +03:00
Nicolay Mitropolsky
18198ee33c 172: Uast-revert: test-data-revert 2018-04-11 16:28:11 +03:00
Nicolay Mitropolsky
a15d48c444 172: Uast-revert: reverting to previous rebase state 2018-04-11 16:28:11 +03:00
Nicolay Mitropolsky
c6bb0ad712 172: Uast-revert: AbstractKotlinRenderLogTest 2018-04-11 16:28:11 +03:00
Nicolay Mitropolsky
302bdebd3a 172: AbstractSlicerTest.kt reverted to previous rebase 2018-04-11 16:28:11 +03:00
Nicolay Mitropolsky
8c7269ea9a 172: KotlinUCollectionLiteralExpression: remove override modifier 2018-04-11 16:28:11 +03:00
Nicolay Mitropolsky
fb0b9221f9 172: IDEA-172-related compilation fix PluginTestCaseBase.addJdk(myFixture.projectDisposable 2018-04-11 16:28:10 +03:00
Natalia Selezneva
39d9ac1250 172: Remove textAttributes parameter from EditorCustomElementRenderer:paint 2018-04-11 16:28:10 +03:00
Nikolay Krasko
934f2d6e2c 172: Restore usage of PathUtil.getLocalFile in 172 idea
There's no VfsUtil.getLocalFile
2018-04-11 16:28:10 +03:00
Vyacheslav Gerasimov
7dcbb909a6 172: Set intellijSdk to 172.4343.14 2018-04-11 16:28:10 +03:00
Vyacheslav Gerasimov
e72007901a 172: Revert "UAST: override getFunctionalInterfaceType + test"
This reverts commit 92c23aa
2018-04-11 16:28:10 +03:00
Vyacheslav Gerasimov
8d3f71a04f 172: Revert "Quick Fixes: Support cross-language "Create from Usage" with Kotlin target"
This reverts commit 908bf71
2018-04-11 16:28:09 +03:00
Vyacheslav Gerasimov
747f397f40 172: Revert "Quick Fixes: Drop deprecated KotlinCommonIntentionActionsFactory"
This reverts commit ba0a91d
2018-04-11 16:28:09 +03:00
Vyacheslav Gerasimov
deb2ffb49f 172: Revert "Refactoring: Use modifier list in CallableInfo where possible"
This reverts commit 99be75c
2018-04-11 16:28:09 +03:00
Nikolay Krasko
577e6e5206 172: Try to remove unneeded commits in 172 branch
Revert "[Unneeded?] Revert "ExpressionOfTypeProcessor: get member name in read action""
This reverts commit 7ec59fc

Revert "[Unneeded] Revert "AbstractNavigateToLibraryTest: fix for invalid files""
This reverts commit 9e80c60

Revert "[Unneeded?] Revert "AbstractExtractionTest: fix for invalid files""
This reverts commit 0b2113b

Revert "[Unneeded] Revert "AbstractIntentionTest: `isApplicableOnPooled` made run under ProgressIndicator""
This reverts commit a41c247
2018-04-11 16:28:09 +03:00
Nikolay Krasko
9c38454c2e 172: [Unneeded?] Revert "ExpressionOfTypeProcessor: get member name in read action"
This reverts commit 32d8e0c72b877f0c0123bb56e0d92beaab410daa.
2018-04-11 16:28:09 +03:00
Nikolay Krasko
0df179de3b 172: [Unneeded] Revert "AbstractNavigateToLibraryTest: fix for invalid files"
This reverts commit e71b1757be6ca4b9ef49d65c6250a94f5f724f53.
2018-04-11 16:28:08 +03:00
Nikolay Krasko
8eb40466ee 172: [Unneeded?] Revert "AbstractExtractionTest: fix for invalid files"
This reverts commit b3b71ac53bb5150457ff228ecccb15060dd2de1f.
2018-04-11 16:28:08 +03:00
Nikolay Krasko
2cc2ea0ce1 172: [Unneeded] Revert "AbstractIntentionTest: isApplicableOnPooled made run under ProgressIndicator"
This reverts commit d1ad207fdbed6698ec352bd8b759f9ae62baebb3.
2018-04-11 16:28:08 +03:00
Nikolay Krasko
9de5b83f6e 172: Revert "UAST: Properly handle annotations on local variables"
This reverts commit 70de7cff5e23abf723009c8df8bc2df2f646a675.
2018-04-11 16:28:08 +03:00
Nikolay Krasko
9db35f27d7 172: Revert "UAST: Add testConvertTypeInAnnotation"
This reverts commit 7d1b28b2b6bc80411ef19bb7619181bee637cf20.
2018-04-11 16:28:08 +03:00
Nikolay Krasko
c106c6a5d2 172: Revert "UAST: Fix testPropertyWithAnnotation"
This reverts commit 36a405cb55198592ee017c7eed9bd50fd6433f22.
2018-04-11 16:28:07 +03:00
Nikolay Krasko
334ae82b04 172: Revert "UAST test data fixes: @null in render"
This reverts commit 2f366b8209206b32792919f35f896fc63ad4b0e5.
2018-04-11 16:28:07 +03:00
Nikolay Krasko
99f74af006 172: Revert "UAST test data fixes: LocalVariableWithAnnotationKt fix for variable type"
This reverts commit ef61beb53ae1030afe11b3d15a2750959136ad65.
2018-04-11 16:28:07 +03:00
Nikolay Krasko
b02ec40a4c 172: Revert "UAST: support for JvmDeclarationUElement"
This reverts commit db6a2390a22d4b35246cc4c6d246a5d7752f3506.
2018-04-11 16:28:07 +03:00
Nikolay Krasko
17a5ce809f 172: Revert "UAST: SimpleKotlinRenderLogTest.testWhenAndDestructing testdata fix"
This reverts commit c6c71dc5e82e5eec547fb6fe3fe6eb578e8183c9.
2018-04-11 16:28:06 +03:00
Nikolay Krasko
5a072fffd2 172: Revert "UAST: StringTemplateComplex testdata fix"
This reverts commit 2ef0be9b2af14438aa7d899f78e2da327e9a8a07.
2018-04-11 16:28:06 +03:00
Nikolay Krasko
72b4b2b9bf 172: Revert "Uast: AbstractKotlinUClass compilation fix"
This reverts commit 86ee036ae7d89f8acc885d54157d9b9ce5f2cb17.
2018-04-11 16:28:06 +03:00
Nikolay Krasko
bf27a16144 172: Revert "Uast: SuperCalls.render.txt testdata fix"
This reverts commit 28a0267dc131ab37ede64f38de0dc2722aba1762.
2018-04-11 16:28:06 +03:00
Nikolay Krasko
fbf722e0bd 172: Revert "Uast: Constructors.kt testData fixes"
This reverts commit 0d35e32b1ee7006b9c9febf1f8992fbbe3246230.
2018-04-11 16:28:06 +03:00
Nikolay Krasko
633eafb902 172: Revert "Uast: WrappedUAnnotation as replacement for usage of JavaUAnnotation (KT-21025)"
This reverts commit 9701403889fbed93d9ea1e8fa4df58c720b3be72.
2018-04-11 16:28:06 +03:00
Nikolay Krasko
7b89b28015 172: Revert "Uast: AbstractKotlinUVariable annotations now are retrieved from Kotlin Psi, not from compiled (KT-21025)"
This reverts commit ebbfc4a3845159ba8f0e3d94a5f70489c348c403.
2018-04-11 16:28:05 +03:00
Nikolay Krasko
50419db87d 172: Revert "Uast: removing java-uast usage from KotlinUastLanguagePlugin and KotlinEnumConstantClassReference"
This reverts commit dfab8a6888a44d41253477eefb5db75368bb0803.
2018-04-11 16:28:05 +03:00
Nikolay Krasko
57789b8c3d 172: Revert "Uast: making AbstractKotlinUClass not inherit from AbstractJavaUClass"
This reverts commit d35f79963c810365451f09e98c148f9ce7fc3263.
2018-04-11 16:28:05 +03:00
Nikolay Krasko
f9af79c6d9 172: Revert "Uast: no more need to exclude UIdentifier from JvmDeclarationUElement check"
This reverts commit a92791a1f3cdec9ece602c5778eb04d5ffbd7505.
2018-04-11 16:28:05 +03:00
Nikolay Krasko
d402412208 172: Revert "Uast: uastParent made final in KotlinAbstractUElement"
This reverts commit 9b006787581cca8167714d07ad36aea195ff9c02.
2018-04-11 16:28:04 +03:00
Nikolay Krasko
affa1e232f 172: Revert "Uast: Constructors.kt testdata fixes"
This reverts commit a725f43588a6d2f2d1c79649f46849f8cbabbc8f.
2018-04-11 16:28:04 +03:00
Nikolay Krasko
b3a534431d 172: Revert "Uast: handling @receiver annotations"
This reverts commit 2f3b1485a30442db016e7f529d273483315067cf.
2018-04-11 16:28:04 +03:00
Nikolay Krasko
6881559ec3 172: Revert "Uast: KotlinAccessorCallExpression made implement JvmDeclarationUElement"
This reverts commit f75a5d8372ab3041d8a1a8073beaa96a79a50b03.
2018-04-11 16:28:04 +03:00
Nikolay Krasko
c6b888678f 172: [Spring] Revert "Fixes for 173 after 28.08.17 changes in IDEA (#1271)"
This reverts commit 3a37d18e5d65043fc99a28772303d948e0f89f6c.
2018-04-11 16:28:04 +03:00
Nikolay Krasko
060ed5db88 172: [Spring] Revert "Spring-Kotlin: Gutter repaired (KT-20550, KT-20566)"
This reverts commit 37752694df794cc07492d21a3924ee735e6d3b9d.
2018-04-11 16:28:03 +03:00
Nikolay Krasko
a4d5a93454 172: [Srping] Revert "Spring gutter icons SpringApiIcons -> SpringApiIcons.Gutter fix."
This reverts commit 2323e9dc75dbdf109564f1a0d28494e6b5e41075.
2018-04-11 16:28:03 +03:00
Nikolay Krasko
f6e829d7f7 172: [Spring?] Revert "SpringKotlinAutowiringInspection: getting rid of SpringJavaInjectionPointsAutowiringInspection"
This reverts commit d0446b0aed0707ef616484c9fda04915c08598b0.
2018-04-11 16:28:03 +03:00
Nikolay Krasko
1a8b58cd14 172: [Spring?] Revert "SpringTestFixtureExtension: option to forbid facet autoconfigure added"
This reverts commit 0c90753c5bd9ac3fa492a61589d2c8aad3b96cc1.
2018-04-11 16:28:03 +03:00
Nikolay Krasko
92a9ed62a2 172: [Spring] Revert "KotlinSpringComponentScanInspection made to support platform JamReferenceContributor"
This reverts commit f6a3b2eae4b0c49359bb477b320bc433988bec37.
2018-04-11 16:28:03 +03:00
Nikolay Krasko
1421895aa6 172: [Spring] Revert "Spring: removing needless EP-s because they ported to UAST in platform"
This reverts commit 9355f79c6b06fdcd365f23b40e93ea841b372b27.
2018-04-11 16:28:02 +03:00
Nikolay Krasko
368dd193ac 172: Revert "Fix compilation after moving to idea 173"
This reverts commit fe121cc6aeadf63ca2c2819c9c7df59cc81caf5d.
2018-04-11 16:28:02 +03:00
Nikolay Krasko
fbed7f9c08 172: Restore compilation against Idea 172
Revert "Fix proguard settings for 173"
4dadae2e9c8419bfda9d77f56797e68edbd8ecd7.

Revert "Fix compilation in 173"
0633aa925c8e862519ae699e5e3fe81a2bd227c2.

Revert "Fix compilation (MockParameterInfoUIContext.java)"
01a7fbfb60d786c56c54f4fd77d9f1233f599ede.

Revert "Fix compilation"
043a5dac796f6bf92bbe6c9573c1af07fadcfe4e.

Revert "Fix compatibility with BuildScriptDataBuilder API changes"
c7df054d0e90a86fbe67f23802e9be49b2117ded.
2018-04-11 16:28:02 +03:00
Nikolay Krasko
3b434eeb13 172: Restore KotlinCoreEnvironment for 172 branch
Revert "`KotlinCoreEnvironment`: set `ideaCompatibleBuildNumber = "173.1"`"
This reverts commit d3321cc77a6b55d8b8ff3c3a16473f2f3b378533.

Revert "`JvmFacade`-related tests repair"
This reverts commit faeacdd17d37a4d733b686f3a1d5e8fc6ea54d79.

Revert "Register new service and EPs added in 173"
This reverts commit 5d227c0e714c1b4316e7b8daca1f208ee423f448.
2018-04-11 16:28:02 +03:00
Nikolay Krasko
e090775974 172: Revert "KtLightAbstractAnnotation build fix for 173 (#1283)"
This reverts commit b401cc19e07ad632d61ca0d402dc6017f9559d18.
2018-04-11 16:28:02 +03:00
Nikolay Krasko
49cc4fe3b6 172: Revert 173 specific changes in language injection
Revert "`KotlinLanguageInjector` using Registry to enable annotation injections"
This reverts commit c16a1d598c2bacc849dd16fed974ccdbf8b80754.

Revert "`KotlinLanguageInjector#injectInAnnotationCall` optimization: using `PsiClassNamePatternCondition` to avoid calling `getResolvedCall`"
This reverts commit f9eaaeab61b1dd50de9341846e129b58eb47f247.

Revert "`KotlinLanguageInjector` can inject into files modified for autocompletion"
This reverts commit 7212b22b083023201700696d775355051321b120.

Revert "`KotlinLanguageInjector` understands patterns-injections into Java annotations"
This reverts commit 45847b515bdfd27cfa5d23ff8b9147054ffa6f60.
2018-04-11 16:28:01 +03:00
Nikolay Krasko
1dcaaf1fe4 172: Revert "Fix GradleNoduleBuilder use qualified names check"
This reverts commit aec020a404d367195d58c7bb5d30185bfb85f202.
2018-04-11 16:28:01 +03:00
Nikolay Krasko
b9f16920aa 172: Revert "idea-version set to since-build="173.1" until-build="181.*""
This reverts commit 48701780db05e3c0928521f5fb95a5b89d417d95.
2018-04-11 16:28:01 +03:00
Nikolay Krasko
2d2b296f79 172: Revert "Update file structure tests as FileStructurePopup api was changed in 173"
This reverts commit 5244d48fde8e373b046a8ccb602a280b946f8d41.
2018-04-11 16:28:01 +03:00
Nikolay Krasko
df4b345def 172: Revert "Workaround for CoreEnvironment initialization: explicitly setting versions for extensions"
This reverts commit 2e50bd19a83ab4a4f2b3a5d0cc09300ec1b7b1f7.
2018-04-11 16:28:01 +03:00
Nikolay Krasko
c255df0a74 172: Revert "Fix find usages tests in 173 (run via ProgressIndicator)"
This reverts commit 1363306d562ad7ef5af9fd1642e139aa23abdd32.
2018-04-11 16:28:00 +03:00
Nikolay Krasko
1821007fda 172: Revert "AbstractJavaToKotlinConverterForWebDemoTest: setup fix: JvmElementProvider and JavaModuleSystem added"
This reverts commit e1f340f59a9ec83c38ad2a0fe32ba47dbf4cdfb1.
2018-04-11 16:28:00 +03:00
Nikolay Krasko
d6cc3d64fe 172: Revert "EdtTestUtil.runInEdtAndWait fix for proper user action emulation"
This reverts commit 4ebe750d36e86545a72177f91dc3baaa235fa92d.
2018-04-11 16:28:00 +03:00
Nikolay Krasko
1010c1285a 172: Revert "RecursiveMethodCallMarkerInfo and SuspendCallMarkerInfo forced to target Leaf-elements"
This reverts commit c78ec71e17c09ddb1094e44c84d9a1b92a3b509f.
2018-04-11 16:28:00 +03:00
Nikolay Krasko
984d9feeae 172: Revert "AbstractQuickFixTest: FORCE_PACKAGE_FOLDER directive added"
This reverts commit 91e10ae8bb6d2748a7a8b02fa661daa4cb00d0f8.
2018-04-11 16:28:00 +03:00
Nikolay Krasko
67303f925e 172: Revert "Ultimate-plugin: multiplePropertiesAnnotationConfig.kt test data fixes"
This reverts commit 4f2ee7359f8dfd3322329799475ff99dd88ed756.
2018-04-11 16:27:59 +03:00
Nikolay Krasko
47df9bc428 172: Revert "Drop new Kotlin Dsl gradle project wizard which has been merged to idea"
This reverts commit 742d337ad722fe6ddcd6ad5dab27d52eda970489.
2018-04-11 16:27:59 +03:00
Nikolay Krasko
b56a0550a4 172: Revert "Fix formatting for new kotlin dsl gradle project build script"
This reverts commit 75a46e66d18f69ff196749ba436b572b4462ea0d.
2018-04-11 16:27:59 +03:00
Nikolay Krasko
d9008bec80 172: Revert "Move: Fix applicability check in IDEA 173"
This reverts commit 74c28b2a564a859a20b3f799df24405ba634c175.
2018-04-11 16:27:59 +03:00
Nikolay Krasko
bac132d94d 172: Revert "Line Markers: Respect subclass module when filtering out duplicates"
This reverts commit 8df0a58586abf42572aff15d4bdd70e51e5cad29.
2018-04-11 16:27:58 +03:00
Nikolay Krasko
ee77f865cd 172: Revert "Drop missing gradle extensions from gradle.xml"
This reverts commit 1f7a145942f0489e18b281878ac711e7505dce15.
2018-04-11 16:27:58 +03:00
Nikolay Krasko
00c9ed8861 172: Revert "Update file name replace in QuickFix tests"
This reverts commit 01051618aa21c3502463c699f1d178136ef7c6b6.
2018-04-11 16:27:58 +03:00
Nikolay Krasko
a7d705b5d8 172: Revert "Fix inAnnotation test in 173 branch"
This reverts commit 955842f2009a2c5aa9ac955340696bd7e1a2651d.
2018-04-11 16:27:58 +03:00
Nikolay Krasko
25b10238e9 172: Revert "Safe Delete: Suppress walking through light field initializer"
This reverts commit 34d3173ba79535591adb3e55a7af7cb9d1e49e40.
2018-04-11 16:27:58 +03:00
Nikolay Krasko
afc37b9fed 172: Revert "Data Inflow: Support grouping by leaf expressions"
This reverts commit d5af2db2f259c7d55d38be73b9a5136e3aefd580.
2018-04-11 16:27:58 +03:00
Nikolay Krasko
236191bb89 172: Revert "Data Inflow: Support grouping by expression nullability"
This reverts commit e608f1ca159d55df39c8f33704220f360d54ba92.
2018-04-11 16:27:57 +03:00
Nikolay Krasko
81a2e2a340 172: Revert "Fixing non-running tests, that used MockApplication environment"
This reverts commit 49fb7aab2a67f09c2832d759448ad07c1bb3023a.
2018-04-11 16:27:57 +03:00
Nikolay Krasko
56ab1f8add 172: [172] Revert "Set correct until-build for Idea 173 plugin"
This reverts commit 0f378217684879491c3184b7db84e3ce3750a8b5.
2018-04-11 16:27:57 +03:00
Nikolay Krasko
99acec0970 172: [Tests] Revert "Allow different diagnostics in Javac tests - workaround for IDEA-184289"
This reverts commit 5212153463dcefbde28b4ca1814f6888fa9c57c1.
2018-04-11 16:27:56 +03:00
Nikolay Krasko
4c8f366e46 172: [Tests] Revert "Modify incremental test in 173 branch - files are not create anymore"
This reverts commit 0cc5d163d7d620565a28681dab31f3d3061a1324.
2018-04-11 16:27:56 +03:00
Nikolay Krasko
fa3edbf01e 172: == 173 -> 172 ^^^ == 2018-04-11 16:27:56 +03:00
Nikolay Krasko
520b3e2f95 Add branches tree description 2018-04-11 16:27:56 +03:00
Dmitry Savvinov
d438988fc6 Fix javadoc for StorageManager.createLazyValueWithPostCompute 2018-04-11 16:03:19 +03:00
Mikhail Glukhikh
e4275cc027 Refactor sealed subclass to object: add tests, fix type parameter case 2018-04-11 14:51:00 +03:00
Gabryel Monteiro
df7968678a Add inspection: Refactor sealed sub-class to object #KT-20305 Fixed 2018-04-11 14:51:00 +03:00
Dmitry Petrov
7cf6c70fbf Use NoScopeRecordCliBindingTrace as default trace in GenerationUtils
NB we use 'Intrinsics.areEqual(Double, Double)' and
'Intrinsics.areEqual(Float, Float)', because right now we take
nullability from the inferred type of the expression (which is 'Any?' in
the test cases).
We should probably reconsider this in case of more exact information
available from the data flow analysis, e.g., in case of

  fun test(x: Any?) =
    x is Serializable && x is Double? && x == 0.0

We statically know that 'x' is not null in 'x == 0.0' (although it's
neither nullability of it's numeric type 'Double?' nor the nullability
of the inferred type 'Any?').

There might be some edge effects in the performance related to byte code
size and preventive unboxing and so on.
2018-04-11 10:49:02 +03:00
Dmitry Petrov
665d6c82ad Fix Android tests for IEEE 754 2018-04-11 10:49:02 +03:00
Ilmir Usmanov
2cfe387bab Move coroutines to kotlin.coroutines package: compiler
Generate continuation type as kotlin.coroutines.Continuaion. This code will
fail at runtime since there is no stdlib backing this change yet.
However, in order to generate compatible stdlib we need a compiler, which
generates continuation type as kotlin.coroutines.Continuation.
Thus, firstly we support the change in the compiler, make it bootstrap
compiler and only then change stdlib and tests accordingly.
 #KT-23362
2018-04-10 22:51:46 +03:00
Anton Bannykh
f8c0c54a66 Revert "Clean up test skips after KT-17137"
This reverts commit 715d5e9
2018-04-10 20:45:07 +03:00
Anton Bannykh
703611a15c Revert "JS: remove -XtypedArraysEnabled flag (always true now)"
This reverts commit 4a5e9bb
2018-04-10 20:45:07 +03:00
Mikhael Bogdanov
56d1184515 Restrict conditions for @JvmDefault super calls
Condition was too strict
  if @JvmDefault implicitly hidden by class in inheritance.
  Diagnostic is redundant cause there isn't breaking
  change depending on interface method generation strategy and
  delegating stub generation in inheriting class.
2018-04-10 16:33:26 +02:00
Mikhael Bogdanov
e23c406285 Minor. Avoid recursion 2018-04-10 16:33:25 +02:00
Mikhael Bogdanov
6d1af263ba Restrict conditions for @JvmDefault super calls
Condition was too strict if we actually make super call
  through super class. Diagnostic is redundant cause there isn't breaking
  change depending on interface method generation strategy.
2018-04-10 16:33:25 +02:00
Mikhael Bogdanov
5f235a8342 Update documentation for @JvmDefault 2018-04-10 16:33:24 +02:00
Dmitry Savvinov
2d8e4e752c Fallback to Any type in case supertypes are empty
This can happen e.g. if all supertypes were on the cycle (A : B, B : A)
-- then SupertypesLoopChecker will cut all supertypes that are on cycle,
leaving set of supertypes empty.

Some clients in the compiler are not ready to work with empty list of
supertypes -- notably, CommonSupertypes.

^KT-23029 Fixed
2018-04-10 17:25:43 +03:00
Ilmir Usmanov
eb3b9032d6 Add synthetic flag to generated private suspend functions
Private suspend functions need to be generated as package-local, since
they are called from their continuations.
However, this means that they can be called from Java, which breaks
their private visibility.
Adding synthetic to them fixes the issue.
 #KT-17584: Fixed
2018-04-10 17:25:12 +03:00
Natalia Selezneva
a487543827 Fix Repl System.in wrapper. Do not exit after readline in user code
^KT-23622 Fixed
2018-04-10 16:14:23 +03:00
Roman Artemev
3bc323807f Fix function lookup in modules with similar names [KT-23582] 2018-04-10 15:58:30 +03:00
Roman Artemev
96b6cec33f Add warning in case similar module names 2018-04-10 15:58:30 +03:00
Roman Artemev
4cdd121c21 Add test for issue KT-23582 2018-04-10 15:58:30 +03:00
Roman Artemev
2bea8816a6 Add Secondary constructor lowering 2018-04-10 15:45:55 +03:00
Roman Artemev
3ce324fa9d Add tests for secondary constructors 2018-04-10 15:45:55 +03:00
Denis Zharkov
42d9c5b932 Remove dependency on :kotlin-test:kotlin-test-jvm from tests-common
#KT-20897 Fixed
2018-04-10 15:38:16 +03:00
Natalia Selezneva
a58bc7f301 Fix transitive module dependencies for scripts 2018-04-10 14:07:04 +03:00
Natalia Selezneva
2d5f5d65b2 Scratch tests: add Full JDK to ProjectJdkTable to be discoverable during resolve of ScriptModuleInfo 2018-04-10 14:06:59 +03:00
Natalia Selezneva
9b14e690db Drop only caches for script dependencies when module for scratch file changed 2018-04-10 14:06:54 +03:00
Natalia Selezneva
2a15e802a6 Minor: reformat 2018-04-10 14:06:50 +03:00
Natalia Selezneva
429e0afe2a Fix the way how script SDK is found in IDE 2018-04-10 14:06:45 +03:00
Natalia Selezneva
8d9f539c79 Return correct ProjectFacade for script and its dependencies
^KT-22588 Fixed
2018-04-10 14:06:34 +03:00
Natalia Selezneva
d75d0d8711 Refactor ScriptDependenciesModuleInfo
Do not mix ScriptDependenciesInfo for all project and for concrete script.
Rename ScriptDependenciesModuleInfo to ScriptDependenciesInfo
Rename ScriptDependenciesModuleSourceInfo to ScriptDependenciesSourceInfo
2018-04-10 14:06:29 +03:00
Natalia Selezneva
f8ad244899 Rewrite AbstractScriptConfigurationTest to test file from project sources
Changes in testData are needed to avoid running injection for string literals
2018-04-10 14:06:23 +03:00
Natalia Selezneva
37a95765cb Add scriptDependencies moduleInfo for scripts located in module source 2018-04-10 14:06:16 +03:00
Natalia Selezneva
c1dd86d323 Use module name from userData to get module info for scratch file 2018-04-10 14:06:09 +03:00
Natalia Selezneva
31266e49d0 Reset scriptDependencies file attribute when dependencies update fails with fatal error 2018-04-10 14:06:03 +03:00
Dmitry Savvinov
8d2f806c6b Minor: extract rendering of type variable into a method 2018-04-10 10:47:22 +03:00
Dmitry Savvinov
e450da8b63 Introduce EXTRA_VERBOSE mode for rendring ConstraintSystem
Use it for 'missing upperBoundViolatedError' debug message
2018-04-10 10:47:22 +03:00
Dmitry Savvinov
00c55c4f55 Minor: extract rendering of type bound into method 2018-04-10 10:47:22 +03:00
Dmitry Savvinov
30948269dd Minor: use enum for determining verbosity of ConstraintSystem render 2018-04-10 10:47:22 +03:00
Dmitry Savvinov
d8b7de4f0e Add extra diagnostic information when no common supertypes are found
We're suspecting that the culprit of such errors is race condition on
'supertypes' in AbstractTypeConstructor, when it is created using
'LockBasedStorageManager.NO_LOCKS'
2018-04-10 10:47:22 +03:00
Dmitry Savvinov
9455f50e58 Minor: reformat AbstractTypeConstructor.kt 2018-04-10 10:47:22 +03:00
Vyacheslav Gerasimov
7c02d55b23 Remove explicit jar specification from ide modules build scripts
They often change between ide versions and difficult to maintain
2018-04-09 21:47:48 +03:00
Yan Zhulanow
95684b9ecb Minor: Fix codegen tests for smap 2018-04-09 19:45:49 +03:00
Yan Zhulanow
715421566b Pill: Add new script modules 2018-04-09 19:45:49 +03:00
Yan Zhulanow
798a4c6c8d Pill: Fix Kotlin plugin artifact generation (ideaPlugin is no more a Copy task) 2018-04-09 19:45:49 +03:00
Mikhael Bogdanov
f1b8a8f913 Fix test data 2018-04-09 18:13:37 +02:00
Mikhael Bogdanov
ea407aba32 Support custom options in quick fix test framework 2018-04-09 18:13:36 +02:00
Mikhael Bogdanov
c5d4f22e4f Add quick fix for adding @JvmDefault annotation 2018-04-09 18:13:36 +02:00
Mikhael Bogdanov
31e459d9c0 Fix misspelling in test data 2018-04-09 18:13:35 +02:00
Mikhael Bogdanov
d788b3b6f9 Add warning on overriding java default by non @JvmDefault method 2018-04-09 18:13:35 +02:00
Mikhael Bogdanov
cb9c1ae104 Support default method super calls within @JvmDefault ones 2018-04-09 18:13:34 +02:00
Mikhael Bogdanov
942dd8a67c Properly calculate this for super call 2018-04-09 18:13:34 +02:00
Mikaël Peltier
0a11385006 KT-12330 Improve bytecode for data class equals/hashCode methods
- Do not longer call hashCode on java/lang/Object but do this
on statically checked type.
- Do not longer call Intrinsics.areEqual but use directly
equals method on statically checked type.

Fix of https://youtrack.jetbrains.com/issue/KT-12330
2018-04-09 14:16:02 +02:00
Dmitry Petrov
e6baf0296d More annotation generation for declarations with test cases 2018-04-09 11:24:37 +03:00
Dmitry Petrov
fdd8b7ae6c Annotations in IR are represented as call expressions (nothing else) 2018-04-09 11:24:37 +03:00
Dmitry Petrov
57077a5eb8 Generate annotations for declarations in psi2ir 2018-04-09 11:24:37 +03:00
Dmitry Petrov
c2dced775d IrDeclaration has annotations
Note that acceptChildren doesn't traverse them (yet?).
2018-04-09 11:24:37 +03:00
Dmitry Petrov
4016254fd4 Generate constructors with empty bodies for annotation classes
Default parameter values of primary constructor of an annotation class
are required to generate default values of annotation properties.
2018-04-09 11:24:37 +03:00
Dmitry Petrov
e74c448c0a Minor: reformat code 2018-04-09 11:24:37 +03:00
Nikolay Krasko
cc14df9e6f Always remove configure notifications without additional checks in tests (KT-23399)
For some reason there were ~1000 tests that were spontaneously
falling (~20%) because they couldn't find some class. It was mostly
Java classes.

Those failures started after cff88a3f8b.

There were group of commits about notifications right before it:
b4fb0e0305b77a0caa83d34edac3253b7d8e082b..1be33b91fa85e50f5048dc5a12604debfa3c19e8

 #KT-23399 Fixed
2018-04-07 03:04:35 +03:00
Vyacheslav Gerasimov
a8031cfe86 Build: Add zipCidrPlugin task which builds plugin for CLion & AppCode 2018-04-06 21:48:43 +03:00
Vyacheslav Gerasimov
d33b3cd4ee Build: Add :prepare:cidr-plugin project 2018-04-06 21:47:55 +03:00
Ilmir Usmanov
bd0ad26dcf Support local suspend functions
Treat them like lambdas. This means:
1) Like local suspend lambdas, which become "non-suspend" after creating
jvmSuspendView, they do this as well
2) They both are generated with the same codegen.
3) They are treated differently only on front-end side.
 #KT-20364: Fixed
2018-04-06 19:11:19 +03:00
Alexander Podkhalyuzin
5a752da9e9 Updated tests #KT-23546 Comment 2018-04-06 16:25:09 +03:00
Alexander Podkhalyuzin
9667214b64 Fixed formatting 2018-04-06 16:25:08 +03:00
Alexander Podkhalyuzin
e4dfa5897f Do not show duplicated names in variables completion list
#KT-23546 Fixed
2018-04-06 16:25:08 +03:00
Alexander Podkhalyuzin
fe680da3f9 Better formatting of BasicCompletionSession 2018-04-06 16:25:08 +03:00
Alexander Podkhalyuzin
0231a3a9e6 Do not show autopopup variable name completion if it was closed
#KT-23546 Comment
2018-04-06 16:25:07 +03:00
Alexander Udalov
89af94be95 Report warning (1.2) or error (1.3) on local annotations
#KT-23277 Fixed
 #KT-23589 Fixed
2018-04-06 14:17:32 +02:00
Mikhail Glukhikh
c141fac94a Add options to detect private / internal API with implicit type 2018-04-06 12:54:29 +03:00
Ilya Chernikov
78e45f00f5 Fix test data after merging new scripting 2018-04-06 08:53:32 +02:00
Ilya Chernikov
cc2b244484 Add a compiler option to disable default scripting plugin 2018-04-06 08:53:31 +02:00
Ilya Chernikov
ccecc90130 Fix some kapt tests:
some implicit usage of Project.getBasePath, which kapt depends on,
was removed from the scripting, and therefore proguard was removing
it from the compiler. This commit instructs proguard to keep it
explicitly.
2018-04-06 08:53:31 +02:00
Alexander Udalov
dd3cf531cf Disable packing module-info to libraries until Android issue is fixed
https://issuetracker.google.com/issues/77587908

 #KT-21266 Open
2018-04-05 19:18:05 +02:00
Alexey Sedunov
6c7959dd54 Configuration: Put 'buildscript' block before 'plugins' in build.gradle
#KT-23588 Fixed
2018-04-05 18:18:01 +03:00
Alexander Udalov
d2ed73eb78 Enable all Java 9 tests 2018-04-05 12:38:48 +02:00
Alexander Udalov
914cf18051 Fix line separators in scripting-related build.gradle.kts files 2018-04-04 22:26:17 +02:00
Ilya Chernikov
cc59716b39 Remove usages of the compiler from dist in script sample modules
prevent constant reindexing of the compiler jar
2018-04-04 21:44:20 +02:00
Pavel V. Talanov
de71598794 Fix line markers for actual enum entries
#KT-22632 Fixed
2018-04-04 17:56:35 +02:00
Pavel V. Talanov
e66768cbb3 Rewrite mpp line marker tests to be generated 2018-04-04 17:56:35 +02:00
Pavel V. Talanov
c3d2334eed Fix expect declarations available in completion in platform modules 2018-04-04 17:56:35 +02:00
Pavel V. Talanov
549bebbd19 Add test infrastructure for completion in mpp
Allow to specify specific expected module in test data for completion items
2018-04-04 17:56:35 +02:00
Pavel V. Talanov
08b62d3564 Rewrite 'goto' mpp tests to be generated
Adjust test data
Use new util in FindUsagesMultiModuleTest
2018-04-04 17:56:34 +02:00
Pavel V. Talanov
1f4926e259 Rewrite QuickFixMultiModuleTest to be generated
Adjust test data
Drop 'overload' test data since it was never run before
2018-04-04 17:56:34 +02:00
Pavel V. Talanov
67a436bf7e MPP tests: provide utils to setup test mpp from project structure
Allows to avoid configuration in test code
2018-04-04 17:56:34 +02:00
Pavel V. Talanov
01bff0e156 AbstractQuickFixMultiModuleTest: refactor and simplify code
Remove dependency on test module names
2018-04-04 17:56:33 +02:00
Pavel V. Talanov
36d23e4501 Refactor: merge synonymous utils 2018-04-04 17:56:33 +02:00
Pavel V. Talanov
784936eb00 Show 'actual/expect' icons for declarations in addition to visibility 2018-04-04 17:56:33 +02:00
Pavel V. Talanov
c86a6cf21d Minor: rename expect/actual icon constants
Reflect icons' content
2018-04-04 17:56:32 +02:00
Pavel V. Talanov
9c9cdee7f0 Refactor: move utils related to expect/actual declarations and MPPs
Move them to 'idea-analysis' module
2018-04-04 17:56:32 +02:00
Pavel V. Talanov
3aee544f02 Throw more descriptive exception when service isn't found 2018-04-04 17:56:32 +02:00
Ilya Chernikov
da56f54982 Use script compiler options on script dependencies in the IDE as well
further fixes #KT-19120
2018-04-04 16:58:14 +02:00
Ilya Chernikov
5bf8460032 Do not throw if the script definition name is not defined 2018-04-04 16:23:59 +02:00
Ilya Chernikov
bdd001d04c [minor] drop explicit stdlib detection logic in script compiler
...as it is mainly redundant and in the current for somewhat incorrect
2018-04-04 16:23:58 +02:00
Ilya Chernikov
73d2580435 Add FATAL diagnostic severity to match changes in the current script infrastructure 2018-04-04 16:23:58 +02:00
Ilya Chernikov
599a9acce8 Rearrange scripting examples to conform the build system requirements 2018-04-04 16:23:58 +02:00
Ilya Chernikov
7fbcfdf09e Add config params for specifying target annotations, import param renaming 2018-04-04 16:23:58 +02:00
Ilya Chernikov
191b1cfefa Refactor configurations handling:
- rearrange compile call parameters for clarity, more defaults
- remove baseConfiguration method - it is now covered by defaultConfiguration
for static part, and refineConfiguration call if a config parameter is
specified
- implement proper configurations chaining, documented in comment to compile function
- minor renamings and refactorings
2018-04-04 16:23:58 +02:00
Ilya Chernikov
4a4edf3458 [minor] Renames and rearrangements for clarity 2018-04-04 16:23:58 +02:00
Ilya Chernikov
5058c66e8c Refactor scripting properties:
- flatten the structure
- add some parameters
- replace iterables with lists
- renaming all scope objects uniformily
also:
- fix passing and usage of script sources
- renamings and other minor improvements
2018-04-04 16:23:58 +02:00
Ilya Chernikov
2ddcc280a9 Implement simplified property bag dsl:
move it to the separate jar,
use property bag chaining
2018-04-04 16:23:57 +02:00
Ilya Chernikov
495c75c48e Rename heterogeneous map to PropertyBag, make it chainable
the commit is needed to implement single chained script configuration bags
2018-04-04 16:23:57 +02:00
Ilya Chernikov
15fcee474c Fix script classpasth from environment extraction...
for classes dirs
2018-04-04 16:23:57 +02:00
Ilya Chernikov
6ea41b425d Pass script source directly instead of via configuration 2018-04-04 16:23:57 +02:00
Ilya Chernikov
29797ec264 Switch to plugins section in scripting build files after rebasing 2018-04-04 16:23:57 +02:00
Ilya Chernikov
ae2af238fa Fixes after refactoring the API 2018-04-04 16:23:57 +02:00
Ilya Chernikov
1f0cac50d2 Refactor scriptDefinition in the common part
- get rid of selector (because of confusions), move it's data into
definition itself and make it more generic with heterogeneous map
- make main KotlinScript annotation accept complete definition
- make additional annotation for building definition from parts
- add ScriptingEnvironment and pass it as a constructor parameter to
the script handlers
- rename some classes for clarity
2018-04-04 16:23:57 +02:00
Ilya Chernikov
2c3a50e4b3 Refactor scripting examples:
- split into script def and host part
- remove bad dependencies
- organize it in a way that should be typical for user scenarios
2018-04-04 16:23:56 +02:00
Ilya Chernikov
7cca1a72d3 Fix after review: add stdlib to the script compilation classpath by default 2018-04-04 16:23:56 +02:00
Ilya Chernikov
d50798c4cf Refactor script-util context tools to simplify its usage in the new scripting 2018-04-04 16:23:56 +02:00
Ilya Chernikov
4742d0a034 Rename scripting plugins to more established scheme 2018-04-04 16:23:56 +02:00
Ilya Chernikov
00320bad8d Implement support for additional receivers in the backend 2018-04-04 16:23:56 +02:00
Ilya Chernikov
611aff6b61 J2K: ScriptContext - convert 2018-04-04 16:23:56 +02:00
Ilya Chernikov
cf4cca3683 J2K: ScriptContext - rename 2018-04-04 16:23:56 +02:00
Ilya Chernikov
87de1dff03 Implement support for additional receivers for script in frontend 2018-04-04 16:23:56 +02:00
Ilya Chernikov
e79d3dd035 Fix scripting in the frontend after refactorings 2018-04-04 16:23:55 +02:00
Ilya Chernikov
1cb9592fcc Change samples after adding configuration dsl 2018-04-04 16:23:55 +02:00
Ilya Chernikov
0f0934aaa2 Change jvm implementation after adding configuration dsl 2018-04-04 16:23:55 +02:00
Ilya Chernikov
1723ff658d Refactoring heterogeneous map handling, add dsl builders 2018-04-04 16:23:55 +02:00
Ilya Chernikov
63d601e1be Implement scripting configuration gradle plugin 2018-04-04 16:23:55 +02:00
Ilya Chernikov
d05f67127d Move scripting configuration into compiler plugin 2018-04-04 16:23:55 +02:00
Ilya Chernikov
1514a113b8 minor: Add maven deps example template to the discovery resource folder 2018-04-04 16:23:55 +02:00
Ilya Chernikov
0c06ec9088 Implement script templates discovery in the idea plugin 2018-04-04 16:23:54 +02:00
Ilya Chernikov
d07a3f2bdd Implement script templates discovery in the cli compiler 2018-04-04 16:23:54 +02:00
Ilya Chernikov
f496fbb625 Add new scripting libs to proguard library jars
so proguard do not complain for missing classes
2018-04-04 16:23:54 +02:00
Ilya Chernikov
548bf26c58 Add new scripting support to the gradle plugin 2018-04-04 16:23:54 +02:00
Ilya Chernikov
c764365da5 Add new scripting support to the compiler 2018-04-04 16:23:54 +02:00
Ilya Chernikov
3f22e28a51 Implement basic support of the new scripting in the frontend and plugin 2018-04-04 16:23:54 +02:00
Ilya Chernikov
3732422e6a Add example scripting hosts with tests:
the simple scripting host and the one with maven resolving
2018-04-04 16:23:54 +02:00
Ilya Chernikov
c48a74b84a Implement base jvm scripting infrastructure 2018-04-04 16:23:54 +02:00
Ilya Chernikov
aac7f97121 Add new experimental scripting API 2018-04-04 16:23:53 +02:00
Mikhael Bogdanov
4aec9499b5 Add @RequireKotlin(1.2.40) on interface with @JvmDefaults and its subinterfaces 2018-04-04 16:17:38 +02:00
Mikhael Bogdanov
be33a9bf3b Update test data 2018-04-04 14:55:39 +02:00
Mikhael Bogdanov
a27d1b7a3b Update @JvmDefault documentation 2018-04-04 14:55:39 +02:00
Natalia Selezneva
a6019cc5fb Rearrange script definition contributors to avoid old EP appear before new EP
Fix highlighting of build.gradle.kts files with LivePlugin enabled
^KT-23571 Fixed
2018-04-04 12:44:04 +03:00
Dmitry Jemerov
e05b54a2b4 Fix unsupported syntax in code style settings example 2018-04-04 11:35:04 +02:00
Alexander Udalov
0439abba46 Check that kotlin.stdlib is explicitly required in module-info
Writing a Jigsaw-modular Kotlin program which doesn't require
kotlin.stdlib doesn't make sense because it most likely will fail at
runtime, on access to anything from the standard library. Previously, we
checked that kotlin.stdlib was in the module graph, but that's not
enough, we should also check that the source module requires it.
'-Xallow-kotlin-package' can be used to disable the error.

Add a test checking that an indirect (transitive) dependency is also OK
2018-04-03 21:50:25 +02:00
Ilya Gorbunov
7501d2ad69 Make JDK 9 required to build the project 2018-04-03 21:24:35 +02:00
Ilya Gorbunov
299d6fa772 Use default compileJava9Java task to build java9 source set 2018-04-03 21:24:34 +02:00
Ilya Gorbunov
bd4abaa8bf Improve JDK discovery for JDK9+ on Windows 2018-04-03 21:24:07 +02:00
Alexander Udalov
828cc6dbf3 Add module-info.java for kotlin-reflect
The standard way of loading resources with built-ins metadata from the
current class loader no longer works in the modular mode on Java 9
because the current class loader is for module 'kotlin.reflect', but the
metadata is located in the module 'kotlin.stdlib'. On Java 9, we now use
the class loader of 'kotlin.stdlib' to load these resources.

 #KT-21266 Fixed
2018-04-03 21:24:03 +02:00
Alexander Udalov
2d41c7d462 Add module-info.java for standard Kotlin libraries
Using the new multi-release jar feature, store compiled
module-info.class files into META-INF/versions/9 instead of the artifact
root. Hopefully, this will break fewer tools which do not support
module-info.class files because any sane tool should not do anything
with files in META-INF because before Java 9 that directory only
contained resources.

Upgrade some Maven plugins to newer versions which do not fail on
module-info.class files

 #KT-21266 In Progress
2018-04-03 21:22:14 +02:00
Alexey Tsvetkov
650e97f200 Temporarily turn off source map generation in JS IC tests
Until IncrementalJsCompilerRunnerTestGenerated$ClassHierarchyAffected.testEnumEntryRemoved 
is fixed
2018-04-03 21:11:12 +03:00
Alexey Tsvetkov
6f59b6da8e Use daemon if available for parsing files in JPS 2018-04-03 21:11:12 +03:00
Alexey Tsvetkov
3eb968807e Invalidate usages of removed classes before round
#KT-23165 fixed
2018-04-03 21:11:12 +03:00
Alexey Tsvetkov
8cd0f13f2b Convert KotlinSourceFileCollector: simplify after conversion 2018-04-03 21:11:11 +03:00
Alexey Tsvetkov
3f36f472b3 Convert KotlinSourceFileCollector: actual conversion 2018-04-03 21:11:11 +03:00
Alexey Tsvetkov
336d63c0a3 Convert KotlinSourceFileCollector: rename file 2018-04-03 21:11:11 +03:00
Alexey Tsvetkov
bd779cb26e Remove usages of deprecated API 2018-04-03 21:11:11 +03:00
Alexey Tsvetkov
58e4b704c6 Replace reflection with direct call 2018-04-03 21:11:11 +03:00
Alexey Tsvetkov
fa9c80e05c Convert CompilerRunnerUtil: actual conversion 2018-04-03 21:11:11 +03:00
Alexey Tsvetkov
f27b6c0d8d Convert CompilerRunnerUtil: rename file 2018-04-03 21:11:11 +03:00
Alexey Tsvetkov
455fe7fe61 Reformat jps-plugin module 2018-04-03 21:11:11 +03:00
Dmitry Jemerov
ecb9a39f94 Report errors when trying to build decompiled text for light class 2018-04-03 19:45:37 +02:00
Mikhael Bogdanov
08ff1de248 Update test data 2018-04-03 19:38:37 +02:00
Mikhael Bogdanov
2c56f0bfd3 Require 'jvmDefaultFlag' for default super calls 2018-04-03 19:18:19 +02:00
Mikhael Bogdanov
db59e916fb Inline utility method 2018-04-03 19:18:18 +02:00
Mikhael Bogdanov
3f5fea05de Write 'RequireKotlin' annotation on @JvmDefault members 2018-04-03 19:18:17 +02:00
Mikhael Bogdanov
23e8adb793 Add custom diagnostic checker for @JvmDefault annotation 2018-04-03 19:18:17 +02:00
Mikhael Bogdanov
89f22e69b4 Relocate @JvmDefault to stdlib module 2018-04-03 19:18:16 +02:00
Mikhael Bogdanov
38f8924ae3 Update test data. Use simple ''@JvmDefault' instead full qualifier 2018-04-03 19:18:15 +02:00
Mikhael Bogdanov
2a8041e77e Check method abstractness during bridge generation per method not interface 2018-04-03 19:18:14 +02:00
Mikhael Bogdanov
f290b325ee Remove @JvmDefault members from delegation 2018-04-03 19:18:14 +02:00
Mikhael Bogdanov
d84a15c0f6 Support inline for private @JvmDefault members 2018-04-03 19:18:13 +02:00
Mikhael Bogdanov
affe445955 Minor.Reformat 2018-04-03 19:18:12 +02:00
Mikhael Bogdanov
308283e52e Support synthetic accessors for @JvmDefault members 2018-04-03 19:18:12 +02:00
Mikhael Bogdanov
1acd5642ce Minor.Reformat 2018-04-03 19:18:11 +02:00
Mikhael Bogdanov
1d3e57acee Add @JvmDefault diagnostics 2018-04-03 19:18:10 +02:00
Mikhael Bogdanov
63afd37cdd Remove unused parameters, compiler keys and obsolete code 2018-04-03 19:18:10 +02:00
Mikhael Bogdanov
fe45eb2a81 Initial support of @JvmDefault 2018-04-03 19:18:09 +02:00
Mikhael Bogdanov
e885195ee1 Add @JvmDefault annotation 2018-04-03 19:18:08 +02:00
Mikhael Bogdanov
5830f99bce Remove unused test data 2018-04-03 19:18:08 +02:00
Mikhael Bogdanov
c143480727 Remove wrong directive
Similar test exists under 'defaults' foldes
2018-04-03 19:18:07 +02:00
Mikhael Bogdanov
b337b9ea8d Specify idea.home.path for java 8 tests
Default discovery mechanism points to wrong location
2018-04-03 19:18:06 +02:00
Ilmir Usmanov
eb81c205c7 Replace CHECKCAST kotlin/Unit with ARETURN for tail call optimization
Sometimes instead of {POP, GETSTATIC Unit.INSTANCE, ARETURN} sequence
the codegen emits {CHECKCAST Unit, ARETURN} sequence, which breaks tail
call optimization. By replacing CHECKCAST with ARETURN we eliminate
this issue.

 #KT-19790: Fixed
2018-04-03 20:04:18 +03:00
Ilmir Usmanov
7b2de2de5e Add regression test for KT-20744
#KT-20744: Obsolete
2018-04-03 20:02:02 +03:00
Toshiaki Kameyama
2d4ef8d1e6 Allow "add constructor invocation" for sealed top-level inheritors
So #KT-23320 Fixed
2018-04-03 19:49:32 +03:00
Mikhail Glukhikh
d54c57f9df Minor refactoring: get rid of js.getJetTypeFqName usage in intention 2018-04-03 19:49:32 +03:00
Toshiaki Kameyama
488e5e9f60 Do not suggest "redundant toInt() call" for comparison receiver
So #KT-23133 Fixed
2018-04-03 19:49:31 +03:00
Toshiaki Kameyama
f91819ace7 "Simplify boolean expression": handle Boolean? comparison correctly
So #KT-23377 Fixed
2018-04-03 19:49:31 +03:00
Dmitry Jemerov
a495c2e5ea Don't run analysis in SpecifyTypeExplicitlyIntention.isAvailable()
If type is invalid, show error hint when action is invoked
2018-04-03 18:37:33 +02:00
Mikhail Glukhikh
6d9457853e Fix handling of characters in "convert to string template"
So #KT-23045 Fixed
So #KT-23046 Fixed
2018-04-03 18:26:25 +03:00
Alexander Udalov
d0e99e9a3f Fix NPE from JarURLConnection.getUseCaches when loading compiler plugins
#KT-22513 Fixed
2018-04-03 16:55:48 +02:00
Mikhail Glukhikh
2125c42328 Make DeprecatedCallableAddReplaceWithInspection applicability based
Removes intention version of the same thing
Includes some optimization of 'Deprecated' annotation detection
2018-04-03 17:46:27 +03:00
Mikhail Glukhikh
ab973b2ff0 Fix several false positives and make safer "redundant companion ref"
Don't report it on an import directive #KT-23520 Fixed
Don't report it if companion nested class is referenced #KT-23519 Fixed
Check companion reference both by descriptor and by name
2018-04-03 17:45:14 +03:00
Mikhail Glukhikh
23488fac56 Optimization: RedundantCompanionReferenceInspection 2018-04-03 17:30:46 +03:00
Alexander Udalov
964bf503a6 Fix warning about kotlin-reflect-api bundling Kotlin Runtime
This fixes the "Some JAR files in the classpath have the Kotlin Runtime
library bundled into them" warning when compiling all modules that
depend on kotlin-reflect-api. This warning is reported on jars in the
classpath which look like standard library artifacts, but in fact are
not because their manifest does not say so. With this change, we're now
writing the manifest of standard library artifacts to the resulting jar
of kotlin-reflect-api, with the standard library component name
"internal" (in fact, it doesn't affect anything here, any name would be
OK) to make the compiler believe that this is actually a standard
library jar
2018-04-03 13:18:56 +02:00
Nicolay Mitropolsky
14ce13315c Uast: wrapping expression bodies with return and code block (#KT-23557) 2018-04-03 14:10:01 +03:00
Mikhail Glukhikh
66d134ef5c "Can be private" inspection: don't analyze data class parameters
So #KT-23566 Fixed
2018-04-03 13:44:37 +03:00
Yan Zhulanow
dc3cd01fad Kapt: Find the right annotation descriptor in case of repeatable annotations (#KT-23427) 2018-04-03 00:16:54 +03:00
Yan Zhulanow
4cab250f72 Pill: Add marker option for JUnit3RunnerWithInners test runner 2018-04-02 19:26:39 +03:00
Yan Zhulanow
46973bf1fe Kapt: Do not escape cyrillic letters in stubs (#KT-23286) 2018-04-02 19:26:37 +03:00
Yan Zhulanow
ae3d574473 Pill: Support Android tests 2018-04-02 19:26:35 +03:00
Yan Zhulanow
ead7653f84 Minor: Fix Parcelable test data 2018-04-02 19:26:34 +03:00
Yan Zhulanow
78f2fe1eab Pill: Add idea-android-output-parser module to JPS model 2018-04-02 19:26:32 +03:00
Yan Zhulanow
5d9bdbec10 Tests: Disable inspections after test as Platform test framework requires 2018-04-02 19:26:30 +03:00
Yan Zhulanow
8f02d338a6 Android: Extract dependencies to Android plugin to extensions 2018-04-02 19:26:28 +03:00
Yan Zhulanow
39e9d28c63 Kapt: Support 'kapt.kotlin.generated' option in Maven 2018-04-02 19:26:26 +03:00
Yan Zhulanow
b1d7935d4a Kapt: Annotation processors should not be discovered when the processor fqNames are set by user (#KT-22939) 2018-04-02 19:26:24 +03:00
Yan Zhulanow
dc8eb7446f Kapt, minor: make Gradle API a bit cleaner 2018-04-02 19:18:45 +03:00
Yan Zhulanow
b3fbec9ec3 Fix EA-117939: Add a read action 2018-04-02 19:17:56 +03:00
Yan Zhulanow
81f3346329 Evaluate: Fix annotation value evaluation (#KT-23058) 2018-04-02 19:16:46 +03:00
Yan Zhulanow
4d13e38948 Show warning alert when the installed Kotlin plugin version is incompatible with the IDE platform version 2018-04-02 19:16:16 +03:00
Yan Zhulanow
b664177bd5 EA-100549: Throw an exception with an additional data instead of Java assertion 2018-04-02 19:16:03 +03:00
Yan Zhulanow
ec0abb0854 Fix EA-79206: Process only valid layout .xml files in Android Extensions 2018-04-02 19:15:48 +03:00
Yan Zhulanow
c8a1517190 Fix EA-113820: Accept also nullable elements in 'getRelevantElement()' 2018-04-02 19:15:33 +03:00
Yan Zhulanow
2b0489529d Fix compatibility for compiler API in DeclarationAttributeAltererExtension (EA-114961) 2018-04-02 19:14:52 +03:00
Yan Zhulanow
ff4cdfb43e Remove "New Kotlin Activity" action as Android plugin can generate it by itself (#KT-22845, EA-114706) 2018-04-02 19:14:40 +03:00
Yan Zhulanow
966480a155 Debugger: A dirty fix for setting breakpoints inside finally {} in case if exception is thrown from try {} (#KT-22654) 2018-04-02 19:14:28 +03:00
Yan Zhulanow
eec9c6bffa Debugger: Fix breakpoints and stepping for inline-only function lambda arguments (#KT-23064) 2018-04-02 19:14:14 +03:00
Alexey Sedunov
ae37cc30a1 JS: Use the same output paths for JPS and Maven-based builds
#KT-22586 Fixed
2018-04-02 15:28:35 +03:00
Elifarley C
1b3d539a25 toBigDecimal: Avoid creating new BigDecimal instance for some values
Avoid creating new `BigDecimal` instance by calling `BigDecimal.valueOf(this)`, which doesn't create a new instance if the argument falls in the range [0..10].
(there's a `private static final BigDecimal[] zeroThroughTen` cache in BigDecimal.java with 11 BigDecimal instances)
2018-04-02 15:26:49 +03:00
Mikhail Zarechenskiy
e1d75d5581 Migration fixes for new inference 2018-03-30 20:39:55 +03:00
Mikhail Zarechenskiy
ae35a3b324 Enable new inference in the compiler 2018-03-30 20:39:55 +03:00
Mikhail Zarechenskiy
152a9a21f9 Make type parameter nullable as it should be
This change is needed, because in NI we perform a more strict check
2018-03-30 20:39:54 +03:00
Mikhail Zarechenskiy
3592b19fa4 Update bootstrap to 1.2.50-dev-310 2018-03-30 20:39:54 +03:00
Vyacheslav Gerasimov
10c14260b1 Build: Fix dependency on markdown in :prepare:idea-plugin
org.jetbrains:markdown brings kotlin-stdlib dependency transitively, which resolves to default configuration of :kotlin-stdlib project. But we need to pack jar from distJar configuration. Also sourceSets.builtins.output is copied to plugin because :kotlin-stdlib has compile dependency on it. Probably we should also refactor :kotlin-stdlib to avoid such confusions in future.
2018-03-30 20:10:20 +03:00
Vyacheslav Gerasimov
22496353b6 Fix KotlinReferenceImporter, add safe call to quickFixActionRanges
HighlightInfo.quickFixActionRanges is nullable in 181
2018-03-30 17:05:55 +03:00
Ilya Gorbunov
d2a235b752 Minor code improvements, add more test cases #KT-11208
Compare new readLine with the reference implementation in BufferedReader.
2018-03-30 16:04:22 +03:00
meztihn
12e427b4b5 KT-11208 Remove readLine's new charset parameter
It can't be introduced in a patch release.
2018-03-30 16:03:19 +03:00
meztihn
cca7a59bba KT-11208 Improve readLine's tests readability 2018-03-30 16:03:19 +03:00
meztihn
68cb66ff0e KT-11208 Remove readLine's lineSeparator parameter 2018-03-30 16:03:19 +03:00
meztihn
f6c1886394 KT-11208 Remove stream buffering 2018-03-30 16:03:19 +03:00
Ilya Gorbunov
f45e3ac7d9 kotlin-stldib-js: do not import experimental sourceset in IDEA
Temporary workaround to prevent multiple IDEA modules sharing the same content root error.
2018-03-30 16:03:19 +03:00
Sergey Mashkov
42de429565 IDL2K: add property to control deployment 2018-03-30 15:13:42 +03:00
Mikhail Zarechenskiy
0632bbbed0 Nullability of intersection type should be determined by supertypes
Intersection types cannot be nullable as is because of special rules for subtyping
2018-03-30 14:51:07 +03:00
Mikhail Zarechenskiy
aebcb61402 Resolve elements in chain of qualifier expression without expected type
Consider call chain `foo.bar.baz()` which has expected type `Int`
Elements `foo` and `bar` doesn't have expected type `Int`,
this is especially important in NI, because we use expected type for
candidate applicability
2018-03-30 14:51:07 +03:00
Natalia Selezneva
3d73786e98 Highlight scripts according to ScriptLocation annotation in ScriptDefinition 2018-03-30 14:43:17 +03:00
Natalia Selezneva
15914dac86 Add ScriptExpectedLocations annotation to script-runtime.
It describes where script file can be found.
2018-03-30 14:43:17 +03:00
Natalia Selezneva
27f1eb1e13 Do not reload dependencies for scripts that wasn't recently touched 2018-03-30 14:43:17 +03:00
Natalia Selezneva
f52441d64e Do not show "Gradle Project needs to be imported" notification for gradle script if only spaces are added 2018-03-30 14:43:17 +03:00
Alexey Sedunov
b0a99c7945 Move Out Of Object Intention: Fix assertion error
#KT-22983 Fixed
2018-03-30 12:37:30 +03:00
Alexey Sedunov
14b1bdf627 Rename: Fix renaming of backquoted property accessors
#KT-23298 Fixed
2018-03-30 12:37:30 +03:00
Alexey Sedunov
2104a0fa2b Extract Function: Drop extra space in modifier list
#KT-23274 Fixed
2018-03-30 12:37:30 +03:00
Alexey Sedunov
0a0043a851 Convert Function to Property: Forbid for properties with both initializer and getter
#KT-23293 Fixed
2018-03-30 12:37:29 +03:00
Alexey Sedunov
43b4a496e3 Rename: Increase precedence of RenameSyntheticDeclarationByReferenceHandler
Otherwise it's not applicable references to Java declarations

 #KT-20241 Fixed
2018-03-30 12:37:29 +03:00
Anton Bannykh
a514c0f515 JS IR: initial lowerings reuse 2018-03-29 20:32:10 +03:00
Nikolay Krasko
6adf7eaf04 Check stubs consistency in decompiler tests 2018-03-29 19:49:02 +03:00
Nikolay Krasko
dbab5bcc58 Delete bundled Kotlin plugin from different kind of AS jar/zip 2018-03-29 19:49:01 +03:00
Nikolay Krasko
70d236cb8d Always configure "idea.home.path" system variable
When TestLoggerFactory is initialized in tests it checks that variable
and it it's not present uses classpath to search for logger configuration.

If this search is unsuccessful a lot of exceptions are written to log:

java.lang.RuntimeException: Could not find installation home path. Please make sure bin/idea.properties is present in the installation directory.
     	at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:96)
     	at com.intellij.testFramework.TestLoggerFactory.reconfigure(TestLoggerFactory.java:67)
2018-03-29 19:49:00 +03:00
Alexander Udalov
5d9348eea1 Sanitize compiler version for version requirement checks
Strip everything after (and including) the first '-' character.

The previous approach of skipping the checks if "SNAPSHOT" is in the
version, is subsumed by the new one because "1.2-SNAPSHOT" now becomes
"1.2" with regards to the version requirement checks, which allows the
compiler to use the 1.2-only API
2018-03-29 17:12:18 +02:00
Alexander Podkhalyuzin
b78869ecfc Fixed aliased imports cache #KT-23430 Fixed 2018-03-29 16:05:00 +02:00
Nikolay Krasko
6a71f5bd2c Restore JUnit3RunnerWithInners version for JPS and delegate pill to it 2018-03-29 14:14:34 +03:00
Nikolay Krasko
9a831bf7dd Collect statistics for inlay parameter options 2018-03-29 14:14:34 +03:00
Nikolay Krasko
8d4fa8f3e8 Stop running tests from inner classes in JUnit3RunnerWithInners (KT-23234)
Running tests as part of parent class produced test names on
TeamCity that were different from test names obtained when inner classes
were executed first. And it looks like test order execution in Gradle
depends on file walker and file system.

 #KT-23234 Fixed
2018-03-29 14:14:34 +03:00
Nikolay Krasko
bf8c7075bc Don't spam to error log from kapt3 successful tests 2018-03-29 14:14:33 +03:00
Dmitry Jemerov
9516c638ea Use more efficient file type check (avoid identifying file type by file) 2018-03-29 13:11:37 +02:00
Dmitry Jemerov
85ebe97597 Avoid unnecessary collection copy (KT-23384) 2018-03-29 13:11:36 +02:00
Dmitry Jemerov
6f1881b9ff Import reference at offset uses existing import fix (KT-23235)
If we have a valid autoimport fix at given offset, don't recalculate
variants; use existing ones
2018-03-29 13:11:36 +02:00
Dmitry Jemerov
5b04d99eeb Return null script if stub tells us file is not a script 2018-03-29 13:11:36 +02:00
Roman Artemev
68e47a9d60 Implement basic IR -> JS class translation 2018-03-29 13:26:04 +03:00
Mikhail Zarechenskiy
e70162771d [NI] Fix exception from IDE completion
Fake arguments that are created for completion might have missing PSI parts (see `DummyArgument`)
2018-03-29 13:13:39 +03:00
Mikhail Glukhikh
05db4b3ccf Optimization: LeakingThisInspection 2018-03-29 11:39:10 +02:00
Mikhail Glukhikh
5e9ca6f466 Optimization: AddVarianceModifierInspection 2018-03-29 11:39:09 +02:00
Mikhail Glukhikh
34de241154 Add inspection to detect public API with implicit type 2018-03-29 11:39:01 +02:00
Dmitry Jemerov
6a619d0aa5 Ensure that multiplatform Gradle task runner runs first
In order to have effect, the runner needs to be registered before the
main Gradle runner, which also has order="first" in plugin.xml.
2018-03-29 09:50:34 +02:00
Dmitry Jemerov
8f19e95bd0 Set SDK from JVM module when running JUnit tests for common module 2018-03-29 09:50:34 +02:00
Dmitry Jemerov
6bee25cad2 Reformat 2018-03-29 09:50:34 +02:00
Dmitry Jemerov
20cd193030 Delete remains of external annotations support from compiler 2018-03-29 09:45:07 +02:00
Zalim Bashorov
9349b9bc67 [JS BE] Fix the crash on compound operations with a qualified call on left side
#KT-22001 Fixed
2018-03-28 22:49:09 +03:00
Alexander Udalov
c3b6abfb1f Minor, add javadoc to KotlinBuiltIns.isBuiltIn 2018-03-28 19:48:50 +02:00
Zalim Bashorov
4d742c5266 Add more tests to JS IR whitelist and regenerate tests 2018-03-28 20:33:23 +03:00
Zalim Bashorov
0aa0ffc6fd [JS IR BE] Add generating JS AST for more IR elements:
* string concat
* get local value
* set local variable

* block
* composite block
2018-03-28 20:33:22 +03:00
Zalim Bashorov
7ae28a806b [JS IR BE] Add generating JS AST for "while" and "do-while" 2018-03-28 20:33:22 +03:00
Zalim Bashorov
52e2fb7a4e [JS IR BE] Add generating JS AST for "when" 2018-03-28 20:33:22 +03:00
Zalim Bashorov
d46bba1521 [JS IR BE] Support must of kinds of constants except Long and Char 2018-03-28 20:33:22 +03:00
Mikhail Zarechenskiy
81ac3a4f2f Add ability to enable new inference in the platform 2018-03-28 18:32:28 +03:00
Ilmir Usmanov
4070f13e26 Do not generate beforeInlineMarker on tailrec jump
Before this change, the codegen used to generate beforeInlineMarker
in order to spill variables later. However, since the tailrec call
is replaced with jump, no afterInlineMarker is generated, leading to
inconsistency of these markers. Thus, the spilling fails.
This change disables generating of beforeInlineMarker.

 #KT-21521: Fixed
2018-03-28 15:50:24 +03:00
Ilmir Usmanov
58bac6882d Fix transforming of coroutine's create when it is suspend lambda with receiver
Unlike ordinary lambdas suspend lambdas has create method which invokes
the constructor of the lambda object (continuation).
The inliner could not cope with this.
The previous change fixed the case of suspend lambda without receiver.
This change adds support of suspend lambdas with receiver.

 #KT-21605: Fixed
2018-03-28 15:48:16 +03:00
Toshiaki Kameyama
e96b5f3117 Fix false positive in redundant companion reference #KT-23435 Fixed 2018-03-28 13:27:45 +02:00
Alexander Udalov
3bc7eefad9 Regenerate tests 2018-03-28 12:55:00 +02:00
Mikhail Glukhikh
7e711eaf30 Memory optimization: CanBeParameterInspection 2018-03-28 12:04:58 +02:00
Mikhail Glukhikh
491eeb3d6f Optimization: OverridingDeprecatedMemberInspection 2018-03-28 12:04:56 +02:00
Mikhail Glukhikh
b8da1d67d5 Optimize UsePropertyAccessSyntaxInspection 2018-03-28 12:04:55 +02:00
Mikhail Glukhikh
52cd71c3c4 Optimization: ReplaceGetOrSetInspection 2018-03-28 12:04:53 +02:00
Mikhail Glukhikh
9170aa0674 Distinguish PARTIAL_WITH_CFA resolve mode from just PARTIAL
So #KT-23182 Fixed
2018-03-28 12:04:33 +02:00
Mikhail Glukhikh
5d57341ee4 Make cheaper analysis in KtReference.resolveToPsiElements
Related to KT-23182
2018-03-28 12:04:13 +02:00
Dmitry Petrov
3a936c9e27 Minor: drop 'transformTypeArguments' 2018-03-27 17:25:11 +03:00
Dmitry Petrov
47b3152bd0 Throw detailed exceptions for incorrect argument indices 2018-03-27 17:25:11 +03:00
Dmitry Petrov
9a76ee63ab Determine typeArgumentsCount by descriptor 2018-03-27 17:25:11 +03:00
Dmitry Petrov
3b967017f6 Render type arguments by index 2018-03-27 17:25:11 +03:00
Dmitry Petrov
b5607e4b3d Store type arguments by indices instead of TypeParameterDescriptor keys 2018-03-27 17:25:11 +03:00
Alexey Sedunov
f4936d3e31 JS: Fix NodeJS run configuration support
#KT-16710 Fixed
2018-03-27 13:47:14 +03:00
Alexey Sedunov
e604707450 Move: Support "Search references" option in dialogs 2018-03-27 13:47:13 +03:00
Dmitry Savvinov
5b216a0270 Don't throw exception on recursion for class header scope
The root issue here is that when we have some cycle in scopes, the place
where we detect a loop depends on where we've entered that cycle.

Previously, we didn't know about cases where we enter scopes loop
through `ClassResolutionScopesSupport.scopeForClassHeaderResolution` =>
there were no need to handle recursion on `scopeForClassHeaderResolution`
carefully.

It seems that in some very narrow cases (launch of specific
inspection on specficic code with specific caches state), we do manage
to enter loop exactly through `scopeForClassHeaderResolution` (see
KT-23033), which causes exception.

^KT-23033 Fixed
2018-03-27 12:16:54 +03:00
Dmitry Savvinov
148573fcf6 Remove 'DataFlowValueKindUtils.isStable', use 'DataFlowValue.isStable' instead 2018-03-27 10:51:51 +03:00
Anton Bannykh
7b860eab36 Merge kotlin-experimental into kotlin standard library (KT-23055 fixed)
* kotlin-experimental.js has been already merged into kotlin.js
* change library name to kotlin in kotlin-experimental.meta.js in order to produce correct require calls
* concatenate kotlin-experimental.meta.js with kotlin.meta.js
* suppress multiple module declaration warning for such use case
2018-03-26 23:13:28 +03:00
Anton Bannykh
d0e71acaa5 JS: fix NaN bug workaround 2018-03-26 20:07:00 +03:00
Anton Bannykh
e1233beddc Convert BinaryOperationIntrinsic to Java @FunctionInterface
Also some minor renamings and visibility changes
2018-03-26 20:07:00 +03:00
Anton Bannykh
3a7518cad2 Implemented equality comparison for primitive types 2018-03-26 20:07:00 +03:00
Anton Bannykh
7cde03938a Fix some Unit materialization bugs 2018-03-26 20:07:00 +03:00
Anton Bannykh
1f7d235fb5 AssignmentBOIF is never used 2018-03-26 20:07:00 +03:00
Anton Bannykh
7c61e594e2 Simplified CompareTo intrinsics 2018-03-26 20:07:00 +03:00
Anton Bannykh
757649d6da BinaryOperationIntrinsic as typealias 2018-03-26 20:07:00 +03:00
Anton Bannykh
2352dc3d1c minor ObjectIntrinsics refactoring 2018-03-26 20:07:00 +03:00
Anton Bannykh
60e487dcec Minor FunctionIntrinsics refactoring 2018-03-26 20:07:00 +03:00
Anton Bannykh
5b11ee251f Simplify binary operation intrinsics
Having to invoke `exist` so prevent a runtime exception
is no better then trying to invoke a method on a null
reference. It is actually worse, because Kotlin type
system handles the latter.
2018-03-26 20:07:00 +03:00
Anton Bannykh
cfd42b85b2 Kotlinify Intrinsics.java 2018-03-26 20:07:00 +03:00
Alexander Udalov
a4b7023f65 Fix compilation errors in builtinsSerializer test data 2018-03-26 17:21:09 +02:00
Alexander Udalov
6660873e18 Add annotations to dependencies of tests-common
To prevent warnings "unknown enum constant Capitalization.Title" during
the build
2018-03-26 17:21:08 +02:00
Alexander Udalov
13df75ef74 Minor, extract isInstanceType to protoTypeTableUtil 2018-03-26 17:21:08 +02:00
Alexander Udalov
f7a3182982 Minor, add default value to contract expression flags 2018-03-26 17:21:07 +02:00
Alexander Udalov
46a1109910 Report warnings on usages of kotlin-stdlib-jre7/kotlin-stdlib-jre8
#KT-21347 Fixed
2018-03-26 17:19:35 +02:00
Alexander Udalov
71e9ee7437 Minor, rephrase diagnostic message on repeatable annotations 2018-03-26 16:35:17 +02:00
Alexander Udalov
7f1a468b2e Read virtual files safely in KotlinMetadataStubBuilder
Do not fail on an invalid file, or on a file pointing to a non-existent
.jar entry, exactly as this is done in KotlinMetadataDecompiler
2018-03-26 15:54:28 +02:00
Mikaël Peltier
3a50d0d78f KT-22063 Add intrinsics for javaObjectType and javaPrimitiveType
Fix of https://youtrack.jetbrains.com/issue/KT-22063
2018-03-26 15:52:19 +02:00
Alexey Tsvetkov
d79a4fd9a0 Remove gradle/project-schema.json
It is not needed anymore.
Also since :ultimate project is included conditionally,
if "non-ultimate" developer regenerates
and commits gradle/project-schema.json,
then ultimate builds would fail.
2018-03-26 16:09:29 +03:00
Alexey Tsvetkov
b420671a1d Introduce jps-compatible-base plugin to create necessary configurations
To avoid generating static accessors (via kotlinDslAccessorsSnapshot),
we need to create all necessary configurations during 'plugins'
block evaluation.
2018-03-26 16:09:29 +03:00
Alexey Tsvetkov
8a82c1618c Use Plugins DSL in Kotlin Gradle scripts
When plugins DSL is used, there is no need to
manually generate typesafe accessors for extensions and
conventions (by running `./gradlew kotlinDslAccessorsSnapshot`).
2018-03-26 16:09:29 +03:00
Alexey Tsvetkov
19a13b47ff Use java-gradle-plugin in buildSrc 2018-03-26 16:09:29 +03:00
ilmat192
9d15052688 Fix composite build with Kotlin/Native (#1588) 2018-03-26 16:04:41 +03:00
Mikhail Zarechenskiy
4ed5e2f35e [NI] Improve inference for lambdas that return lambdas 2018-03-26 14:59:52 +03:00
Mikhail Zarechenskiy
b8c0910724 Add one more test on delegated properties to check NI 2018-03-26 14:37:32 +03:00
Mikhail Zarechenskiy
3ea0b9975f [NI] Use specialized type of integer value type for delegate receiver 2018-03-25 20:22:38 +03:00
Mikhail Zarechenskiy
3dde31729e [NI] Record information about delegated property as in old inference 2018-03-25 20:22:37 +03:00
Mikhail Zarechenskiy
7e982fed4f Add complex test on delegated properties 2018-03-25 20:22:37 +03:00
Mikhail Zarechenskiy
bb4fb669a0 [NI] Refactoring: rename method 2018-03-25 20:22:36 +03:00
Mikhail Zarechenskiy
bf92280f52 [NI] Update testdata about inference for delegated properties 2018-03-25 20:22:36 +03:00
Mikhail Zarechenskiy
53b434a3e3 [NI] Use getValue/setValue methods simultaneously to infer types
Rewrite inference for delegated properties with the new scheme
2018-03-25 20:22:36 +03:00
Mikhail Zarechenskiy
0f60965595 [NI] Introduce basic resolver for many candidates 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy
3078e5a6ff [NI] Simplify creation of resolution callbacks 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy
ff10e97c28 [NI] Make CallResolutionResult more typed 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy
c8ef785010 [NI] Move method hasContradiction to constraints storage 2018-03-25 20:22:34 +03:00
Mikhail Zarechenskiy
663b417c5a [NI] Introduce method to add extra constraints before completion 2018-03-25 20:22:34 +03:00
Mikhail Zarechenskiy
50027225a1 [NI] Extract interface InferenceSession to a separate file 2018-03-25 20:22:34 +03:00
Mikhail Zarechenskiy
1a5282c4b7 [NI] Introduce methods to extend inference for several candidates 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy
01cdc08026 [NI] Refactor: extract method to run candidate completion out 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy
2235f5eb48 [NI] Refactor: create separate method for candidate preparation 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy
8c44d44e78 [NI] Propagate class to extend inference through resolution context 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy
887a69b72e [NI] Extend constraint completer to work with several resolve atoms 2018-03-25 20:22:32 +03:00
Zalim Bashorov
a47a916437 Restore hack for avoiding tracking declarations from JS stdlib 2018-03-24 20:09:11 +03:00
Nikolay Krasko
ba662b7d56 Minor: another message fix (KT-23309)
#KT-23309 Fixed
2018-03-23 18:31:22 +03:00
Nikolay Krasko
982b768c69 Refactoring: collect callbacks for collecting module info in one place 2018-03-23 18:04:08 +03:00
Nikolay Krasko
0b0eb210b6 Refactoring: get module language settings in ResolverForProjectImpl 2018-03-23 18:04:06 +03:00
Nikolay Krasko
525d90540a Refactoring: enumerate used components in PerFileAnalysisCache.kt 2018-03-23 18:04:03 +03:00
Nikolay Krasko
586860e03a Refactoring: store correspondent module info in module content 2018-03-23 18:04:01 +03:00
Nikolay Krasko
3e313509e1 Refactoring: restrict callback in ResolverForProjectImpl 2018-03-23 18:03:59 +03:00
Nikolay Krasko
666d31bdc4 Refactoring: visibility restrictions 2018-03-23 18:03:57 +03:00
Nikolay Krasko
38a79086d3 Rename: ResolutionFacadeImpl -> ModuleResolutionFacadeImpl 2018-03-23 18:03:54 +03:00
Nikolay Krasko
dced45d1bf Refactoring: rename AnalyzerFacade -> ResolverForModuleFactory 2018-03-23 18:03:52 +03:00
Nikolay Krasko
c5e8374fa8 Minor: typo fix (KT-23309)
#KT-23309 Fixed
2018-03-23 17:58:12 +03:00
Nikolay Krasko
0f441760c2 Refactoring: remove usages of analyzeFully
Function isn't removed because it has usages from other plugins
2018-03-23 17:58:11 +03:00
Nikolay Krasko
059013a8d3 Rename: analyzeFullyAndGetResult -> analyzeWithAllCompilerChecks in ResolutionFacade 2018-03-23 17:58:11 +03:00
Nikolay Krasko
f2b478f304 Rename: analyzeFullyAndGetResult -> analyzeWithAllCompilerChecks in resolutionApi.kt 2018-03-23 17:58:10 +03:00
Mikhail Glukhikh
804d340c5f Fix more broken QF tests 2018-03-23 15:26:21 +03:00
Mikhail Glukhikh
e937a350fe Fix broken QF tests 2018-03-23 14:57:33 +03:00
Ilmir Usmanov
481dbee96a Do not ignore copy operations while finding source instructions
in redundant locals elimination.

Since IgnoringCopySourceInterpreter ignores ALOADs and ASTOREs,
the source instruction of ALOAD K in {ALOAD N, ASTORE K, ALOAD K}
sequence is not ASTORE K. In this case we cannot simply replace K
with N, since there can be multiple {ALOAD N, ASTORE K} sequences
in separate branches. After replacement we get different stack
frames.
This change resolves this.

However, in ReturnUnitMethodTransformer we want to ignore copies
of the same GETSTATIC kotlin/Unit.INSTANCE, since we do not mess
with local variables and just replace ASTORE with ARETURN to help
tail-call optimization.
 #KT-23373: Fixed
2018-03-23 14:32:48 +03:00
Mikhail Zarechenskiy
15b46cdda9 [NI] Don't perform useless computation for smartcasts 2018-03-23 14:18:32 +03:00
Toshiaki Kameyama
e06c13732f Add intentions for specifying use-site targets for an annotation
So #KT-19871 Fixed
2018-03-23 13:03:00 +03:00
Denis Zharkov
e162749366 Add a cache for PsiBasedClassResolver instances
The PsiBasedClassResolver constructor isn't very cheap to call
because it runs computation of conflicting names each time

Again, this is helpful for Spring-interop because PsiBasedClassResolver
is used very frequently there

 #KT-23380 Fixed
2018-03-23 12:36:15 +03:00
Denis Zharkov
f060604d98 Add a cache for KtImportDirective::importedFqName
It's very useful for Spring users because KotlinAnnotatedElementsSearcher
calls PsiBasedClassResolver::canBeTargetReference rather frequently
on a file and the latter function retreives importedFqName for each
import in the file that becomes a problem because computing fq-name
from PSI is a heavy computation

 #KT-23380 In Progress
2018-03-23 12:36:15 +03:00
Denis Zharkov
673d1aa91d Fix a memory leak of old resolve session from light classes
The problem is that diagnostics might indirectly retain a reference to an
obsolete ResolverForProject (it becomes outdated after out of block
modification).

At the same time light class instances may survive afer OOM when they
are leaked somewhere (e.g. to Java resolve)

The idea is to store the Diagnostics instance inside a
ResolverForProject component which will be collected once
ResolverForProject is collected itself.

 #KT-23380 In Progress
2018-03-23 12:36:15 +03:00
Dmitry Petrov
bd7e9d5397 Fix type argument mapping for members imported from objects 2018-03-23 11:43:44 +03:00
Dmitry Petrov
37040523ad valueArgumentsCount 2018-03-23 11:43:44 +03:00
Dmitry Petrov
3c7914b0c1 Minor: drop obsolete code 2018-03-23 11:43:44 +03:00
Dmitry Petrov
135d3ab57a Fix type arguments mapping 2018-03-23 11:43:44 +03:00
Dmitry Petrov
eb5904ea8e Underlying constructor for type alias should always be substituted
Otherwise PSI2IR fails because of type mismatch.
2018-03-23 11:43:44 +03:00
Dmitry Petrov
bfcf1584a2 Minor: reformat code 2018-03-23 11:43:44 +03:00
Toshiaki Kameyama
26dc5840f1 Fix two exceptions in "Convert concatenation to template
So #KT-23045 Fixed
So #KT-23045 Fixed
2018-03-23 09:36:49 +03:00
Toshiaki Kameyama
7328f75103 Don't suggest 'Redundant semicolon' before lambda extension call
So #KT-23152 Fixed
2018-03-23 09:35:34 +03:00
Ilya Gorbunov
5d06c2c584 Code conformance test: actualize stdlib and tools exclusions 2018-03-23 04:25:07 +03:00
Ilya Gorbunov
bb04198f7e kotlin-stdlib-gen: add dsl option for multiple suppressed diagnostics 2018-03-23 04:23:25 +03:00
Ilmir Usmanov
bd7ad8c9d5 Raise deprecation level to ERROR of coroutineContext
inside kotlin.coroutines.experimental.intrinsics package
 #KT-22400
2018-03-22 22:12:27 +03:00
Ilya Gorbunov
dd8a00f651 Make kotlin-test-js implement both kotlin-test-common and kotlin-test-annotations-common 2018-03-22 21:55:04 +03:00
Natalia Selezneva
c7513b5ffa Fix compatibility with LivePlugin
^KT-23371 Fixed
2018-03-22 17:17:59 +03:00
Ilya Gorbunov
7a40b4c5f1 Refactor: extract JVM-specific tests into separate files
Make KotlinVersion random comparison test running in JS
2018-03-22 17:08:43 +03:00
Ilya Gorbunov
2d099a29b8 Clean up redundant -Xmulti-platform option from multiplatform projects
It was necessary before, but now it's provided automatically.
2018-03-22 15:16:33 +03:00
Nikolay Krasko
117890dba8 Fix generating cls stubs when is metadata using type tables (KT-23345)
Affected cases:
 - return type for suspend lambda
 - aliased type in type alias declaration
 - using type alias instead of aliased type in declarations

 #KT-23345 Fixed
2018-03-22 11:54:03 +03:00
Nikolay Krasko
875e0a64e7 Add -Xuse-type-table to jvm compiler options 2018-03-22 11:54:01 +03:00
Toshiaki Kameyama
a67068d37e Suggest "Add annotation target" quick fix also for field use-site
So #KT-23227 Fixed
2018-03-22 10:30:46 +03:00
Toshiaki Kameyama
e328d2d1ca Suggest "Remove braces" in nested if correctly #KT-14270 Fixed 2018-03-22 09:56:22 +03:00
Toshiaki Kameyama
8082a5daf7 Fix "Add braces to if" when semicolon is used instead of a new line
So #KT-23123 Fixed
2018-03-22 09:45:54 +03:00
Yan Zhulanow
369dbd604b Android modules should not be imported as common modules (#KT-23367) 2018-03-22 04:53:00 +03:00
Yan Zhulanow
db20c1a38f Minor: Add Android Studio platform prefix in Android patchset branches to fix 'runIde' task for them 2018-03-22 04:52:59 +03:00
Yan Zhulanow
3932c745df Minor: Fix bundled Kotlin plugin removal in Android Studio bundle for macOS 2018-03-22 04:52:58 +03:00
Mikhail Zarechenskiy
effdfe8ec0 Prohibit incorrect annotations with use-site targets more precisely
#KT-21696 Fixed

The problem is coming from the fact that `AnnotationTarget.VALUE_PARAMETER` is mapped to receiver parameter and to value parameter, but annotation with use-site target `receiver` can be used only on type reference of receiver parameter
2018-03-22 04:03:08 +03:00
Mikhail Zarechenskiy
6007559af1 Minor, remove unused method, add TODO 2018-03-22 04:03:06 +03:00
Mikhail Zarechenskiy
6086cd2cf4 Prohibit non-const expressions through varargs in annotations
Fixes #KT-23153 for Kotlin 1.3

 The problem was in the type check of expression type against expected type. When feature `AssigningArraysToVarargsInNamedFormInAnnotations` (KT-20171) appeared, expected type could be wrong, which led to failed type check
2018-03-22 04:03:04 +03:00
Mikhail Zarechenskiy
4ebd11a7ae Refactoring: rename parameter to argument for annotation diagnostics 2018-03-22 03:59:55 +03:00
Mikhail Zarechenskiy
baf16895f2 Refactor and prettify checkCompileTimeConstant method 2018-03-22 03:03:56 +03:00
Vyacheslav Gerasimov
96caf7f4ce Build: Get rid of build scan deprecated methods 2018-03-21 20:08:42 +03:00
Alexey Tsvetkov
605bcc66a1 IC: add destination dir to start of classpath instead of end
Otherwise IC fails when a project declares a class with the same name
as in one of its dependencies.
The issue is relevant only for non-JPS IC (Gradle, Maven, etc.),
but I added the test for JPS too.

  #KT-20516 fixed
2018-03-21 18:44:42 +03:00
Alexey Tsvetkov
55cbd28910 Do not exclude :ultimate:generateTests in "Generate All Tests"
:ultimate is excluded by default now,
so `-x :ultimate:generateTests` fails
2018-03-21 18:44:42 +03:00
Ilya Gorbunov
5d13b1681f Refactor: extract JVM API into separate files
Increase visibility to internal for:
- copyToArrayOfAny
- UNINITIALIZED_VALUE
- InitializedLazyImpl

Change file classes to multifile:
- LazyKt
- GroupingKt
- IntrinsicsKt (coroutines)
2018-03-21 18:08:00 +03:00
Nikolay Krasko
5dc4e31918 Update idea to 173.3.5 (173.4674.33) 2018-03-21 17:25:45 +03:00
Nikolay Krasko
3b4ca3558b Add hard dependency to Java module in plugin.xml
Otherwise resulting plugin will be installable to PyCharm, WebStorm and
other Intellij IDE without Java.

It can be resolved with `xi:include`, but it should be done with care,
because some declarations in `jvm.xml` should be placed after some
declarations in `plugin.xml` (action groups suffer from this issue for
sure).
2018-03-21 17:25:40 +03:00
Nikolay Krasko
d847f9f7ac Use stringValue for getting version of *jre usage in Maven (KT-23271)
#KT-23271 Fixed
2018-03-21 17:25:34 +03:00
Natalia Selezneva
3b11b890e9 Set FATAL severity for errors from GradleScriptTemplateProvider 2018-03-21 16:51:53 +03:00
Roman Artemev
0d0adbbc05 Fixed handling of default params in declaration (KT-23239) 2018-03-21 12:44:24 +03:00
Roman Artemev
a121a4a6b2 Added test to check default params in declaration (issue KT-23239) 2018-03-21 12:44:24 +03:00
Alexander Podkhalyuzin
7d72fe07bb Fixed broken exception reporter 2018-03-21 12:25:32 +03:00
Mikhail Glukhikh
b739db3c35 Fix parameter handling in "Move suspicious reference into parentheses"
Related to KT-21743
2018-03-21 09:53:38 +03:00
Toshiaki Kameyama
fbd06dc74f Fix "move suspicious reference into parentheses" for functional types
So #KT-21743 Fixed
2018-03-21 09:30:17 +03:00
Toshiaki Kameyama
3fbf85dc37 Add inspection to highlight unnecessary explicit companion references
So #KT-22971 Fixed
2018-03-21 09:15:48 +03:00
Zalim Bashorov
4c5913f5a3 Regenerate tests 2018-03-20 22:44:30 +03:00
Zalim Bashorov
68457a55a8 [JS IR BE] support more constructions:
* generate declaration for top level properties
* basic support for calls
* break
* continue
* throw
* generate declaration for local vals and vars
2018-03-20 22:44:29 +03:00
Zalim Bashorov
560e35174b Minor: renames
IrElementToJsNodeTransformer -> BaseIrElementToJsNodeTransformer
IrFileTransformer -> IrFileToJsTransformer
IrModuleTransformer -> IrModuleToJsTransformer
2018-03-20 22:44:29 +03:00
Zalim Bashorov
87ee373205 Few improvements in test infrastructure:
* add the way to specify another compatible target for target backend.
  It's used to generate a test for X_IR backend even when in a test data
  is explicitly written a target: "// TARGET_BACKEND: X".
* Add the ability to run tests "ignored" with the "IGNORE_BACKEND" directive
  as regular tests, i.e. w/o catching exceptions.
* Print stack trace of caught exception inside tests "ignored"
  with the "IGNORE_BACKEND" directive.
2018-03-20 22:44:28 +03:00
Zalim Bashorov
f899394126 Regenerate tests 2018-03-20 22:44:28 +03:00
Zalim Bashorov
e0a070ff35 [JS IR BE] basic compiler 2018-03-20 22:44:27 +03:00
Zalim Bashorov
4404c6dd2c Run JS box tests for JS IR BE 2018-03-20 22:44:26 +03:00
Zalim Bashorov
bef7b5389b Create ir/backend.js module with dummy compiler 2018-03-20 22:44:26 +03:00
Zalim Bashorov
f820b3eadd Fix exception from PathManager.getHomePath with message "Could not find installation home path" 2018-03-20 22:44:25 +03:00
Zalim Bashorov
44d5d0da7e Rid of most of the usage of JsConfig in TopDownAnalyzerFacadeForJS 2018-03-20 22:44:25 +03:00
Vyacheslav Gerasimov
66eaa34bdb Build: Put local repositories to the top of repositories block 2018-03-20 20:57:13 +03:00
Vyacheslav Gerasimov
40a765819a Remove unused versions.intellij-plugin property 2018-03-20 20:44:20 +03:00
Vyacheslav Gerasimov
f55d137790 Upgrade shadow plugin to 2.0.2
Fixes warning 'Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.'
2018-03-20 20:44:20 +03:00
Toshiaki Kameyama
9d6b36c249 KT-20282 'Move statement up' works incorrectly for statement after 'finally' block if 'try' block contains closure 2018-03-20 20:39:17 +03:00
Alexey Belkov
d3b1b7a5be Minor: fix assertion 2018-03-20 20:39:17 +03:00
Yan Zhulanow
793a05106c Minor: Remove old 'buildLexer.xml' path from ant.xml 2018-03-20 16:22:52 +03:00
Denis Zharkov
d8538db719 Avoid retaining whole KotlinClassHeader in IDEKotlinBinaryClassCache
Before this change there was a retention chain
VirtualFile -> KotlinBinaryData -> KotlinBinaryHeaderData -> KotlinClassHeader

The latter one contains all binary metadata (a lot of String[])
while only a small part of it is used.

The used parts are moved straight to KotlinBinaryClassHeaderData
in this change.

 #KT-19484 Fixed
2018-03-20 10:46:13 +03:00
Ilya Chernikov
dca7323627 [minor] fix asm sources connection 2018-03-19 17:17:10 +01:00
Alexey Tsvetkov
6ab96c1d7d Set up idea.home.path in :incremental-compilation-impl
To avoid warnings in stderr
2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
2584143e92 Report correct source to output mapping for kjsm files
Now IC can correctly remove kjsm files when source files are changed
2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
ea09f4caf6 Remove all kjsm files before writing new ones 2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
a3feb77193 Compare diverged .meta.js files in a human readable way 2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
1cd2abf76f Fix comparing directories after IC test
A directory-after-rebuild should correspond to expectedDir parameter,
a directory-after-IC should correspond to actualDir parameter.
Also we should not forgive extra directories.
2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
d95abf2234 Generate meta info in JS IC tests 2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
1d87aaf3d6 Avoid serializing JS metadata twice per compilation 2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
ebb774b0ee Sort package fragments by fq-name for JS serialization 2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
1fd0e5e50c Optimize serializing JS metadata
This makes JS IC tests twice as fast
2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
89275410a6 Avoid reading JS libraries twice per compilation 2018-03-19 18:04:33 +03:00
Alexey Tsvetkov
ba60ca468c Improve JS inliner performance 2018-03-19 18:04:32 +03:00
Ilya Chernikov
0e5c5af727 Add asm sources into idea sdk sources on the sdk preparation
restores navigation to asm sources in idea.
The asm sources could not be added separately, due to the gradle issue
https://issues.gradle.org/browse/GRADLE-3210
2018-03-19 15:47:19 +01:00
Alexey Tsvetkov
30d0cc3a34 Ensure all output directories are cleared on IC rebuild
In some cases IC needs to perform a rebuild.
Before this change IC was not clearing output directories
besides destination dir for classes, so for example
kapt stubs were not cleared.

Stalled stubs might lead to compile errors.
For example:
1. foo/XGen.java is generated from annotated class foo/X (XGen also
references X).
2. foo/X is moved to bar/X and some other change forces IC to rebuild.
3. kapt generates bar/X stub, but foo/X stub
was not removed because stubs dir is not cleared.
4. kapt runs annotation processors, foo/XGen.java is generated from
foo/X stub, bar/XGen.java is generated from bar/X stub.
5. kotlinc rebuilds. Since destination dir is cleared properly,
only bar/X.class exists.
6. javac tries to compile foo/XGen and fails, because it
compiles against actual Kotlin classes, not stubs.

This commit fixes the issue by passing all output directories
of a task from Gradle to Kotlin IC.

   #KT-21735 fixed
2018-03-19 17:39:47 +03:00
Alexey Tsvetkov
afce075dc8 Fix unresolved references in kotlin-gradle-plugin in Idea 2018-03-19 17:39:47 +03:00
Ilya Chernikov
d6792f5f52 Implement support for additional compiler arguments for scripts in IDE
fixes #KT-19120
2018-03-19 11:45:10 +01:00
Ilya Chernikov
643e81f0ae Refactor language feature settings processing for exposing it outside of the CLI compiler 2018-03-19 11:45:09 +01:00
Natalia Selezneva
58edab37c1 Add test for fatal severity in scripts 2018-03-19 09:41:38 +03:00
Natalia Selezneva
f957b3072b Add FATAL severity to ScriptExternalHighlightingPass 2018-03-17 00:28:34 +03:00
Natalia Selezneva
dcea9d0cd5 Add FATAL severity to script dependencies resolve result 2018-03-17 00:23:57 +03:00
Natalia Selezneva
82481b48c4 Restore old package for ScriptTemplatesProvider.
Note that this is EP used in another plugins (ex. LivePlugin https://plugins.jetbrains.com/plugin/7282-liveplugin)
2018-03-17 00:21:32 +03:00
Natalia Selezneva
1f75eaed9a Don't highlight gradle scripts during gradle import.
Show warning on the top panel for these files
2018-03-17 00:21:25 +03:00
Natalia Selezneva
5f1118e820 Don't highlight scripts if resolver returns Failure.
Note that we don't highlight script when ScriptDependenciesFileAttribute is not set.
2018-03-17 00:21:17 +03:00
Natalia Selezneva
4b4acfee2c Scripts: display errors from external resolver in panel if text range is empty 2018-03-17 00:21:10 +03:00
Natalia Selezneva
26a4b67fa3 Introduce default ScriptTemplate for Gradle scripts
^KT-23228 Fixed
2018-03-17 00:21:02 +03:00
Natalia Selezneva
9f02664351 Minor: reformat 2018-03-17 00:20:55 +03:00
Vyacheslav Gerasimov
042873fa2c Build: add maven.repository.mirror property
May be used to add additional repository to all projects

(cherry picked from commit d8407b9)
2018-03-16 20:07:31 +03:00
Nikolay Krasko
79d9ea6716 Check module is from given set of modules before passing it to callbacks
`module` variable is fetched from `moduleInfoByDescriptor`, and this map
is filled in `createModuleDescriptor`, witch is called in
`doGetDescriptorForModule` only for modules from the given set.
2018-03-16 18:19:52 +03:00
Nikolay Krasko
7f501e3a78 Minor: document fields usages in ResolverForProjectImpl 2018-03-16 18:03:21 +03:00
Nikolay Krasko
03459eb808 Protect resolverByModuleDescriptor collection with storageManager lock
Read access from isResolverFromModuleDescriptorComputed was exposed through
DelegatingPackageFragmentProvider.
2018-03-16 16:40:38 +03:00
Nikolay Krasko
9145470f79 Minor: remove "JVM" constant usages in multi target platform 2018-03-16 16:40:38 +03:00
Nikolay Krasko
34569c2541 Minor: hasTopLevelCallables rename 2018-03-16 16:40:37 +03:00
Nikolay Krasko
14a0434737 Remove reference to binding context from LazyLightClassDataHolder cache
The ultimate goal is to remove references to binding context and resolve
result from light classes. There still can be references from `diagnostics`
field, but `bindingContext` is unneeded and can be removed.

Relates to snapshots from IDEA-187395.
2018-03-16 16:40:37 +03:00
Nikolay Krasko
481a5bc28d Update JUnit3RunnerWithInners.java for Gradle 4.6 (KT-23292)
Update after "Executer -> Executor" rename
3f1487e800

 #KT-23292 Fixed
2018-03-16 16:40:37 +03:00
Yan Zhulanow
e2ed77354f Pill: Update module structure, add missing modules metadata and metadata.jvm 2018-03-16 16:31:55 +03:00
Ilmir Usmanov
826d667398 Remove redundant locals
Do not transform already transformed suspend lambdas
Ignore duplicates of continuation in local variable table during redundant locals elimination.
2018-03-16 16:26:14 +03:00
Ilmir Usmanov
81f3e39f29 Do not generate ACONST_NULL as continuation of crossinline suspend lambda 2018-03-16 16:26:13 +03:00
Ilmir Usmanov
6b7173ba13 Forbid default inline/crossinline suspend parameters 2018-03-16 16:26:12 +03:00
Ilmir Usmanov
7224b99928 Add intention to remove suspend from parameter on suspend inline function 2018-03-16 16:26:11 +03:00
Ilmir Usmanov
6854135077 Support crossinline suspend lambda as parameter of inline function
Use fake continuation instead of ALOAD 0 while inlining
Do not generate state machine for inner lambdas and inner objects,
which capture crossinline suspend lambda.

 #KT-19159: Fixed
2018-03-16 16:26:11 +03:00
Ilmir Usmanov
042ca55be7 Do not generate suspension points for crossinline lambdas 2018-03-16 16:26:10 +03:00
Ilmir Usmanov
e6a353e590 Remove returns unit markers in suspend lambdas 2018-03-16 16:26:09 +03:00
Ilmir Usmanov
e169383f76 Fix problem with transforming suspend lambda instantiation by itself
#KT-21605: Fixed
2018-03-16 16:26:09 +03:00
Svyatoslav Scherbina
f3bc8d179c Add one more IR text test case 2018-03-16 14:47:20 +03:00
Svyatoslav Scherbina
aac940415f Fix psi2ir when type parameter bound goes after the type parameter 2018-03-16 14:47:18 +03:00
Simon Ogorodnik
c0b0f6d1ca Extract PSI to separate module 2018-03-16 13:32:14 +03:00
Toshiaki Kameyama
55c93bc8b6 Fix NPE on conversion: run/apply with explicit signature -> let/also
So #KT-22949 Fixed
2018-03-16 12:17:24 +03:00
Toshiaki Kameyama
f93b21eaa2 Fix "Add function to supertype" braces #KT-23215 Fixed 2018-03-16 12:11:26 +03:00
Alexander Udalov
404bcc58e5 Update bootstrap to 1.2.40-dev-967 2018-03-15 20:47:35 +01:00
Alexander Udalov
4484335eac Update light classes test data after d0ed0c4049 2018-03-15 18:23:16 +01:00
Alexander Udalov
a23af6306c Update test data of log tag consistency test on lint
The reason is that UastUtils.tryResolveNamed (in
LogDetector.checkTagConsistent) started to refer to the field of the
property in the companion after d0ed0c4049 instead of its getter
2018-03-15 18:19:43 +01:00
Denis Zharkov
21932b5824 Use mockJDK as a bootClasspath for AbstractCompileKotlinAgainstJavaTest
Otherwise JAVA_HOME is being used that lead to test result depending
on minor JDK version used on a computer

 #KT-21047 Fixed
2018-03-15 19:00:31 +03:00
Denis Zharkov
1766812bf3 Minor. Reformat AbstractCompileKotlinAgainstJavaTest 2018-03-15 19:00:31 +03:00
Denis Zharkov
c334f46825 Avoid retaining reference to ProtoBuf.Package in JvmPackagePartSource
Otherwise, 2e933a165a doesn't help
2018-03-15 18:59:44 +03:00
Denis Zharkov
4b78abaa7a Minor. Reformat JvmPackagePartSource 2018-03-15 18:59:44 +03:00
yukuku
6f6b0baf3b Fix wrong example on the docs of @PurelyImplements 2018-03-15 18:56:26 +03:00
Alexey Tsvetkov
baa20e2677 Ensure absolute paths are written to module xml file
Since d0ca0dca2b
first IC build uses CompilationMode.Rebuild instead of Incremental
to avoid unnecessary work (computing API difference etc.).

However there is a branch that does not transform source files
paths to absolute ones before writing them to module xml file.

In our plugins we have always transformed files to absolute ones before
passing them to IncrementalJvmCompilerRunner, so there is no problem.

But third party build systems could pass relative paths to IncrementalJvmCompilerRunner
(namely Kobalt does so).
It turned out to break builds because KotlinToJVMBytecodeCompiler takes
module xml file's (which is a temporary file itself) parent as a base
for relative source files (see KotlinToJVMBytecodeCompiler.getAbsolutePaths).

This change ensures that makeModuleFile always uses absolute files.

    #KT-22542 fixed
2018-03-15 18:06:13 +03:00
Anton Bannykh
e377a30929 Use mocha instead of QUnit for debugging stdlib tests in browser 2018-03-15 17:54:17 +03:00
Anton Bannykh
338bde23fc JS stdlib: run kotlin.test library tests 2018-03-15 17:54:17 +03:00
Vyacheslav Gerasimov
f0ec073bf6 Build: Include ultimate projects only if intellijUltimateEnabled 2018-03-15 16:35:20 +03:00
Vyacheslav Gerasimov
ef018d2ac1 Make dependencies on Android gradle plugin non-transitive
com.android.tools.build:gradle brings about 50 unused transitive dependencies including idea-core and uast, sometimes it breaks IDE features like navigation to declarations and debugging.

Inline contents of ReflectionUtil.findMethod to remove dependency on idea-core
2018-03-15 15:20:22 +03:00
Anton Bannykh
04cbea4956 JS: fix Long constant translation (KT-19228 fixed) 2018-03-15 14:58:10 +03:00
Alexey Sedunov
b7d79cc146 Gradle: Do not resolve sourcesets in projects with Android module 2018-03-15 13:17:43 +03:00
Denis Zharkov
e1c29ad3fd Regenerate tests for androidx support annotations 2018-03-15 10:34:33 +03:00
Denis Zharkov
7d8e7f481d Add a reference to third-party/annotations/androidx in license 2018-03-15 10:34:33 +03:00
Jake Wharton
b22f051edb Add support for nullability annotations in androidx package. 2018-03-15 10:34:33 +03:00
Toshiaki Kameyama
a3b35cbfe0 Reformat: ConvertToStringTemplateIntention 2018-03-15 10:32:07 +03:00
Toshiaki Kameyama
66906e2c80 Process '$' correctly in "Convert concatenation to template"
So #KT-12226 Fixed
2018-03-15 10:29:58 +03:00
Alexey Belkov
3b2bbee595 Standardize and improve descriptions of intentions/inspections 2018-03-15 09:56:47 +03:00
Nikolay Krasko
bc7ccbc39b Fix stub mismatch for top level declaration with JvmPackageName (KT-21831)
ClassId stores jvm name and it differs from kotlin name in that case.

 #KT-21831 Fixed
2018-03-14 21:16:58 +03:00
Toshiaki Kameyama
c1f43558b9 Unwrap: function parameter (KT-14788)
#KT-14788 Fixed
2018-03-14 21:16:58 +03:00
Ilya Chernikov
6838873a93 Fix local build problem - task compileJava not found
The problem is happening because our plugin deletes the task from
common projects, which may lead to such errors. The proper fix is
planned in our gradle plugin.
2018-03-14 15:39:30 +01:00
Ilya Chernikov
755f05e669 Switch to gradle 4.6 2018-03-14 15:39:30 +01:00
Ilya Chernikov
07b82ff1cc Fix noDefaultJar helper - remove the disabled jar from archives
before this fix switching to the gradle 4.6-rc1 caused the problem on
local publish task - kotlin-compiler.jar not found
2018-03-14 15:39:30 +01:00
Mikaël Peltier
d0ed0c4049 KT-14258 Optimize accesses to properties defined into companion
- Use direct access to property defined into companion object when
it is possible rather than always use an accessor to access the
property.
- Use direct access will speedup runtime performance.
- Avoid to generate useless accessors for companion properties.

Fix of https://youtrack.jetbrains.com/issue/KT-14258
2018-03-14 15:30:40 +01:00
Anton Bannykh
fd244be9ca JS: add tests to make sure KT-22019 is fixed 2018-03-14 17:15:16 +03:00
Natalia Selezneva
a5ac8abc7c Run Script Action should add script dependencies to classpath 2018-03-14 16:09:03 +03:00
Natalia Selezneva
7d76554966 Run script action in IDE should use kotlin compiler from plugin
^KT-22647 Fixed
2018-03-14 16:08:57 +03:00
Natalia Selezneva
2486be0f86 'Configure kotlin' should set 1.2-SNAPSHOT version in build.gradle for snapshot version of kotlin plugin 2018-03-14 16:08:33 +03:00
Mikhael Bogdanov
cdcb651c8e Get rid of 'BRIDGE' flag on $default functions 2018-03-14 13:57:49 +01:00
Zalim Bashorov
ac5ef57876 Regenerate tests 2018-03-14 15:06:35 +03:00
Zalim Bashorov
055b900d8a Add generating tests using "whitelist" of target backend; add new target backends: JS_IR and JVM_IR 2018-03-14 15:06:31 +03:00
Zalim Bashorov
82f41a1125 J2K TargetBackend 2018-03-14 15:06:31 +03:00
Zalim Bashorov
9970dd051f Fix copyright's start year in generated tests 2018-03-14 15:04:58 +03:00
Zalim Bashorov
814be1810c Don't write copyright to *.gradle.kts and *.gradle files 2018-03-14 15:04:57 +03:00
Zalim Bashorov
c0ce3f849d Fix copyright's start year 2018-03-14 15:04:57 +03:00
Alexander Udalov
e21c73229c Throw exceptions explicitly in protoTypeTableUtil
Previously, if both type and typeId messages were missing (for example,
ProtoBuf.Function.returnType/returnTypeId) because of some bug, the
behavior was unpredictable because a type with id 0 from the type table
would be returned, which could be a completely irrelevant type. This is
an incorrect situation and we should report a diagnostic instead.
Temporarily throw an exception instead, since this only affects how the
compiler works on bad metadata
2018-03-14 12:25:23 +01:00
Alexander Udalov
0a78fe8ae3 Move some serialization helpers to metadata/metadata.jvm 2018-03-14 12:25:22 +01:00
Alexander Udalov
779290be0c J2K Interner: convert and prettify 2018-03-14 12:25:22 +01:00
Alexander Udalov
bda7514b43 J2K Interner: rename .java -> .kt 2018-03-14 12:25:21 +01:00
Alexander Udalov
acf357e9b5 Extract descriptor-related behavior in StringTable to separate interface
Descriptor-related code is only needed to be able to compute
"replacement" names for local classes, which are different in JVM and JS
2018-03-14 12:25:20 +01:00
Alexander Udalov
043f4c3d01 Increase patch number of metadata versions
After adding inline classes in 915455ebe9
2018-03-14 12:25:19 +01:00
Alexander Udalov
407de206a3 Minor corrections in proto schemas, mostly in comments
Also set up code style for the protobuf plugin
2018-03-14 12:25:19 +01:00
Alexander Udalov
9d8d4b837b Minor, move JavaFlexibleTypeDeserializer.id to JvmProtoBufUtil
To be able to read platform types with metadata.jvm
2018-03-14 12:25:18 +01:00
Alexander Udalov
241673c6a1 Add forgotten SinceKotlin to Metadata.pn
kotlin.Metadata is internal, so it shouldn't have any visible effect
2018-03-14 12:25:17 +01:00
Alexander Udalov
3f3e05a9d2 Move essential metadata-related classes to 'metadata' and 'metadata.jvm' 2018-03-14 12:25:16 +01:00
Alexander Udalov
88dea9aa70 Move NameResolver to module 'metadata' and J2K
Also move NameResolverImpl to 'metadata' and JvmNameResolver to
'metadata.jvm'
2018-03-14 12:25:16 +01:00
Alexander Udalov
0ba42850f9 Drop ClassData and PackageData, rename ClassDataWithSource -> ClassData
Use pairs in JvmProtoBufUtil for simplicity
2018-03-14 12:25:15 +01:00
Alexander Udalov
5ed5ac8291 Minor, use stdlib instead of ifEmpty 2018-03-14 12:25:14 +01:00
Alexander Udalov
a5a69c5099 Remove dependency of ClassMapperLite on JavaToKotlinClassMap
There are two reasons for this. First, this class will be used in the
metadata reading library which should not have dependencies on lots of
compiler stuff JavaToKotlinClassMap depends on.

Second, it was easy to accidentally break the deserialization in old
compilers by adding another mapping to JavaToKotlinClassMap. This was
possible because ClassMapperLite is used to decide whether or not the
JVM signature is "trivial" and should be written to the metadata (at
JvmSerializerExtension.SignatureSerializer.requiresSignature). If the
signature is trivial but mentions a type added in JavaToKotlinClassMap
in the new compiler, the old compiler will not be able to load the
signature correctly. See the comment on ClassMapperLite for more
information
2018-03-14 12:25:14 +01:00
Alexander Udalov
070effc69d Minor, drop unnecessary ClassDescriptor.classId implementation 2018-03-14 12:25:13 +01:00
Alexander Udalov
b07c6086cd Remove dependency of NameResolverImpl on FqName
Remove AbstractJsProtoComparisonTest.getProtoData in favor of
(apparently copy-pasted) IncrementalJsCache.getProtoData
2018-03-14 12:25:12 +01:00
Alexander Udalov
4f81e572c7 Make NameResolver.getName extension instead of member
To get rid of dependency of NameResolver on Name
2018-03-14 12:25:11 +01:00
Alexander Udalov
e31f286444 Make NameResolver.getClassId extension instead of member
To get rid of dependency of NameResolver on ClassId
2018-03-14 12:25:11 +01:00
Alexander Udalov
27ad4f7d5d Move ProtoBuf classes to package org.jetbrains.kotlin.metadata 2018-03-14 12:25:10 +01:00
Alexander Udalov
575a388b11 Move core protobuf schemas to 'metadata' and 'metadata.jvm' 2018-03-14 12:25:09 +01:00
Alexander Udalov
368af867b8 Add modules metadata and metadata.jvm 2018-03-14 12:25:08 +01:00
Alexander Udalov
54d6710923 Regenerate gradle/project-schema.json 2018-03-14 12:25:07 +01:00
Alexander Udalov
99964cd030 Move descriptor-related utilities from Flags to ProtoEnumFlags 2018-03-14 12:25:07 +01:00
Alexander Udalov
ec67a878a0 Minor, rename Deserialization -> ProtoEnumFlags
Also fix warnings and remove unneeded JvmStatic
2018-03-14 12:25:06 +01:00
Alexander Udalov
7e1b1db7cc Minor, don't use BitEncoding where it's not necessary 2018-03-14 12:25:05 +01:00
Alexey Tsvetkov
ceb243c096 Don't pack kotlin-daemon-client and daemon-common into kotlin-compiler-runner jar 2018-03-14 13:29:32 +03:00
Alexey Tsvetkov
c736f229ce Always depend on runtimeJar of kotlin-daemon-client 2018-03-14 13:29:32 +03:00
Sergey Igushkin
0039be6972 Fix binary incompatibility with Android Gradle plugin 3.2.0-alpha06
Remove a non-reflective usage of the ResourceSet class, which has been
moved to a different package between versions. Access it through
reflection instead. This is a workaround. We can introduce a proper
fix once we have a public API in the Android plugin.

The test case that could detect the compatibility issue is
`testAndroidExtensionsManyVariants` (it uses experimental Android
extensions), but we did not run it with 3.2.0-alpha6. This commit
adds a test class with the same tests for 3.2.0-alpha6.

Issue #KT-23192 Fixed
2018-03-14 04:11:35 +03:00
Alexey Tsvetkov
3a7a34cc4e Add all necessary compile dependencies to 'pill:generate-all-tests'
Before this change running the pill:generate-all-tests:testClasses
task (which is run by Intellij on "Build" invocation) led to compile error
2018-03-13 21:26:28 +03:00
Alexey Tsvetkov
0deec7983d Revert "Provide custom ConstantAffectionResolver in JPS"
This reverts commit 772a935de6.

The API in Intellij was changed, now the issue can be fixed only in
182.* branches.
2018-03-13 21:26:11 +03:00
Vyacheslav Gerasimov
d831d35869 Add readme for including kotlin-compiler into composite build 2018-03-13 18:29:26 +03:00
Vyacheslav Gerasimov
0e879896e0 Add include/kotlin-compiler project
Needed to include kotlin compiler project into a composite build (kotlin native + cotlin compiler)
2018-03-13 18:29:24 +03:00
Vyacheslav Gerasimov
361e8e065c Remove unused xpp3 & xstream from IntellijCoreDependencies
They are 'fatjared' into kotlin-compiler but proguard removes them from resulting jar afterwards
2018-03-13 17:50:15 +03:00
Nikolay Krasko
7174b31756 Fix GradleConfiguratorTest.kt compilation 2018-03-13 17:42:40 +03:00
Nikolay Krasko
48f2fd8607 Add explicit set of supported file types to KotlinPositionManager 2018-03-13 15:52:21 +03:00
Nikolay Krasko
674fbc9871 Process dependencyManagement during stdlib-jre* deprecation check (KT-21745, KT-23161)
#KT-23161 Fixed
 #KT-21745 Fixed
2018-03-13 15:52:20 +03:00
Nikolay Krasko
57aaf0444f Add support for "implementation" gradle directive (KT-21746)
#KT-21746 Fixed
2018-03-13 15:52:19 +03:00
Nikolay Krasko
9004cdfa45 Reformat: idea-gradle module 2018-03-13 15:52:18 +03:00
Denis Zharkov
cff88a3f8b Fix false positive unreachable code in case of Nothing!-typed calls
Note, that this change potentially has some other effects in corner cases
(like the changed test data that is rather sensible because `bar`
in the example is not effectively projected out and can be called
with nulls)

Probably, we need to consider rewriting all other isSomeType methods
in KotlinBuiltins, but now it seems to be a rather dangerous change

 #KT-16424 Fixed
2018-03-13 14:40:05 +03:00
Denis Zharkov
a7854bc0ce Fix SAM detection algorithm for case of default overrides
#KT-22652 Fixed
2018-03-13 14:39:35 +03:00
Dmitry Jemerov
b4fb0e0305 Further reduce number of calls to getConfigurableModulesWithKotlinFiles
Also handle INRE and requeue check
2018-03-13 12:29:16 +01:00
Dmitry Jemerov
a29d693dc5 Fix inverted logic of isNotConfiguredNotificationRequired 2018-03-13 12:29:16 +01:00
Dmitry Jemerov
fa39cec94b Avoid duplicate scan of modules with Kotlin files (KT-23183) 2018-03-13 12:29:16 +01:00
Alexey Sedunov
1be33b91fa MPP: Do not report ACTUAL_WITHOUT_EXPECT if compatibility is null for all modules
This fixes diagnostic tests
2018-03-13 14:18:36 +03:00
Sergey Igushkin
c0a17f72a7 Fix bad property name introduced in the fix for #KT-23085 2018-03-13 14:17:12 +03:00
Simon Ogorodnik
48fb3db7ba Fix inserting variable name suggestion on non-enter char typing
#KT-21933 fixed
2018-03-13 12:51:29 +03:00
Mikhail Glukhikh
d5d9aa0329 GotoSuperActionHandler: minor refactoring 2018-03-13 10:58:24 +03:00
Mikhail Glukhikh
ab30275f14 Navigation: add expect declarations as supers #KT-16892 Fixed 2018-03-13 10:40:54 +03:00
Mikhail Glukhikh
849f9fc5c1 Navigation: add actual declarations as implementations (KT-16892) 2018-03-13 10:40:52 +03:00
Ilya Gorbunov
3530d9b4c7 Download org.jetbrains:markdown:0.1.25 from bintray 2018-03-13 09:50:10 +03:00
Svyatoslav Scherbina
d3ab86db48 Fix access to scoped symbol table when inserting implicit casts to IR 2018-03-13 09:46:32 +03:00
Dmitry Petrov
d38258d7a0 Use specified comparison generator for chars in optimized ranges
Otherwise if Char value is a result of some erased generic call,
coercing it to I (primitive int) causes CCE at run-time.

 #KT-23104 Fixed Target versions 1.2.40
2018-03-13 09:34:10 +03:00
Ilya Gorbunov
2891a6c954 Do not use java.home system property to locate JDK dependencies
It may point either to JDK/bin or to JRE/bin. Instead use JDK_16 and JDK_18 paths.
2018-03-13 08:52:15 +03:00
Ilya Gorbunov
6955cabbba Improve KPropertyN documentation
Provide missing documentation for Getter and Setter of KProperty1/2.
Fix the link to the 'getExtensionDelegate' extension.
2018-03-12 23:17:38 +03:00
Sergey Igushkin
07b811460a Deal with unnamed Gradle inputs/outputs
Fix the only unnamed input added to a Gradle task at runtime.
Add a test that checks for unnamed task inputs.

Issue #KT-23085 Fixed
2018-03-12 21:54:03 +03:00
Alexey Tsvetkov
97700316f5 Replace compileOnly with testCompileOnly in :generators
In Gradle testCompileOnly configuration does not extend compileOnly.

Since :generators project does not have main source set,
compileOnly dependencies have never worked.

Instead "kotlin-reflect" was resolved transitevely trough
:compiler:frontend.script module (a runtime dependency becomes
a compile transitive dependency).

In ccd6263787 I replaced `runtime` dependency
on "kotlin-reflect" with `runtimeOnly` breaking `:generators:compileTestKotlin`.
2018-03-12 20:07:31 +03:00
Sergey Igushkin
32df9c00ee Update literals in the grammar reference
Add missing long literal suffix
Add binary integer literals
Introduce IntegerLiteral lexer rule, which is closer to the actual lexer

Issue #KT-22713 Fixed
2018-03-12 18:02:22 +03:00
Sergey Igushkin
41044cd277 Fix the rule for valueArguments 2018-03-12 18:02:08 +03:00
Alexey Belkov
4b5b9b40e7 Grammar: Fix "object" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
d98c454806 Grammar: Fix "LabelName" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
4ffd4f8060 Grammar: Fix "labelDefinition" rule in precedence table (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
2b9f26a0da Grammar: Fix "functionType" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
d0f3001fd5 Grammar: Fix "optionalProjection" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
d6496814b2 Grammar: Fix "enumEntry" rule (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
8f88bc0a3c Grammar: Fix broken link (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
3cb952df5d Grammar: Add terminating semicolons (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
6fa87f98ca Grammar: Improve wording (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Belkov
c0866e7ba2 Grammar: Fix rule headings in section "Lexical structure" (KT-22676) 2018-03-12 18:02:08 +03:00
Alexey Tsvetkov
e8f8488d54 Add diagnostic task to print all shadow jars in compile classpaths 2018-03-12 17:31:11 +03:00
Alexey Tsvetkov
ccd6263787 Use runtimeOnly dependency in kotlin-reflect
"kotlin-reflect" is a shadow jar which breaks incremental compilation
to avoid non-incremental builds, project should add
* `compileOnly` dependency on ":kotlin-reflect-api"
* `runtimeOnly` dependency on ":kotlin-reflect"
* `runtime` dependency is not recommended because it leaks into compile
* classpath
through transitive dependencies
2018-03-12 16:09:04 +03:00
Pavel V. Talanov
dc27a3f6d0 Minor: lightClassUtils, less specific return type 2018-03-12 12:05:08 +01:00
Pavel V. Talanov
32516a3f33 Refactor: split *LightClassGenerationSupport into separate files
Move cli binding trace implementation to top level
2018-03-12 12:05:05 +01:00
Pavel V. Talanov
f421181e16 Split LightClassGenerationSupport into separate entities
LightClassGenerationSupport:
    Includes utilities related to generating light classes
    Primary client of this service are KtLight* implementation classes
KotlinAsJavaSupport:
    Provides APIs to transform kotlin code into Psi* entities
    Primary client of this service is JavaElementFinder
2018-03-12 12:04:59 +01:00
Ilya Gorbunov
62d409a9ba Use dex-method-list:3.0 from maven central
Update changed API usages and reformat code according to code style.
2018-03-09 19:39:42 +03:00
Mikhael Bogdanov
95a7e6c2d5 Minor.Reformat 2018-03-08 11:50:09 +01:00
Mikhael Bogdanov
c1c8660e55 Don't try to transform sam wrappers in same module
#KT-22304 Fixed
2018-03-08 11:50:08 +01:00
Mikhail Glukhikh
2a6f1d7731 Regenerate tests 2018-03-07 19:24:56 +03:00
Mikhail Glukhikh
cc5821382c Compilation fix 2018-03-07 19:15:17 +03:00
Mikhail Glukhikh
71a6827b1c MPP wizard step refactoring: use UI layout DSL 2018-03-07 19:07:56 +03:00
Mikhail Glukhikh
ea4b04780c MPP wizard fix: remove non-existing modules from settings.gradle 2018-03-07 19:07:56 +03:00
Mikhail Glukhikh
1d0c5413de MPP wizard: add combobox selecting common module position + extra checks
So #KT-23097 Fixed
2018-03-07 19:07:55 +03:00
Mikhail Glukhikh
879779ec0d MPP wizard: take default JDK from default project template
Related to KT-23097
2018-03-07 19:07:55 +03:00
Mikhail Glukhikh
4f2701385d MPP wizard: set sourceCompatibility / jvmTarget for JVM module
Related to KT-23097
2018-03-07 19:07:55 +03:00
Alexey Sedunov
d9aa1796cd MPP: Support multiple 'expectedBy' dependencies for single module
#KT-22865 Fixed
2018-03-07 18:34:03 +03:00
Toshiaki Kameyama
e3a69d118f Disable "Add labeled return" for suspend lambdas #KT-23126 Fixed 2018-03-07 16:10:44 +03:00
Toshiaki Kameyama
5d1f5d9bca "Remove redundant 'if'" now works correctly with labeled return
So #KT-23109 Fixed
2018-03-07 16:01:38 +03:00
Toshiaki Kameyama
733cb42ced Make implicit this inspection work for lambda invocation #KT-22970 Fixed 2018-03-07 15:58:23 +03:00
Toshiaki Kameyama
a87f652591 Reformat intentions/Utils 2018-03-07 15:41:39 +03:00
Toshiaki Kameyama
dd4ceb8c0f Move getCallableDescriptor function declaration to Utils 2018-03-07 15:41:07 +03:00
Toshiaki Kameyama
f48eacfbd4 Add inspection (INFORMATION) to convert Pair constructor into to call
So #KT-22933 Fixed
2018-03-07 15:40:19 +03:00
Toshiaki Kameyama
963e430b42 Make "Add annotation target" available on use-site annotation
So #KT-22861 Fixed
So #KT-22862 Fixed
2018-03-07 15:33:28 +03:00
Mikhail Glukhikh
442a89bc6c ModuleDescriptor now sees internals of its expected by #KT-15739 Fixed 2018-03-07 13:58:31 +03:00
Mikhail Glukhikh
0c4c9251d6 Sort modifiers: process visibility & modality after others
Related to KT-22954
2018-03-07 13:57:16 +03:00
Toshiaki Kameyama
b9e7e8fca3 Sort modifiers: process final modifier correctly #KT-22954 fixed 2018-03-07 13:34:25 +03:00
Felix Guo
e88d5b2a76 Fix typo in README (#1547)
`qualify` -> `quality`
2018-03-07 10:37:40 +01:00
Dmitry Jemerov
81adbcb7e6 Support for implicit package prefixes
Now, if all Kotlin files directly under a source root have the same
package statement, it's used as an implicit package prefix for that
source root. It's honored by the package name/directory name mismatch
inspection and by new file creation actions;
support in refactorings is TODO.

 #KT-17306 Fixed
2018-03-07 10:31:57 +01:00
Yan Zhulanow
753319a89d Pill: Rewrite existing "idea.home.path" option if already set 2018-03-06 22:27:55 +03:00
Yan Zhulanow
799c0f28b7 Pill: Fix platform home directory (this fixes IDE tests) 2018-03-06 22:27:55 +03:00
Yan Zhulanow
d1a4acb81f Pill: Add "IDEA (No ProcessCancelledException)" run configuration 2018-03-06 22:27:54 +03:00
Yan Zhulanow
8e2ef6bedd J2K: Script Codegen (step 2) 2018-03-06 22:27:53 +03:00
Yan Zhulanow
7711624308 J2K: Script Codegen (step 1) 2018-03-06 22:27:51 +03:00
Yan Zhulanow
fa8a3b55f3 REPL, Refactoring: A number of trivial renames/moves 2018-03-06 22:27:51 +03:00
Yan Zhulanow
82c72f228a REPL, Refactoring, Minor: Lower property visibility 2018-03-06 22:27:50 +03:00
Yan Zhulanow
bceb138ed1 REPL, Refactoring: Get rid of nasty enum-like String literals 2018-03-06 22:27:49 +03:00
Yan Zhulanow
96dda8de6b REPL, Refactoring: Make ReplFromTerminal and ReplInterpreter not to implement ReplConfiguration 2018-03-06 22:27:48 +03:00
Yan Zhulanow
07363f2904 REPL, Refactoring: Replace strange callback function with an execution interceptor 2018-03-06 22:27:48 +03:00
Yan Zhulanow
b35676c1bd Minor: Delete an unused class 2018-03-06 22:27:47 +03:00
Yan Zhulanow
da35ded090 Minor: Add "repl" to dictionary 2018-03-06 22:27:46 +03:00
Yan Zhulanow
54251ddac0 REPL, Refactoring: Rename ReplErrorLogger to ReplExceptionReporter
ReplErrorLogger is not really a class that logs errors, ReplWriter exists for that purpose (I don't think ReplWriter has a good API as well, though). The only thing it does is that is passes exceptions got from the compiler to IDE. So, in my opinion, the old name is rather confusing and it doesn't describe what the class actually do.

Also rethrow exceptions explicitly.
2018-03-06 22:27:45 +03:00
Svyatoslav Scherbina
5abade0e32 Fix missing type parameters of property accessors in external IR stubs 2018-03-06 16:43:20 +03:00
Alexey Sedunov
e145a64d50 Rename: Forbid rename of synthetic declaration references
#KT-20241 Fixed
2018-03-06 15:15:44 +03:00
Alexey Sedunov
9761e33110 Refactor: Use RefactoringErrorHintException to report errors in test mode 2018-03-06 15:15:44 +03:00
Alexey Sedunov
df4c80f43a Shorten References: Allow import insertion when function and property have the same name
#KT-22745 Fixed
2018-03-06 15:15:44 +03:00
Alexey Sedunov
df4cd14161 Move: Relax private/protected visibility checks for usages in Java code 2018-03-06 15:15:43 +03:00
Alexey Sedunov
4fd221fc0c Rename: Filter out destructuring references to parameters
They shouldn't be renamed in any case

 #KT-15039 Fixed
2018-03-06 15:15:43 +03:00
Alexey Sedunov
85b381db7c Rename: Identify elements with the same origin when checking import ambiguity
#KT-13284 Fixed
2018-03-06 15:15:43 +03:00
Alexey Sedunov
6c17bbe42c Rename: Check redeclaration for local variables
Also add tests for other local declarations

 #KT-13255 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
4609b2ae37 Navigation: Resolve typealiased SAM-references to type alias declaration
#KT-15302 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
5bff4b9f39 Rename: Allow deleting name of companion object
#KT-20178 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
0e3e387446 Rename: Adapt VariableInplaceRenameHandler to Kotlin
#KT-16510 Fixed
2018-03-06 15:15:42 +03:00
Alexey Sedunov
7149a0855a Rename: Use OverloadChecker for redeclaration conflict analysis
#KT-19561 Fixed
 #KT-22812 Fixed
 #KT-13907 Fixed
2018-03-06 15:15:41 +03:00
Alexey Sedunov
12d5a72697 Move: Show more accurate message when moving subclass of a sealed class
#KT-23065 Fixed
2018-03-06 15:15:41 +03:00
Alexey Sedunov
5f43bd56b4 Extract Function: Use 'public' visibility for function extracted from public inline
#KT-15228 Fixed
2018-03-06 15:15:41 +03:00
Alexey Sedunov
d690aedb89 References: Fix resolution of delegate reference for local variables
#KT-22229 Fixed
2018-03-06 15:15:40 +03:00
Alexey Sedunov
96de29dfcb Create from Usage: Support accessors for local delegated properties
#KT-19730 Fixed
2018-03-06 15:15:40 +03:00
Mikhail Glukhikh
2eddce57ff MPP wizard: add combo-box with JDK for JVM platform, if any
Related to KT-23097
2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
2108634ddb MPP wizard: add check-boxes to create JVM / JS module
Related to KT-23097
2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
cc8a2b3123 MPP wizard: add common module at the same level with platform ones
Related to KT-23097
2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
720c84d1d6 Fix style: KotlinGradleMultiplatformWizardStep 2018-03-06 14:32:31 +03:00
Mikhail Glukhikh
fe7b7fb0bd Create actual fix: add empty brackets for classes in super-type lists
Related to KT-21082
2018-03-06 14:32:30 +03:00
Mikhail Glukhikh
ef3e0b01c4 Create actual fix: use target module instead of target platform 2018-03-06 14:32:30 +03:00
Mikhail Glukhikh
90e4413fc9 Create actual: put top-level actual declarations in the same file
When multiple expect declarations are in the same file,
and some of them already have actual declarations for this platform,
then "Create actual fix" put other declarations into the same file
with existing actual declarations

So #KT-17058 Fixed
So #KT-21082 Fixed
2018-03-06 14:32:30 +03:00
Mikhail Glukhikh
3ec2dac10b Create actual fix: reformat 2018-03-06 14:32:30 +03:00
Pavel V. Talanov
27d7bb595f CliLightClassGenerationSupport: correctly find facade files
This fixes a problem where JvmPackageName annotation could force file
    facades to be in the package different to declared kotlin package
2018-03-06 12:07:12 +01:00
Pavel V. Talanov
00ee5e3d16 Refactor: extract mapping package to files to a separate component
Make it extensible
2018-03-06 12:07:08 +01:00
Pavel V. Talanov
fae0f611a0 Test java resolve against kotlin file with JvmPackageName annotation 2018-03-06 12:07:07 +01:00
Pavel V. Talanov
498431311c Light classes: test "JvmPackageName" and actual declarations 2018-03-06 12:06:59 +01:00
Pavel V. Talanov
d2b90b84f8 KotlinFileStubForIde: save full facadeFqName
Prefix is not necessarily same as packageFqName since JvmPackageName was introduced
2018-03-06 12:05:53 +01:00
Nikolay Krasko
9e061555af Use anchor for element to avoid working with invalid element (KT-22631)
Element in constructor can be invalidated when dumb mode begins/ends.
Working with invalid elements can produce nodes without icons and bad
presentation.

 #KT-22631 Fixed
2018-03-06 13:04:26 +03:00
Nikolay Krasko
bb9933a8f9 Reformat: structureView package 2018-03-06 13:04:25 +03:00
Pavel V. Talanov
6c4537accc Create InvalidLightClassDataHolder for expect classes
This fixes an exception from duplicateJvmSignature reporter
Fixes "QuickFixTestGenerated$Override.testDontOfferToImplementMembersForExpectedClass" on teamcity
2018-03-05 18:07:38 +01:00
Pavel V. Talanov
89c82a85d0 Do not build light classes for expect classes
#KT-15482 Fixed
2018-03-05 18:07:36 +01:00
Toshiaki Kameyama
3f96e1dabc Move statement up/down fails for multiline declarations with lambdas (KT-21013)
#KT-21013 Fixed
2018-03-05 16:10:59 +03:00
Alexander Udalov
f41165c566 Minor, use elvis in deprecationUtil.kt 2018-03-05 13:43:10 +01:00
Alexander Udalov
e92e7c6f80 Do not report RequireKotlin-related diagnostics in snapshot compilers
Otherwise it's difficult to use a newly added API annotated with
RequireKotlin with the latest, not yet released, version.

For example, suppose there's a new function added in kotlin-stdlib,
since Kotlin 1.3, which requires 1.3 (Kotlin < 1.3 is supposed to report
an error on usages):

    @SinceKotlin("1.3")
    @RequireKotlin("1.3", COMPILER_VERSION, message = ...)
    fun foo() {}

Until Kotlin 1.3 is released, the latest available compiler in Maven has
the version 1.3-SNAPSHOT, which is _less_ than 1.3 according to Maven
rules which are used in getDeprecationByVersionRequirement. Therefore,
errors will be reported on usages of foo, and there's no Kotlin compiler
version which can be used to verify if the function works correctly,
which is inconvenient.

Since SNAPSHOT versions are effectively "pre-release" in a way, it's OK
for them to skip reporting these diagnostics
2018-03-05 13:39:13 +01:00
Alexander Udalov
bbaea6a062 Refactor deprecation by version requirement
- Get rid of ApiVersion in favor of MavenComparableVersion
- Don't crash on invalid versions in RequireKotlin
- Extract to a separate function
2018-03-05 13:39:13 +01:00
Nikolay Krasko
90802f2d7c Refactoring: remove ModuleResolverProvider, inline createModuleResolverProvider 2018-03-05 15:20:53 +03:00
Nikolay Krasko
de68607d5f Refactoring: move JavaResolveExtension.kt to util package 2018-03-05 15:20:53 +03:00
Svyatoslav Scherbina
7a2d761a7d Add minor improvements to psi2ir and IR utilities:
* Generate missing IR parameter declarations in external stubs
* Use origin = FAKE_OVERRIDE in external IR stubs for fake overrides
* Set .parent in external IR stubs
* Set .parent in IR generated by some utility methods
2018-03-02 15:41:48 +03:00
Dmitry Petrov
13a7270129 Generate type parameter declarations for property accessors
This requires "scoped" type parameter symbols, because in the ugly world
of descriptors property accessors have no type parameters of their own.
2018-03-02 14:35:35 +03:00
Dmitry Petrov
31996f1139 Update "defaultness" for property accessor with inherited visibility
Property accessor that overrides a non-default property accessor with
visibility different from the property visibility was incorrectly
considered "default". Corresponding metadata was written incorrectly,
and 'internal' setter call caused NSME

 #KT-23044 Fixed Target versions 1.2.40
2018-03-02 10:54:32 +03:00
Dmitry Petrov
8e8c5fae01 Minor: reformat code 2018-03-02 10:54:32 +03:00
Yan Zhulanow
6950c256ce Pill: Replace most of the hardcoded library coordinates with info from Gradle 2018-03-02 03:15:33 +03:00
Yan Zhulanow
6e65a4810e Make a project-wide embeddedComponents configuration for embedding external binaries to project artifacts 2018-03-02 03:15:32 +03:00
Yan Zhulanow
3c06dd7464 Pill, Minor: Move run configurations to the resources source set 2018-03-02 03:15:31 +03:00
Yan Zhulanow
3894afcf0b Pill, Minor: Remove the hardcoded repository, use the available utilities 2018-03-02 03:15:30 +03:00
Yan Zhulanow
b24d87f7ed Pill: Merge two "root" and "non-root" Pill plugins 2018-03-02 03:15:30 +03:00
Yan Zhulanow
3da479c1d5 Pill, Small: Pass libraries to 'parse()' directly 2018-03-02 03:15:29 +03:00
Yan Zhulanow
07ede20dc5 Pill: Import KotlinPlugin artifact 2018-03-02 03:15:28 +03:00
Yan Zhulanow
bc78d2c417 Pill: Move .iml files out of the module structure 2018-03-02 03:15:27 +03:00
Yan Zhulanow
4c12a4cb11 Pill: Add 'unpill' task 2018-03-02 03:15:25 +03:00
Yan Zhulanow
df88acaefd Get rid of test-to-production dependencies as it's not supported in plain IDEA projects 2018-03-02 03:15:24 +03:00
Yan Zhulanow
e7a2743dcf Pill: Add "Generate All Tests" run configuration 2018-03-02 03:15:23 +03:00
Yan Zhulanow
55164660a8 Pill: Attach asm sources 2018-03-02 03:15:22 +03:00
Yan Zhulanow
ad5a42459a Pill: Apply required changes to the default JUnit configuration on import 2018-03-02 03:15:21 +03:00
Yan Zhulanow
868ef262b8 Pill: Add JPS run configurations 2018-03-02 03:15:20 +03:00
Yan Zhulanow
a0c105adbe Fixes to make the project compile when using Pill 2018-03-02 03:15:19 +03:00
Yan Zhulanow
8dad2d30f5 Move the compiler.xml back to IDEA (this fixes almost all IDE tests when running on JPS) 2018-03-02 03:15:18 +03:00
Yan Zhulanow
34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00
Yan Zhulanow
af60bcfb47 Initial Pill implementation
Pill is a Gradle-to-JPS model generator for compiler + compiler plugins + IDE project parts.
The generated project model does not know anything about Gradle and is fully operable using only JPS.
2018-03-02 03:15:16 +03:00
Yan Zhulanow
0ebcd0ad40 Remove inline function usages that break JPS compilation 2018-03-01 21:30:51 +03:00
Ilmir Usmanov
07ec704228 Fix modifiers generation for companion objects
when language verion is 1.3

 #KT-23002: Fixed
2018-03-01 20:03:26 +03:00
Alexey Sedunov
30314d43d9 Shorten Reference: Disable ${...} shortening inside completion insert handler 2018-03-01 17:41:10 +03:00
Mikhail Glukhikh
68757fff2e Downgrade "Type parameter can have ... variance" to INFORMATION level 2018-03-01 16:19:21 +03:00
Nikolay Krasko
a03470d151 Fix test data for JavaMethodUsedInKotlin.kt test after 173.3.4 update
- Ignore empty lines in actual test data
- Don't generate additional //INFO: in final file diff
2018-03-01 15:41:10 +03:00
Renaud Paquay
94ee78c0ca Hitting breakpoint in Kotlin sometimes doesn't work (KT-22205)
Fix KT-22205 and https://issuetracker.google.com/issues/71556313

Hitting breakpoints in Kotlin JUnit test with an Android Gradle
project sometimes(*) does not work in Android Studio 3.1 beta.

(*) The issue is related to various threads running concurrently
with "dumb" mode background code, so the issue reproduces only
on certain configurations.

In a nutshell, the issue is as follows

* On one hand, gradle build finishes, fires an event ("buildFinished")
  that is processed "later" and that causes the IDE to enter "dumb" mode
  for a shot amount of time (about 300-500 msec on a somewhat up to date
  multi-core computer).

* On the other hand, once the JVM of the debuggee is started, breakpoints
  need to be resolved (on the debugger thread, through a call to
  com.intellij.debugger.engine.CompoundPositionManager.createPrepareRequests.
  This code calls into the "KotlinPositionManager.createPrepareRequests",
  which in turns calls into "PerFileAnalysisCache.analyze". That method
  returns "AnalysisResult.EMPTY" is the project is in dumb mode.
  This return value prevents callers from successfully resolving
  the source location into a breakpoint.

Given that the 2 code paths above execute on separate threads without
explicit synchronization, the "failed to resolve breakpoint" issue
occurs sporadically, to the point it happens 100% of the time on
certain configuration.

The fix is so wrap the kotlin breakpoint resolution code inside
a "runReadActionInSmartMode" so that the debugger thread "waits"
for "dumb" mode to terminates before trying to resolve breakpoint
locations.

 #KT-22205 Fixed
2018-03-01 15:41:09 +03:00
Nikolay Krasko
b1bcadd762 Add mandatory dependency to com.intellij.modules.remoteServers
Android studio doesn't have this bundled module, so this should
prevent installing plugins for Intellij to AS.

This patch should be reverted in AS branches.
2018-03-01 15:41:07 +03:00
Egor Neliuba
715d5e90ba Clean up test skips after KT-17137
We need to clean these up since primitive array `is` checks work now

(cherry picked from commit b413e9ef51606c51ebfb21bd7ff646b0fb75470a)
2018-03-01 14:26:13 +03:00
Anton Bannykh
4a5e9bbc7f JS: remove -XtypedArraysEnabled flag (always true now) 2018-03-01 14:26:13 +03:00
Dmitry Savvinov
60aae55233 Update changelog for 1.2.30 2018-03-01 14:15:42 +03:00
Pavel V. Talanov
a6aea5625a Dsl completion: fix completion when multiple receivers are in scope 2018-02-28 19:48:45 +01:00
Ilya Chernikov
65af137117 (minor) Fix script templates from setting processing 2018-02-28 19:29:05 +01:00
Ilya Chernikov
a5278c2184 Get rid of PathUtil dependency in the script_util
reduces transitive dependencies required for the script_util
2018-02-28 19:29:05 +01:00
Ilya Chernikov
db7e06aaa4 Make dependencies to the script-runtime directly to the project...
instead to vie projectDist. With the current project bootstrap scheme a
dependency to the simply built script-runtime project via dist is not
needed anymore, but it breaks proper sources navigation in IDEA.
2018-02-28 19:29:05 +01:00
Nicolay Mitropolsky
fa1d2a891b KotlinLanguageInjector: getNameReference extracted to work with annotations 2018-02-28 17:19:46 +03:00
Nicolay Mitropolsky
08c41474af KotlinLanguageInjector: "kotlin" injections in annotations handled by injectWithCall 2018-02-28 17:19:46 +03:00
Nicolay Mitropolsky
fd4f4ef853 KotlinLanguageInjector: support for nested annotations (#KT-21753) 2018-02-28 17:19:46 +03:00
Mikaël Peltier
5c04264218 Remove unnecessary dependencies from AbstractBoundedValue
- Bounded value is a low-level abstraction for bounded ranges that is
used to generate specialized contains checks and for loop. It only
needs to contains StackValue that will be used to generate code.
- SimpleBoundedValue already have a constructor supporting StackValue
but having only one constructor avoid to pass extra argument that
will be used to only compute another information.
2018-02-28 15:20:03 +03:00
Anton Bannykh
ed80252ba8 JS: fix double compareTo behaviour for NaN and +-0 (KT-22723) 2018-02-28 15:01:58 +03:00
Alexander Podkhalyuzin
12c01ef80a Kotlin SDK auto-creation is disabled now #KT-23059 Fixed
(cherry picked from commit f5d8479)
2018-02-28 14:38:29 +03:00
Mikhail Glukhikh
0f029d8f51 Scope function conversion: remove 'can' from description to fix tests 2018-02-28 14:30:32 +03:00
Alexey Sedunov
d06f23f2ba Move: Fix replacement of non-code usages with backquoted names
#KT-13986 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
a194eb94cf Remove Redundant Backticks: Fix inspection applicability
#KT-22804 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
f65fe0dd5f Minor: Fix NPE
#KT-22724 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
883558a4c7 Move/Copy: Fix 'protected' conflict reporting for references in super type entries
#KT-22678 Fixed
2018-02-28 14:03:43 +03:00
Alexey Sedunov
27f5ddcf83 Rename: Report redeclaration conflict between class and type alias
#KT-22751 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
a341392524 Move: Search Java usages when top-level declaration moves to new facade
#KT-22747 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
91fdc0e967 Move: Drop ${...} around shortened qualified expression
#KT-22692 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
e63e48933d Move: Add import for top-level declarations moved to the default package
#KT-22661 Fixed
2018-02-28 14:03:42 +03:00
Alexey Sedunov
96132a686a Type Hierarchy: Support Kotlin class constructors
#KT-22925 Fixed
 #KT-22926 Fixed
2018-02-28 14:03:41 +03:00
Mikhail Glukhikh
66f3126b20 Scope function conversion: remove forced INFORMATION highlight type 2018-02-28 13:17:39 +03:00
Nicolay Mitropolsky
2f6fb4091b making LambdaArgument methods nullable
overridden `LambdaArgument.getArgumentExpression` removed because it is already nullable in parent

#EA-117013
2018-02-28 12:13:12 +03:00
Mikhail Glukhikh
664a25ce81 Polish KT-22011 inspection: message, level, group, range, etc. 2018-02-28 12:10:24 +03:00
Toshiaki Kameyama
7d6cb7805c Add inspection: Java mutator method used on immutable Kotlin Collections
In particular, fill, reverse, shuffle, sort calls are reported
So #KT-22011 Fixed
2018-02-28 11:52:44 +03:00
Mikhail Glukhikh
bec28c8388 Replace with for-each: add new-lines using comment saver
Related to KT-15858
2018-02-28 11:29:44 +03:00
Toshiaki Kameyama
7f880bf58c Replace with for-each: add new-line if necessary #KT-15858 Fixed 2018-02-28 11:18:21 +03:00
Dmitry Petrov
ae7f60a96e Update IR testData after rebase on master 2018-02-28 10:35:13 +03:00
Dmitry Petrov
b206bf199f Add type operand symbol for type operator expression 2018-02-28 10:35:13 +03:00
Dmitry Petrov
e89047d2cc Generate super classes and overridden functions in proper scope
Such references require proper scope so that local symbols are bound.
Example:

```
fun <T> outer() {
    abstract class ALocal<S : T> {
        abstract fun bar()
    }

    class Local<S : T> : ALocal<S>() {
        override fun bar() {}
    }
}
```

Here local classes have type parameters with upper bounds depending on
function type parameters, and members overriding members in other local
classes.
2018-02-28 10:35:13 +03:00
Dmitry Petrov
8fef0f0535 Make IrDeclaration#parent a var 2018-02-28 10:35:13 +03:00
Dmitry Petrov
02f01efaac Update testData 2018-02-28 10:35:13 +03:00
Dmitry Petrov
d29a47ec7f Generate references to superclasses 2018-02-28 10:35:13 +03:00
Dmitry Petrov
e5295d0f78 Generate references to overridden declarations as a separate pass
NB currently it relies on overriddenDescriptors in a FunctionDescriptor,
thus maybe incorrect for transformed declarations.
2018-02-28 10:35:13 +03:00
Dmitry Petrov
9570b64953 Add 'parent' to IrDeclaration, initialize it with a hack (for migration) 2018-02-28 10:35:13 +03:00
Mikhail Glukhikh
24622c0139 Fix two broken tests (missing actions) 2018-02-28 10:31:27 +03:00
Mikhail Glukhikh
dd106cb65c Add braces: use CommentSaver to save/restore comments
Related to KT-16332
2018-02-27 18:25:38 +03:00
Toshiaki Kameyama
4726b44371 Add braces to 'if' statement: save/restore comments correctly
So #KT-16332 Fixed
2018-02-27 18:25:22 +03:00
Mikhail Glukhikh
b436ee6e19 Replace some of RESOLVED_CALL & REFERENCE_TARGET usages to resolveToCall 2018-02-27 18:24:55 +03:00
Anton Bannykh
a7d980a890 JS: use Mocha + NodeJs instead of Karma + PhantomJs to run stdlib tests (again) 2018-02-27 16:41:00 +03:00
Mikhail Glukhikh
a3f88165cd Make add / remove labeled return: extract 'getParentLambdaLabelName'
Related to KT-20439
2018-02-27 14:47:11 +03:00
Mikhail Glukhikh
86e6f3c5e3 Make add / remove labeled return working for hierarchical blocks
Related to KT-20439
2018-02-27 14:47:10 +03:00
shiraji
59f6dc07cf Implement intention to add labeled return to last expression in a lambda
So #KT-20439 Fixed
2018-02-27 14:47:04 +03:00
shiraji
769e28519e Implement intention to remove labeled return from last lambda expression
So #KT-20439 Fixed
2018-02-27 14:46:50 +03:00
Nicolay Mitropolsky
35ce30aedc Uast: better reports for failed method conversions in KotlinUClass 2018-02-27 11:23:04 +03:00
Nicolay Mitropolsky
795516269d Uast: don't run resolve if not inside KtFile 2018-02-27 11:22:40 +03:00
Dmitry Petrov
8fbdf52d34 Chars are not promoted to Int on comparisons 2018-02-27 10:09:17 +03:00
Dmitry Petrov
4bb6c61a5a Don't generate enum entry initializers for 'expect enum class' 2018-02-27 10:08:12 +03:00
Nikolay Krasko
4c7e46cbf8 Support prefix and suffix in Kotlin injection with comments and annotations (KT-23005)
#KT-23005 Fixed
2018-02-26 18:42:59 +03:00
Nikolay Krasko
9026582352 Minor: rename file 2018-02-26 18:42:58 +03:00
Nikolay Krasko
c5fc195754 Refactoring: move collectAllModuleInfosFromIdeaModel function 2018-02-26 18:42:58 +03:00
Nikolay Krasko
60af145170 Refactoring: move package ../caches/resolve/lightClasses -> ../caches/lightClasses 2018-02-26 18:42:58 +03:00
Nikolay Krasko
08a46c1396 Refactoring: move idea source modules classes to caches/project package 2018-02-26 18:42:58 +03:00
Nikolay Krasko
287ad512fb Refactoring: extract project structure caches to separate package 2018-02-26 18:42:57 +03:00
Nikolay Krasko
a67ae0bf9f Refactoring: remove defaults values 2018-02-26 18:42:57 +03:00
Nikolay Krasko
9b8e550f3b Refactoring: move util files 2018-02-26 18:42:57 +03:00
Nikolay Krasko
931dec9cd8 Refactoring: move MapPsiToAsmDesc.kt to lightClasses package 2018-02-26 18:42:57 +03:00
Nikolay Krasko
47f4c79204 Reformat caches package 2018-02-26 18:42:57 +03:00
Stanislav Erokhin
77b146a51a Minor. Fixed output path for builtIns generator 2018-02-26 17:58:06 +03:00
Ilya Gorbunov
0f828a5107 Update paths of the moved sources for building the documentation 2018-02-26 17:11:12 +03:00
Ilya Gorbunov
5c0cc5f799 Move deprecated kotlin-runtime and reduced runtime for tests into stdlib
Rename mock-runtime-for-test project to kotlin-stdlib:jvm-minimal-for-test
2018-02-26 17:11:11 +03:00
Ilya Gorbunov
c796e5338b Move runtime.jvm sources to stdlib/jvm/runtime
Update path in kotlin-runtime
Update path in kotlin-mock-runtime-for-tests
2018-02-26 17:11:10 +03:00
Ilya Gorbunov
00b23a0fe9 Rearrange kotlin-stdlib-js library sources
Move kotlin.* api inside kotlin directory.
Update copyright paths.
2018-02-26 17:11:08 +03:00
Simon Ogorodnik
57e47d1830 Propose convert to string template as inspection more frequent 2018-02-26 12:11:18 +03:00
Zalim Bashorov
4c15642e2c Add missed references to license/README.md 2018-02-26 12:09:28 +03:00
Nicolay Mitropolsky
be961b458d make "IDEA Ultimate" run-configuration use -P intellijUltimateEnabled 2018-02-26 11:21:38 +03:00
Pavel V. Talanov
cf6fd4da81 Completion: prevent lookup elements from being duplicated correctly
This code prevents completion items from being submitted several times for the same descriptors
But some contributors actually do contribute extra items for already processed descriptors

Fixes a problem introduced in 1796d40118
2018-02-22 20:32:54 +01:00
Pavel V. Talanov
10f6d65e03 IdeStubIndexService: do not index annotations without name
Fixes NPE after changes introduced in 8f8cbfcfa5
2018-02-22 20:29:00 +01:00
Alexey Tsvetkov
d7644559eb Perform a test lookup before build
#KT-22535 fixed
   #KT-22995 fixed
2018-02-22 18:21:37 +03:00
Alexey Tsvetkov
7c9412a0b3 Avoid instanciating LookupStorage when clearing it
#KT-22535
  #KT-22995
2018-02-22 18:21:37 +03:00
Alexey Tsvetkov
140ba0681a Throw BuildDataCorruptedException when lookup operation cannot be performed
That is expected to force a rebuild (but it does not seem to be the case
in case of parallel build).

  #KT-22535
  #KT-22995
2018-02-22 18:21:37 +03:00
Alexey Tsvetkov
8ab9366ae5 Synchronize access to lookup storage in JPS
Storage operations are synchronized already,
but BuildDataManager.getStorage is not synchronized,
so maybe it is possible to create multiple LookupStorage
instances.

    #KT-22535
    #KT-22995
2018-02-22 18:21:37 +03:00
Nicolay Mitropolsky
3a609a9472 Assertions to catch EA-114080 2018-02-22 12:51:50 +03:00
Denis Zharkov
5a591be25f Convert SwitchCodegen to Kotlin, prettify and optimize codegen 2018-02-22 11:42:18 +03:00
Natalia Selezneva
806faf86b7 Tests: allow file modification during highlighting for scripts 2018-02-22 10:00:21 +03:00
Natalia Selezneva
de76d75f03 Drop caches for synthetic files when dependencies changed 2018-02-22 10:00:15 +03:00
Natalia Selezneva
8367aea624 Run update dependencies task in background 2018-02-22 10:00:10 +03:00
Natalia Selezneva
790cf1aa58 Show notification "Gradle projects need to be imported" when build.gradle.kts file changed
^KT-19165 Fixed
2018-02-22 10:00:02 +03:00
Natalia Selezneva
63aeaf9cd5 Do not highlight kts files outside source roots if not all definitions are initialized
^KT-20521 Fixed
^KT-21420 Fixed
2018-02-22 09:59:43 +03:00
Natalia Selezneva
e62412398c Reload dependencies for kts files after Gradle Sync
^KT-21721 In Progress
2018-02-22 09:59:08 +03:00
Natalia Selezneva
af4c1ce0e9 Minor: reformat 2018-02-22 09:59:02 +03:00
Alexey Tsvetkov
7881a305d9 Compare JS output files against file instead of hardcoded set
A difference is not obvious when two sets are compared:
there might be just one different element, but
sets would be printed in one line in iteration order
(which is non-fixed for hashsets).

Also the properties:
  EXPECTED_JS_FILES_IN_OUTPUT_FOR_STDLIB_ONLY,
  EXPECTED_JS_FILES_IN_OUTPUT_FOR_MODULE_STDLIB_ONLY,
  EXPECTED_JS_FILES_IN_OUTPUT_NO_COPY,
  EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_DEFAULT_DIR,
  EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_CUSTOM_DIR
are hard to distinguish in code and are not convenient to edit.
2018-02-22 01:13:09 +03:00
Ilmir Usmanov
9fdd34ce6e Minor. Add regression test for KT-15930
#KT-15930: Obsolete
2018-02-21 19:32:50 +03:00
Ilmir Usmanov
bcf29d106d Minor. Add regression test for KT-18292
#KT-18292: Obsolete
2018-02-21 19:32:41 +03:00
Ilmir Usmanov
a0186224b2 Do not report NOTHING_TO_INLINE on suspend inline functions
#KT-22260: Fixed
2018-02-21 19:19:09 +03:00
Alexey Tsvetkov
772a935de6 Provide custom ConstantAffectionResolver in JPS
#KT-16091 fixed
2018-02-21 19:12:12 +03:00
Anton Bannykh
eabe21726c JS: improve switch elimination 2018-02-21 18:39:19 +03:00
Pavel V. Talanov
92070d132e Completion: do not force dsl members to the top if some type is expected 2018-02-21 14:44:14 +01:00
Pavel V. Talanov
1796d40118 Completion: assign highest priority to dsl members in dsl context
Use the same style as for dsl for lookup items that belong to dsl
2018-02-21 14:44:13 +01:00
Pavel V. Talanov
8f8cbfcfa5 KtAnnotationEntry#name is stubbed and is nullable 2018-02-21 14:44:09 +01:00
Pavel V. Talanov
8600add7f7 Refactor: extract utils related to DslMarker to a separate object 2018-02-21 14:44:08 +01:00
Dmitry Savvinov
d570b863ce Introduce deprecation of companion objects nested classes
Introdude deprecation as per KT-21515. Warning is reported on type
usage, that soon will became invisible. Quickfix by adding explicit
import is added.

Idea behind implementation is to mark scopes that are deprecated (see
ClassResolutionScopesSupport).

Then, during walk along hierarchy of scopes, look at deprecation status
of the scope that has provided this classifier.
Note that we also have to check if there are *some* non-deprecated
visibility paths (because we can see classifier by two paths, e.g. if
we've added explicit import) -- then this type reference shouldn't be
treated as deprecated.
2018-02-21 16:04:49 +03:00
Mikhail Glukhikh
acd8edaa9c WEAK_WARNING -> GENERIC_ERROR_OR_WARNING in three inspections
Now there inspection use configured highlight level instead of
forced weak warning: null check to safe call, reformat, sort modifiers
2018-02-21 15:59:59 +03:00
Alexey Sedunov
17e64ebae0 Move: Fix processing of callable references to nested Java classes and static methods
#KT-17827 Fixed
2018-02-21 13:21:20 +03:00
Alexey Sedunov
441f88c144 Move: Fix processing of callable references to nested Kotlin classes
#KT-17827 In Progress
2018-02-21 13:21:19 +03:00
Alexey Sedunov
bdfc814389 Move: Fix scope of internal reference recovery in the case of file move
#KT-22282 Fixed
2018-02-21 13:21:19 +03:00
Alexey Sedunov
4537192e86 Move: Check if sealed class is moved with its subclasses
#KT-22769 Fixed
2018-02-21 13:21:18 +03:00
Alexey Sedunov
27d4593fc4 Move: Fix lengthening of qualified type references
KT-14519 Fixed
2018-02-21 13:21:18 +03:00
Alexey Sedunov
1af21dd160 Move: Warn about moving public declaration to non-public class
#KT-22771 Fixed
2018-02-21 13:21:18 +03:00
Alexey Sedunov
acf6408474 Create from Usage: Fix "Create class" applicability check for when entries
#KT-22329 Fixed
2018-02-21 13:21:17 +03:00
Alexey Sedunov
0934859718 Create from Usage: Revert suggested container order for "Create Class"
#KT-22917 Fixed
2018-02-21 13:21:17 +03:00
Dmitry Jemerov
9e30ede998 Fix ISE in KotlinPairMatcher.getCodeConstructStart() 2018-02-21 10:13:08 +01:00
Yan Zhulanow
2fdadb0f5a Evaluator: Send class bytecode array in loop with a limited chunk size (#KT-22967)
JDI in Android has a limited byte buffer size (8192), and we must not exceed it.
2018-02-20 23:19:59 +03:00
Yan Zhulanow
dfc007ebd3 Use thread-safe WeakHashMap implementation in annotation-based IDE plugins (#KT-22514) 2018-02-20 23:19:35 +03:00
Mikhail Glukhikh
84993ec3a0 Resolution API: introduce and use KtElement.resolveToCall() 2018-02-20 20:25:42 +03:00
Mikhail Glukhikh
513376e5f0 Introduce KtNamedFunction.resolveToDescriptorIfAny() 2018-02-20 20:25:42 +03:00
Mikhail Glukhikh
5848bc9a44 Introduce KtClassOrObject.resolveToDescriptorIfAny() 2018-02-20 20:25:42 +03:00
Mikhail Glukhikh
bd0cbb716c Rename: analyzeWithDeclarations --> analyzeWithContent() 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
f6513cd17e Introduce resolveToParameterDescriptorIfAny(), drop reified version 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
7a1b3cd224 Introduce & use resolveToDescriptorIfAny<DescriptorType>
This allows to omit casts after resolveToDescriptorIfAny() call,
get different descriptors for different receivers (in future),
distinguish parameter / property situation for primary constructor
2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
8c97f8cbb5 Deprecate KtElement.analyzeFullyAndGetResult(), use analyzeAndGetResult 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
cd1745d354 Light classes: analyzeFully() --> analyzeWithDeclarations() 2018-02-20 20:25:41 +03:00
Mikhail Glukhikh
eabc7c9ba8 Replace some KtDeclaration.analyze() with resolveToDescriptorIfAny()
Also, enhance comment on KtElement.analyze()
2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
88b8652ed2 J2K: convert + get rid of analyzeFully (3 files) 2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
50ce8d68bf J2K: rename *.java --> *.kt (3 files) 2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
1ca1a6dddc KotlinFrameExtraVariablesProvider: add analyze / analyzeFully comment 2018-02-20 20:25:40 +03:00
Mikhail Glukhikh
135c06dc96 Android goto tests: analyzeFully --> analyze 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
c1f7303fa3 CanBePrimaryConstructorProperty: analyzeFully --> analyze 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
57d0da9843 MoveMemberOutOfCompanionObject: reformat 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
d4dbd4cd6a MoveMemberOutOfCompanionObject: analyzeFully --> analyze 2018-02-20 20:25:39 +03:00
Mikhail Glukhikh
8986b8a1a2 Introduce analyzeWithContent() & analyzeWithDeclarations()
These functions have more clear names & receivers.
Old analyzeFully() applied on KtElement made deprecated
because for general KtElement it's unclear what is "full analysis"
2018-02-20 20:25:38 +03:00
Mikhail Glukhikh
e78bd73ba3 LeakingThisInspection: add comment about analyzeFully 2018-02-20 20:25:38 +03:00
Mikhail Glukhikh
2038a5567d ResolveElementCache: remove dead branch 2018-02-20 20:25:38 +03:00
Mikhail Glukhikh
52166646bb Reformat: ResolveElementCache 2018-02-20 20:25:37 +03:00
Alexey Sedunov
ba71e732a9 Misc: Extract "KotlinSdkAdded" test to separate test case
This is needed due to application being initialized only once per test case,
while Kotlin SDK is configured during PluginStartupComponent initialization
2018-02-20 19:27:23 +03:00
gzoritchak
1c1fe10e12 Add samples for take* and drop* extensions (KT-20357)
- Add samples for take, takeLast, takeWhile, takeLastWhile
- Add samples for drop, dropLast, dropWhile, dropLastWhile
2018-02-20 19:24:27 +03:00
Mikhail Glukhikh
fda40723dc Downgrade LoopToCallChainInspection to INFORMATION level 2018-02-20 19:08:01 +03:00
Vyacheslav Gerasimov
9b4f1156d8 Generate dependencies.properties used by dokka build
was missing after migration to custom-build
2018-02-20 17:56:57 +03:00
Nikolay Krasko
d1eabb3e67 Wrap Kotlin exception filter call to read action (EA-116446)
See IDEA-186950 for details.
2018-02-20 17:36:54 +03:00
Sergey Igushkin
5901c2163f Add the expectedBy dependency to the compile configuration
Enable its propagation through transitive dependencies (including
POMs generated by Gradle)

Issue #KT-22824 Fixed
2018-02-20 17:24:22 +03:00
Sergey Igushkin
3836dcab85 Fix -Xmulti-platform dropped from args when freeCompilerArgs is assigned
in user build script

Issue #KT-15371 Fixed
2018-02-20 17:23:10 +03:00
Sergey Igushkin
37b34cff25 Allow multiple expectedBy dependencies in Gradle MPP support
Issue #KT-22864 Fixed
2018-02-20 17:23:10 +03:00
Mikhail Zarechenskiy
f23b5103ec Avoid non-null assertions for inline classes based on nullable types
Note that there are more places where assertions for inline classes should refined:
  - lateinit vars
  - values that come from Java
  - type casts (interfaces to inline class type)
2018-02-20 14:41:48 +03:00
Natalia Selezneva
e3c58eced1 Fix ConfigureKotlinInTempDirTest.testKotlinSdkAdded 2018-02-20 14:28:09 +03:00
Vyacheslav Gerasimov
b831b8ab92 Introduce intellijEnforceCommunitySdk flag to disable ultimate repo 2018-02-20 14:26:12 +03:00
Mikhail Glukhikh
02ee641daa Add CommonModuleResolveScopeEnlarger providing correct scope for commons
So #KT-22873 Fixed
So #KT-22858 Fixed
So #KT-22853 Fixed
2018-02-20 13:14:45 +03:00
Dmitry Savvinov
e071d054c9 Refactor DataFlowValueFactory implementation into several separate files 2018-02-20 13:11:33 +03:00
Dmitry Savvinov
0929673576 Refactor DataFlowValueFactory into proper component 2018-02-20 13:11:33 +03:00
Denis Zharkov
03567a1c01 Add @SinceKotlin("1.2") to kotlin.suspend 2018-02-20 11:59:39 +03:00
Mikhail Zarechenskiy
413e2d7fa1 Fix KotlinType of constructor call for inline classes 2018-02-20 11:58:18 +03:00
Mikhail Zarechenskiy
530dd01ca6 Fix unboxing values of inline class type from type parameters 2018-02-20 11:45:49 +03:00
Dmitry Petrov
99cea07bf4 Correctly map container element type in intrinsic for withIndex
In case of arrays, we couldn't distinguish array of boxed Ints
from array of primitive Ints.

 #KT-22904 Fixed Target versions 1.2.40
2018-02-20 09:18:25 +03:00
Ilya Gorbunov
2028ec3ce8 Minor improvements in all/any/none samples
Extract variables to make assertion expression shorter.
2018-02-19 18:44:28 +03:00
Yuta Sakata
4926b5a4c0 Add samples for any, all and none
Rewrite samples to make them working on sample generator

Move location of the class that contains samples of Aggregates.kt
2018-02-19 18:44:28 +03:00
Igor Chevdar
a2897a29b5 Added tests on default arguments of fake overridden functions 2018-02-19 18:39:08 +03:00
Igor Chevdar
a648b9676c Fixes in IR lowerings:
DeepCopyIrTree: typo fix.
Default arguments: made proper overridden descriptor selection.
Local declarations: made proper determination whether a function is locally defined.
2018-02-19 18:39:08 +03:00
Alexey Sedunov
aa4a5b75c7 UAST: Fall back to JVM platform if element doesn't have a module 2018-02-19 18:11:56 +03:00
Denis Zharkov
5edfc0f5cd Prohibit labeled returns inside kotlin.suspend argument lambdas
Probably, it would be more correct to skip such lambdas when resolving
the returns' references, but it'd be more complicated and still useless
since non-local returns are impossible in such lambdas
(relevant parameter is noinline)

 #KT-22900 Fixed
2018-02-19 17:30:26 +03:00
Mikhail Zarechenskiy
bc2e81a1e4 Improve message for exception about absence of common supertype
Relates to #KT-16253
2018-02-19 17:16:24 +03:00
Mikhael Bogdanov
cc4ab832b7 Properly calculate outermost parent class for sam wrapper
#KT-22906 Fixed
2018-02-19 13:29:56 +01:00
Ilya Gorbunov
6d035f1d28 Fix unresolved references to SortedSet in docs 2018-02-19 15:25:03 +03:00
Ilya Gorbunov
2eba8efb80 Do not refer to Cloneable in documentation
There's no source for Cloneable and it can't be resolved yet.
2018-02-19 15:14:25 +03:00
Nicolay Mitropolsky
bc543b4cdf LightAnnotations: wrapping all PsiLiterals (not only Strings) 2018-02-19 15:08:02 +03:00
Alexey Sedunov
99fca79bdc UAST: Do not create UElements in non-JVM modules 2018-02-19 13:01:38 +03:00
Ilya Chernikov
c9a0d7c624 Add missing reflect dependency to the gradle plugin
fixes #KT-22895
2018-02-19 10:20:17 +01:00
Denis Zharkov
cef7205f14 Fix CCE caused by KotlinPackageSourcesMemberNamesIndex
FileContentImpl::getPsiFile is not-nullable and at the same time
it contains an explicit case of its fileType to LanguageFileType
that leads to the following exception in case when kt-file is marked as plain text:

java.lang.ClassCastException: com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeFactory$1 cannot be cast to com.intellij.openapi.fileTypes.LanguageFileType
	at com.intellij.util.indexing.FileContentImpl.createFileFromText(FileContentImpl.java:135)
	at com.intellij.util.indexing.FileContentImpl.getPsiFile(FileContentImpl.java:104)

 #EA-114338 Fixed
2018-02-19 10:31:46 +03:00
gzoritchak
f790635b30 Add samples for joinTo
KT-20357
2018-02-18 20:12:05 +03:00
gzoritchak
40e3159463 Add samples for joinToString
KT-20357
2018-02-18 20:12:05 +03:00
Toshiaki Kameyama
a36e8c86f1 KT-22428 Create member function from usage shouldn't present type parameters as options (#1509)
* KT-22428 Create member function from usage shouldn't present type parameters as options

* Reformat & cleanup
2018-02-17 14:09:44 +03:00
Alexey Belkov
ea6582dd7d Minor: Fix typos and wording in NameResolution.adoc (#1523) 2018-02-17 13:51:08 +03:00
Alexander Udalov
96e33dabcf Fix JS stdlib file names in KotlinJpsBuildTest
Add "kotlin-experimental.js", "kotlin-experimental.meta.js" and refactor
surroundings
2018-02-16 17:09:34 +01:00
Mikhael Bogdanov
d732f0e160 Never delete types from inline functions during inline transformations
#KT-19399 Fixed
2018-02-16 16:48:53 +01:00
Mikhael Bogdanov
729c866f47 Code clean 2018-02-16 16:48:52 +01:00
Nicolay Mitropolsky
47f3a0ce0a Revert "Light annotations made strictly non-physical (KT-22565)"
This reverts commit cf6e21d
2018-02-16 16:24:15 +03:00
Mikhael Bogdanov
cc7bd80099 Enable multidex in android box tests 2018-02-16 14:22:04 +01:00
Mikhael Bogdanov
31c63dea50 Add jvm target 10 tests on jdk 10 2018-02-16 14:22:04 +01:00
Mikaël Peltier
2de0b2a9ef Cleaning into RedundantGotoMethodTransformer
- Use val when it is possible
- Use filterIsIstance
- Replace takeif + ?.let by an if instruction
2018-02-16 15:15:52 +03:00
Mikaël Peltier
9fb0f59813 KT-17110 Rewrite branches targeting other branches
- Rewrite branches targeting other branches to target directly the
final destination to avoid runtime performance penalties.

Fix of https://youtrack.jetbrains.com/issue/KT-17110
2018-02-16 15:15:52 +03:00
Mikhael Bogdanov
c9624ce0f9 Update gradle to 4.5.1 2018-02-16 12:31:18 +01:00
Alexey Sedunov
994d6ab4f9 Temporarily revert "UAST: Do not create UElements in non-JVM modules" 2018-02-16 14:05:16 +03:00
Nikolay Krasko
ae0bd9cc8c Additional diagnostic for incorrect stub type in Kotlin file (EA-111617) 2018-02-16 13:29:54 +03:00
Nikolay Krasko
866129984e Expression can be parenthesized on replace with if (KT-22874, EA-91186)
#KT-22874 Fixed
2018-02-16 13:29:53 +03:00
Nikolay Krasko
67183ad3b0 Fix class cast exception in KotlinFunctionParameterInfoHandler (EA-91186) 2018-02-16 13:29:50 +03:00
Nikolay Krasko
d868c01671 Disable outdate runtime check for developers builds
We can't update them properly anyway.
2018-02-16 13:29:49 +03:00
Nikolay Krasko
86dfc1ae2c Add internal action for reactivating post-open project activity 2018-02-16 13:29:48 +03:00
Nikolay Krasko
8a655b70e0 Fix isModified check in Kotlin compiler tab (KT-22851)
outputPostfix and outputPrefix is saved with nullize in apply, but
modification check was without it.

 #KT-22851 Fixed
2018-02-16 13:29:47 +03:00
Mikhail Glukhikh
6c328e7845 Fix IdeModuleInfoTests (related to KT-21771) 2018-02-16 13:15:02 +03:00
Alexey Sedunov
d5df8c60fc UAST: Do not create UElements in non-JVM modules 2018-02-15 20:37:44 +03:00
Alexander Udalov
a2835fe0d3 Do not report old runtime warnings for unstable API version
These warnings are technically correct but are too noisy and have little
value in case a user explicitly specifies unstable API version: it's
unlikely that seeing these warnings, the user will choose to rollback to
an earlier API version, since new API is probably one of the reasons
that user specified that unstable version to begin with.

So, in "kotlinc -language-version 1.3 -api-version 1.3 -cp
kotlin-stdlib-1.2.jar", we will no longer report a warning that the
attached stdlib has a version older than explicit API version (so long
as 1.3 remains unstable).

Note that we _could_ have reported these warnings in "kotlinc
-language-version 1.3 -cp kotlin-stdlib-1.2.jar", because in this case
the user might've not even be concerned with the new API in 1.3 and was
only looking for new language features. However, we still think that
it'd be unnecessary and one opt-in to the experimental world (with
LV=1.3 in this case) is enough

 #KT-22777 Fixed
2018-02-15 17:30:50 +01:00
Alexander Udalov
007248620c Disable API version inference when "-language-version" is specified
API version inference happens in
JvmRuntimeVersionsConsistencyChecker.checkCompilerClasspathConsistency
only in the case when API version is specified explicitly (with
"-api-version ..."). However, if the user specifies "-language-version
1.3", what's likely meant is "-language-version 1.3 -api-version 1.3",
and it would be unwise to infer API version to 1.2 (which is the version
of the attached stdlib) in this case.

Therefore, API version is now considered to be specified explicitly if
_either_ -language-version or -api-version is specified on the command
line

 #KT-22777 In Progress
2018-02-15 17:30:42 +01:00
Alexander Udalov
3f6aeb6dca Refactor API version inference/checking code
The behavior is not changed in this commit
2018-02-15 17:30:01 +01:00
Alexander Udalov
749773aa36 Remove -Xskip-runtime-version-check from error messages 2018-02-15 17:28:47 +01:00
Alexander Podkhalyuzin
d940546a10 Added optional dependency to Kotlin/Native Java plugin 2018-02-15 18:58:53 +03:00
Alexander Udalov
213df24644 Fix Java9ModulesIntegrationTest.testAutomaticModuleNames on Windows
Do not use '*' in the file name since it's forbidden on Windows
2018-02-15 18:48:08 +03:00
Mikhail Glukhikh
427d7fd1cc Fix compilation 2018-02-15 18:16:58 +03:00
Alexander Podkhalyuzin
898b31cb83 Merge pull request #1516 from JetBrains/always_fallback_to_hardcoded_plugin_id
Use hardcoded plugin ID when loaded in the main classloader
2018-02-15 17:03:29 +03:00
Dmitry Petrov
8bfbbe456f Use NoScopeRecordCliBindingTrace for codegen tests 2018-02-15 16:40:26 +03:00
Dmitry Petrov
10916b2046 Minor: reformat code 2018-02-15 16:40:13 +03:00
Alexander Udalov
f8424624ca Minor, check compiler output in ExperimentalIntegrationTest 2018-02-15 13:14:38 +01:00
Alexander Udalov
4a370e9dba Don't break the "API <= LV" rule in compiler tests
Stability of the language version is used for example to determine
whether the PRE_RELEASE_CLASS diagnostic should be reported. Now that
there are pre-release classes in the standard library (Experimental et
al.), we'd like to avoid this error on their usages in diagnostic tests
which are using the "!API_VERSION: 1.3" directive
2018-02-15 13:14:37 +01:00
Alexander Udalov
31e762c679 Move 1.3-specific part of stdlib to another source set 2018-02-15 13:14:37 +01:00
Mikaël Peltier
ef6b6cd261 Fix NPE into isArraySizeAccess 2018-02-15 12:41:33 +03:00
Mikaël Peltier
3c2f137fd5 Exclude tests from JS backend due to a bug into it 2018-02-15 12:41:33 +03:00
Mikaël Peltier
be07a348ea Reformat tests 2018-02-15 12:41:33 +03:00
Mikaël Peltier
8676ca34d7 KT-22334 Specialized loops using range such as integer..array.size-1
- Into PrimitiveNumberRangeLiteralRangeValue modifies how bounded
value are created by checking if the high bound range can be modified
to be exclusive instead of inclusive such as the generated code will
be optimized.
- Add black box tests checking that the specialization does not fail
on any kind of arrays.
- Add a bytecode test checking that the code is correctly optimized.

Fix of https://youtrack.jetbrains.com/issue/KT-22334
2018-02-15 12:41:33 +03:00
Ilya Gorbunov
8c8caa4707 kotlin-test: change actual package name for test annotation typealiases
to avoid potential split package situation
2018-02-14 23:50:30 +03:00
Ilya Gorbunov
dfa6fc7d48 IDEA settings: add pattern for upsource review links 2018-02-14 19:29:41 +03:00
Vyacheslav Gerasimov
6959f6af75 Exclude lib subdirs from inlellij module
When lib/rt is added to test runtime some tests break
2018-02-14 18:42:10 +03:00
Sergey Igushkin
14e9930f94 Apply shading/relocation to the subplugin example 2018-02-14 17:43:05 +03:00
Alexey Tsvetkov
1dadf84c40 Check Java interop in Maven IC tests 2018-02-14 16:31:30 +03:00
Alexey Tsvetkov
07c94a5586 Check output in Maven IC tests 2018-02-14 16:31:30 +03:00
Alexey Tsvetkov
42c433f950 Avoid removing target/classes dir during IC in Maven
#KT-21581 fixed
2018-02-14 16:31:30 +03:00
Sergey Igushkin
fa3ca0cddb Merge pull request #1517 from JetBrains/igushkin/gradle-it-readme
Update Readme.md for Gradle plugin IT
2018-02-14 16:28:04 +03:00
Sergey Igushkin
ad30e898c2 Create Readme.md 2018-02-14 16:27:11 +03:00
Sergey Igushkin
f9191ff210 Update ReadMe.md 2018-02-14 16:23:08 +03:00
Alexey Tsvetkov
67a5cab343 Fix IC test data
Test data was broken starting from 0954d1ab1b
2018-02-14 16:09:07 +03:00
Mikhail Glukhikh
3f500a1655 Add "expectedBy" to module descriptor and use it in checker
Now ExpectActualDeclarationChecker in IDE context
uses common module descriptors for relevant checks.
Compiler still uses own module instead (see comment in checker)
So #KT-21771 Fixed
2018-02-14 15:09:14 +03:00
Mikhail Glukhikh
78136fbb07 IDE facet refactoring, ModuleInfo.expectedBy introduced.
Part of facet classes was extracted to idea-analysis module
Related to KT-21771
2018-02-14 15:09:14 +03:00
Mikhail Zarechenskiy
694f5690f9 [NI] Improve diagnostic about unresolved receiver for many candidates 2018-02-14 14:58:05 +03:00
Mikhail Zarechenskiy
3afd4a2f4a [NI] Record all diagnostics from subcalls resolution results 2018-02-14 14:58:04 +03:00
Mikhail Zarechenskiy
6a7a07bf9d [NI] Don't forget to report about unresolved callable reference 2018-02-14 14:58:04 +03:00
Sergey Igushkin
a3aefac111 (minor) Fix testAndroidKaptChangingDependencies 2018-02-14 14:53:14 +03:00
Alexander Udalov
ecc441a642 Minor, remove obsolete JDK 6-related workaround 2018-02-14 12:50:16 +01:00
Alexander Udalov
60a551404a Refine modality of fake overrides inherited from abstract expected members
In an open expected class inheriting an expected interface, abstract
members are now inherited as _open_ fake overrides, not final. Final was
technically safer but also stricter and thus could be unexpected by the
user. In a final class, abstract members are still inherited as _final_
fake overrides. So, the general rule is now the following: the modality
of an expected fake override, which overrides only abstract members, in
a non-abstract class is equal to the modality of that class

 #KT-22031 Fixed
2018-02-14 12:45:45 +01:00
Sergey Igushkin
fe3ce1ec7c (minor) Fix testKaptKt15814, slightly modify temp dir path. 2018-02-14 14:43:23 +03:00
Natalia Selezneva
50c0c5a747 Throw exception when it's not possible to run evaluate expression with compilation 2018-02-14 14:40:38 +03:00
Natalia Selezneva
19e7002d02 Evaluate Expression: fix ClassNotFoundException for primitives and arrays 2018-02-14 14:40:31 +03:00
Natalia Selezneva
2f61bd41d5 Fix comparision of java versions during class loading in evaluate expression.
Do not catch EvaluateException during class loading to show more useful error to user.
^KT-22830 Fixed
2018-02-14 14:40:24 +03:00
Sergey Igushkin
3214fb8611 Fix testAnnotationProcessorAsFqName 2018-02-14 14:28:42 +03:00
Nikolay Krasko
71043821da Check idea with apiVersion instead of BUILD_NUMBER
BUILD_NUMBER is probably rewritten in tests from KotlinCoreEnvironment.
2018-02-14 13:27:10 +03:00
Nikolay Krasko
882913c773 Fix getting fields after introducing KotlinCommonCodeStyleSettings 2018-02-14 13:27:10 +03:00
Dmitry Savvinov
2f855a993e Update changelog for 1.2.30 2018-02-14 13:24:17 +03:00
Vyacheslav Karpukhin
cbb75d0bcd Use hardcoded plugin ID when loaded in the main classloader 2018-02-14 11:11:18 +01:00
Mikhail Glukhikh
d56902983e Add forgotten generated tests 2018-02-14 13:03:30 +03:00
Mikaël Peltier
8ab7e5c406 KT-10057 Use lcmp instead of Intrinsics.compare
Fix of https://youtrack.jetbrains.com/issue/KT-10057
2018-02-14 09:46:29 +01:00
Denis Zharkov
c47c1c5ffd Fix runtime CCE in case of out-projected SAM
Probably, when NI is there this fix will become unnecessary because
there will be no approximation applied, thus the value parameter
will remain Hello<#Captured> instead of Nothing

 #KT-17171 Fixed
2018-02-14 10:29:14 +03:00
Mikhail Zarechenskiy
6baf937a52 Update test files with dumped declarations for NI 2018-02-13 19:50:25 +03:00
Sergey Igushkin
6eaee8b250 Require no specific version for ExecutionStrategyIT 2018-02-13 17:43:11 +03:00
Sergey Igushkin
c3946d98f2 Update Gradle test version to 4.5.1, fix kapt1 multiversion and IC tests
that were not correctly tweaked for kapt1
2018-02-13 17:43:11 +03:00
Sergey Igushkin
d0416bea03 Use Gradle 3.5 for kapt1 IT because of the separate classes dirs bug in
kapt1.
2018-02-13 17:43:11 +03:00
Sergey Igushkin
b5195d36bc Use Gradle 3.4 for testCleanBuildLib because of classpath normalization 2018-02-13 17:43:11 +03:00
Sergey Igushkin
6e51ada36b Override system-wide cache, simplify version checks, 2018-02-13 17:43:11 +03:00
Sergey Igushkin
99e731f6a6 Transform the new tests after rebase; Fix issues from KOTLIN-CR-1546 2018-02-13 17:43:10 +03:00
Sergey Igushkin
f9dc892c42 Do not stop Gradle daemons with the same version as that of the build. 2018-02-13 17:43:10 +03:00
Sergey Igushkin
a223870e7a Exclude JPS tests from normal run. Log Gradle version when advancing it. 2018-02-13 17:43:10 +03:00
Sergey Igushkin
ae1ef06de2 Fix a few tests failing due to Gradle version change. 2018-02-13 17:43:10 +03:00
Sergey Igushkin
ced5bf6e2c Fix getOutputForTask for newer Gradle versions 2018-02-13 17:43:10 +03:00
Sergey Igushkin
c394b50cb8 Implement logic for classes directories in Gradle IT across versions.
Also add a workaround for console type set in user's gradle.properties.
2018-02-13 17:43:10 +03:00
Sergey Igushkin
5905b23bf9 Change existing literal Gradle versions to GradleVersionRequirement
Also add workaround for kotlin-test-common not seen in the IDE
2018-02-13 17:43:09 +03:00
Sergey Igushkin
5bd52311dc Introduce GradleVersionRequirement and logic for version for each test 2018-02-13 17:43:09 +03:00
Alexander Udalov
fd52deb9c1 Remove unneeded dependencies of module 'generators'
Previously, the classpath of this module was used to run all tests in
the project. This is why it depended on almost all modules in the
project. Now, in the Gradle build, these dependencies are no longer
needed
2018-02-13 15:42:16 +01:00
Mikhail Zarechenskiy
c4cfd07fe9 [NI] Fix infinite completion of arguments in AllCandidates mode
See AutoImports#testFactoryFunctionFromLambda for example
2018-02-13 15:06:34 +03:00
Mikhail Zarechenskiy
e017e9cb5f Support passing inline class values with spread operator 2018-02-13 13:16:45 +03:00
Mikhail Zarechenskiy
3919dc94e1 Box values of inline class types when passing to function as varargs 2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
6687751cf5 Generate as check for inline classes using wrapper
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
a88dbefcd9 Generate is check for inline classes same as for primitives
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
d606e5bc89 Correct boxing for functional types containing inline classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy
a8a9f774d0 Map inline classes in generic argument position to theirs wrap classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy
1d16d21dbb Fix boxing for non-local and labeled returns with inline classes 2018-02-13 13:16:42 +03:00
Mikhail Zarechenskiy
80dd5c106e Propagate KotlinType through call generator, fix boxing on arguments 2018-02-13 13:16:42 +03:00
Mikhail Zarechenskiy
22b9c25dd0 Add KotlinType info about this inside inline class 2018-02-13 13:16:41 +03:00
Mikhail Zarechenskiy
c86d3e354b Skip call to the underlying value of inline class 2018-02-13 13:16:41 +03:00
Mikhail Zarechenskiy
2c279978c8 Fix generation of property accessor to the underlying value 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
ce601bebbe Fix detection of erased this for inline class 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
b361d0e9c0 Add test and check that iterator over UInt folds to a simple for-loop 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
059f1e9eed Support inline classes working with collection elements (get/set) 2018-02-13 13:16:39 +03:00
Mikhail Zarechenskiy
8015295059 Desugar constructor call of inline class to the underlying value
Also add information about KotlinType to the constant stack values
2018-02-13 13:16:39 +03:00
Mikhail Zarechenskiy
6320368609 Add KotlinType to the Coercion stack value 2018-02-13 13:16:38 +03:00
Toshiaki Kameyama
e35ec8ee08 Introduce intention 'expr.unsafeCast<Type>()' <- -> 'expr as Type'
So #KT-16382 Fixed
2018-02-13 13:05:52 +03:00
Mikhail Glukhikh
085c7d30ed Specify expl. lambda signature: derive from offset independent intention
Related to KT-22492
2018-02-13 12:28:56 +03:00
Toshiaki Kameyama
5499078fcc Make "Specify explicit lambda signature" available on whole lambda
So #KT-22492 Fixed
2018-02-13 12:28:50 +03:00
Toshiaki Kameyama
059a797e10 Don't report redundant semicolon for a call before lambda expression
So #KT-22719 Fixed
2018-02-13 11:52:04 +03:00
Toshiaki Kameyama
f9555f3f64 Join with assignment: remove comment from target range #KT-22110 Fixed 2018-02-13 11:45:31 +03:00
Dmitry Petrov
36128ba66f Don't generate primary constructor body for expect classes 2018-02-13 10:09:28 +03:00
Dmitry Petrov
839ebba157 ProperNumberComparisons is disabled by default (until LDC decision) 2018-02-13 09:26:00 +03:00
Dmitry Petrov
af79bbd247 Minor: reformat code 2018-02-13 09:25:40 +03:00
Dmitry Petrov
a790195808 Implement "proper numeric comparisons" support in JVM BE 2018-02-13 09:25:40 +03:00
Dmitry Petrov
e23a48e8d0 Minor: reformat code 2018-02-13 09:25:40 +03:00
Nikita Skvortsov
b1419e2a8c fix import of expectedBy scope dependencies inside composite builds 2018-02-12 19:29:12 +03:00
Pavel V. Talanov
8ac7f0b592 Minor: remove error marker from commented out test code 2018-02-12 16:46:16 +01:00
Pavel V. Talanov
fd4e262b1f Minor: modify test for KT-22819 to unmute it on teamcity
#KT-22819 Open
2018-02-12 16:35:56 +01:00
Pavel V. Talanov
9e69c73387 Minor: comment out test for KT-22594 to unmute it on teamcity
#KT-22594 Open
2018-02-12 16:35:51 +01:00
Vyacheslav Karpukhin
53946456cf Do not use hardcoded plugin ID for update checks
When Kotlin plugin is bundled into another plugin, there won't be a plugin with ID org.jetbrains.kotlin registered in PluginManager, which leads to runtime exceptions. To fix that let's determine the plugin ID dynamically instead.
2018-02-12 17:33:54 +03:00
Nikolay Krasko
f5e78a89bc Collect statistics of used defaults set in formatting (KT-22252)
^KT-22252 In Progress
2018-02-12 17:33:54 +03:00
Anton Bannykh
cd3a797f2a JS: fix corner case in when translation (fix crash in KT-22544) 2018-02-12 17:15:48 +03:00
Alexey Sedunov
b315e0c113 Gradle: Fix dependency import when "module per sourceset" is disabled
#KT-22360 Fixed
2018-02-12 15:10:19 +03:00
Alexey Sedunov
e1aec46300 Configuration: Set up Kotlin SDK (if necessary) on plugin startup
#KT-22590 Fixed
2018-02-12 15:10:16 +03:00
Ilya Gorbunov
99fd66137c Update the instruction how to run the stdlib generator
Use relative paths in urls
2018-02-12 14:32:51 +03:00
Yanis Batura
9c8c1cdc18 Fix a couple of typos in docs and ReadMe
* Fix a couple of typos
- In the main ReadMe.md
- In onEach template's doc

* Update generated source code
2018-02-12 14:22:47 +03:00
Simon Ogorodnik
470a4bb615 Fix Missing documentation inspection for primary ctor properties
#KT-20954 fixed
#KT-21005 fixed
2018-02-12 13:41:50 +03:00
Ilya Gorbunov
0f130a0a5a Add documentation for kotlin-test-testng artifact 2018-02-12 08:11:23 +03:00
Ilya Gorbunov
5e3edf4bd7 Select the asserter based on test framework presence in classpath
Simplify asserter lookup: enumerate all AsserterContributors when
the file class with lookupAsserter function is initialized.

It's assumed that AsserterContributor initialization should be fast.

#KT-21154 Fixed
2018-02-12 07:59:54 +03:00
Ilya Gorbunov
9dfa54eb62 Include kotlin-test-testng into dist, setup JDK 7 required to run tests 2018-02-12 07:58:29 +03:00
Ilya Gorbunov
d1f00a95e0 Minor: kotlin-test reformat sources, fix test package names 2018-02-12 07:58:28 +03:00
Valeriy Zhirnov
ad7701922c TestNG support in kotlin.test #KT-22620 2018-02-12 07:58:21 +03:00
Nikolay Krasko
1e567438a2 Store selected set of defaults in code style settings (KT-22252)
#KT-22252 In Progress
2018-02-11 16:50:20 +03:00
Nikolay Krasko
5d25b8b476 Control serialize/deserialize of CommonCodeStyleSettings 2018-02-11 16:50:19 +03:00
Mikhail Zarechenskiy
9e22761262 Fix type parameters indexes of MockClassDescriptor
Exception was thrown during mapping of arguments to parameters in `computeSupertypeProjections`

 #KT-18522 Fixed
2018-02-11 16:21:23 +03:00
Yan Zhulanow
310ee67c35 REPL, minor: Ignore empty lines (#KT-21611) 2018-02-09 19:24:57 +03:00
Yan Zhulanow
edcf0aef53 Kapt: Allow Kotlin @Repeatable annotations (KT-22451)
We don't generate a wrapper for repeatable annotations, and Javac complains to it.
2018-02-09 19:11:03 +03:00
Vyacheslav Gerasimov
a3a46fe259 Fix test runtime and set idea.home.path for sam with receiver plugin 2018-02-09 15:04:30 +03:00
Dmitry Petrov
5a85bf36a5 Check for type parameter supertypes in primitive numeric comparisons 2018-02-09 14:41:54 +03:00
Alexey Sedunov
e5e583e3e5 Configuration: Show Koltin plugin path as "home path" of Kotlin SDK
#KT-22640 Fixed
2018-02-09 14:17:40 +03:00
Alexey Sedunov
84fed8071c Create from Usage: Support target directory selection for "Create class"
#KT-22152 Fixed
2018-02-09 14:17:40 +03:00
Alexey Sedunov
695a2a4098 Rename: Support retargeting/shadowing conflict checking for functions
#KT-22564 Fixed
2018-02-09 14:17:40 +03:00
Alexey Sedunov
5c6bba9f14 Rename: Fix qualified expression replacement for the case 'invoke' <-> 'get'
#KT-22705 Fixed
2018-02-09 14:17:39 +03:00
Alexey Sedunov
fffd74f002 Refactor: Move canMoveLambdaOutsideParentheses() function to idea-core module 2018-02-09 14:17:39 +03:00
Alexey Sedunov
48705865bd J2K: KtArrayAccessReference 2018-02-09 14:17:38 +03:00
Alexey Sedunov
9150322bed J2K: KtArrayAccessReference (rename to .kt) 2018-02-09 14:17:38 +03:00
Alexey Sedunov
e88f1467eb Rename: Add quotes to declaration name if necessary
#KT-22708 Fixed
2018-02-09 14:17:38 +03:00
Alexey Sedunov
428b086458 Refactor: Move 'isIdentifier' and 'quoteIfNeeded' functions to frontend 2018-02-09 14:17:37 +03:00
Alexey Sedunov
fddfbf225f Change Signature: Support implicit calls of 'invoke' and 'get'
Also drop 'operator' keyword when necessary

 #KT-22718 Fixed
2018-02-09 14:17:37 +03:00
Ilya Chernikov
e38d5395df Pass previous dependencies to the legacy script dependency resolvers
fixes #KT-22753
2018-02-09 11:03:43 +01:00
Dmitry Jemerov
3aaad0c21d Indent default parameter values
#KT-22508 Fixed
2018-02-09 10:49:02 +01:00
Dmitry Jemerov
5bb195df9b No space between label and lambda in labeled expressions
#KT-22301 Fixed
2018-02-09 10:49:01 +01:00
Dmitry Jemerov
8f9b818e43 Do not indent closing bracket of array access expression
#KT-22641 Fixed
2018-02-09 10:49:00 +01:00
Dmitry Jemerov
36f5525b12 Call chain indentation logic that actually makes sense
#KT-22346 Fixed
2018-02-09 10:48:51 +01:00
Dmitry Jemerov
2c88b26034 Group all call chain-related tests in a single directory 2018-02-09 10:48:48 +01:00
Mikhael Bogdanov
d7e5eb24ee Update android test dependencies 2018-02-09 09:45:14 +01:00
Mikhael Bogdanov
b666a2da5f Increase android test timeout 2018-02-09 09:45:13 +01:00
Denis Zharkov
f6c6f67566 Minor. Remove irrelevant JAVAC_EXPECTED_FILE directive in tests
This change fixes these tests
2018-02-09 10:54:28 +03:00
Rodrigo B. de Oliveira
de57951b58 Make Kotlin Idea plugin aware of the Gradle initscript template
See gradle/kotlin-dsl#662
2018-02-09 08:32:14 +01:00
Mikaël Peltier
e1f44d6237 Move tests to the right place 2018-02-09 09:10:53 +03:00
Mikaël Peltier
9274241c0e KT-22714 Avoid to generate unecessary checkcast
- StackValue already avoid to generate checkcast from a type or an
array to java.lang.Object. Add a new case to avoid to generate a
checkcast from an array to an array of java.lang.Object when arrays
have the same dimensions.

Fix of https://youtrack.jetbrains.com/issue/KT-22714
2018-02-09 09:10:53 +03:00
Mikhail Zarechenskiy
0ecb3afdf7 Refactoring: rename AsmTypeAndKotlinType -> JvmKotlinType 2018-02-09 05:06:34 +03:00
Mikhail Zarechenskiy
913e4b42bb Support inline classes as last expression in lambda 2018-02-09 05:06:32 +03:00
Mikhail Zarechenskiy
396cc7d02b Support unboxing of inline classes in elvis 2018-02-09 05:06:31 +03:00
Mikhail Zarechenskiy
fefcddc803 Support boxing/unboxing for captured vars of inline class types 2018-02-09 05:06:29 +03:00
Mikhail Zarechenskiy
9f24bbd980 Support unboxing of inline classes after assertion operator 2018-02-09 05:06:27 +03:00
Mikhail Zarechenskiy
30c79ffadc Support generating computable properties inside inline classes 2018-02-09 04:57:20 +03:00
Mikhail Zarechenskiy
47aeeb36e4 Get accessors for companion object properties through wrapper class 2018-02-09 04:56:46 +03:00
Mikhail Zarechenskiy
70cd1cfcdf Fix generation of companion object inside inline classes 2018-02-09 04:56:45 +03:00
Mikhail Zarechenskiy
e1d3b21201 Skip bridge methods generation for inline classes 2018-02-09 04:56:43 +03:00
Mikhail Zarechenskiy
4eb64fb4b9 Support mapping for inline classes based on type variables 2018-02-09 04:56:41 +03:00
Mikhail Zarechenskiy
0fd80ce980 Unbox inline classes after safe calls if needed 2018-02-09 04:56:40 +03:00
Mikhail Zarechenskiy
c5c8d84719 Support boxing/unboxing for method return types 2018-02-09 04:56:36 +03:00
Mikhail Zarechenskiy
390c214943 Support boxing for inline classes on function calls 2018-02-09 04:56:08 +03:00
Mikhail Zarechenskiy
0d682879f5 Initial boxing for inline classes: local variable assignments 2018-02-09 04:55:44 +03:00
Mikhail Zarechenskiy
b0ee61620c Add KotlinType to methods coerceTo & coerceFrom 2018-02-09 02:08:11 +03:00
Mikhail Zarechenskiy
1ac4e9755a Generate synthetic unbox method for each wrapper of inline class 2018-02-09 02:08:11 +03:00
Mikhail Zarechenskiy
a59917b6f8 Generate synthetic box method for each erased inline class 2018-02-09 02:08:10 +03:00
Mikhail Zarechenskiy
f856455841 Introduce stateless methods to map types without predefined mapping 2018-02-09 02:08:10 +03:00
Mikhail Zarechenskiy
1cdad65b9b Refactoring: propagate KotlinType through hierarchy of StackValue
Mainly, this is needed to introduce boxing over inline classes
2018-02-09 02:08:10 +03:00
Mikhail Zarechenskiy
9d05fac771 Don't generate backing field for erased inline class 2018-02-09 02:08:09 +03:00
Mikhail Zarechenskiy
b08a32af2f Fix local variables table for inline classes 2018-02-09 02:08:09 +03:00
Cuihtlauac ALVARADO
35c454f53f Filter out "Picked Up" messages from stderr
KT-22340 Fixed
2018-02-08 18:48:25 +01:00
Yan Zhulanow
46c2adda4e REPL: Fix crash on trying to :load with incorrect filename (KT-12037)
(cherry picked from commit 0238575a36)
2018-02-08 20:44:15 +03:00
Yan Zhulanow
a25e93d82a Debugger: (EA-112731) Do not crash miserably if we don't know the anonymous class name
Continue to log the exception, avoid breaking UX
2018-02-08 19:36:38 +03:00
Yan Zhulanow
2a3bab0a0f Kapt: Register additional source directories without modifying the raw Gradle model
Unfortunately, this works only for the newer Android Studio versions, so we need to keep the old code until IDEA will migrate at least to AS 3.1.
2018-02-08 19:36:38 +03:00
Yan Zhulanow
6c4a2db34b Kapt: Enums inside enum values should be forbidden (KT-22582) 2018-02-08 19:36:38 +03:00
Yan Zhulanow
510d5ece0f Android Extensions: Support '.', '-' and ':' in View identifiers (KT-22700) 2018-02-08 19:36:37 +03:00
Yan Zhulanow
ba61a93dc7 Kapt: Forbid using the deprecated (original) kapt 2018-02-08 19:36:37 +03:00
Yan Zhulanow
bdd7ab3a09 Kapt: Mute Java 9 tests temporarily on Windows 2018-02-08 19:36:37 +03:00
Yan Zhulanow
03a20384ef Uast: Fix an exception while converting type alias KotlinType to PsiType (KT-21874) 2018-02-08 19:36:37 +03:00
Yan Zhulanow
1cc4744345 Kapt: Map URLs to absolute file paths properly, also add some logging 2018-02-08 19:36:37 +03:00
Ilmir Usmanov
87bbac9d43 Take coroutineContext into account in RedundantSuspendModifierInspection
#KT-22651: Fixed
2018-02-08 19:34:20 +03:00
Alexander Udalov
e19ed1e001 Add test on experimental const val in annotation argument
This test checks that a usage inside an annotation argument is a
signature usage, which may be too restricting but easier to support at
the moment (and the restriction can be lifted in the future)
2018-02-08 17:08:34 +01:00
Alexander Udalov
a4af9dd5d1 Always consider container's experimentality in ExperimentalUsageChecker
This results in more diagnostics usually, but allows library authors to
avoid annotating everything in each experimental class with the marker
(only the class needs to be annotated now)

 #KT-22759
2018-02-08 17:08:34 +01:00
Alexander Udalov
7123202670 Add getExtensionOrNull utility for protobuf messages 2018-02-08 17:08:33 +01:00
Alexander Udalov
65a6171782 Add test on Experimental in scripts 2018-02-08 17:08:33 +01:00
Alexander Udalov
21e2a3c0b4 Load module annotations in IDE
#KT-22759 Fixed
2018-02-08 17:08:33 +01:00
Alexander Udalov
890374a42a Load module annotations for JVM and JS modules in compiler
#KT-22759 In Progress
2018-02-08 17:08:33 +01:00
Alexander Udalov
396a5ab352 JS: write/read module annotation FQ names to/from metadata
#KT-22759 In Progress
2018-02-08 17:07:23 +01:00
Alexander Udalov
ff33e0bad3 Write/read module annotation FQ names to/from metadata on JVM
#KT-22759 In Progress
2018-02-08 17:07:23 +01:00
Alexander Udalov
b4ac852392 Add packageProto/nameResolver to JvmPackagePartSource
May be useful for loading platform-specific protobuf extensions (such as
package_module_name on JVM) when analyzing deserialized top level
members
2018-02-08 17:07:22 +01:00
Alexander Udalov
ec6b49b8b8 Check experimental API markers for deprecation
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
5e78adb501 Support -Xexperimental/-Xuse-experimental in ExperimentalUsageChecker
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
77625831f7 Support -Xexperimental and -Xuse-experimental, validate their values
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
153c86c069 Report diagnostic on overrides of experimental members
Unless they're experimental themselves

 #KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
29c35e6686 Do not require experimental propagation for body usages in same module
Unless it's a usage inside the body of an effectively public inline
function

 #KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
6d4e8f3781 Add some validation for Experimental/UseExperimental usages
#KT-22759 In Progress
2018-02-08 17:07:22 +01:00
Alexander Udalov
0bf0a315ed Introduce Experimental and UseExperimental annotations
#KT-22759 In Progress
2018-02-08 17:07:21 +01:00
Simon Ogorodnik
366f630236 Fix J2K ObjectLiteral.testMyFrame by updating incorrect testData 2018-02-08 19:01:13 +03:00
Mikaël Peltier
126afbb8ac Avoid to generate unecessary checkcast
StackValue already avoid to generate checkcast from a type or an
 array to java.lang.Object. Add a new case to avoid to generate a
 checkcast from an array to an array of java.lang.Object when arrays
 have the same dimensions.

 #KT-22714 Fixed
2018-02-08 16:38:46 +01:00
Denis Zharkov
9a9452f73a Add @RequireKotlin(1.2.30) for kotlin.suspend
#KT-22562 Fixed
2018-02-08 17:47:37 +03:00
Alexander Udalov
b6a55f74f4 Support patch versions in RequireKotlin with kind=COMPILER_VERSION 2018-02-08 17:47:37 +03:00
Denis Zharkov
72222c718a Highlight callees resolved to kotlin.suspend as a keywords
#KT-22562 In Progress
2018-02-08 17:47:37 +03:00
Denis Zharkov
99c7d8d4d5 Add call checks related to suspend lambda modifier's introduction
- Prohibit non-modifier-like calls on kotlin.suspend
- Add warning on modifier-like calls to anything but kotlin.suspend

 #KT-22766 In Progress
 #KT-22562 In Progress
2018-02-08 17:47:37 +03:00
Denis Zharkov
ef01f641f3 Imitate support for suspend modifier on parameterless lambdas
#KT-22766 In Progress
2018-02-08 17:47:37 +03:00
Denis Zharkov
5c81d9fd6b Minor. Make function private 2018-02-08 17:47:37 +03:00
Denis Zharkov
342a532416 Minor. Inline parameters 2018-02-08 17:47:37 +03:00
Pavel V. Talanov
229184dd78 Dsl line marker: provide simple tooltip
Test dsl line marker
2018-02-08 15:36:42 +01:00
Pavel V. Talanov
519ea12bb2 Test, dsl highlighter: test custom highlighting applied to calls 2018-02-08 15:36:41 +01:00
Mikhail Glukhikh
d554a4234d Redundant object type check: fix problem highlighting #KT-22484 Fixed 2018-02-08 17:10:44 +03:00
Mikhail Glukhikh
901ae087bc Redundant object type check: use referential equality, forbid for when
So #KT-22538 Fixed
2018-02-08 17:10:43 +03:00
Mikhail Glukhikh
fbe6929903 Reformat: RedundantObjectTypeCheckInspection 2018-02-08 17:10:41 +03:00
Mikhail Glukhikh
c715387773 Reformat & cleanup: KotlinGradleSourceSetDataService 2018-02-08 17:10:40 +03:00
Mikhail Glukhikh
198b054a6f Detect library kind in Gradle if name looks like non-JVM
Related to KT-20971
2018-02-08 17:10:39 +03:00
Mikhail Glukhikh
dcbb29e947 Search for source of platform binary also in common sources
So #KT-20971 Fixed
2018-02-08 17:10:37 +03:00
Mikhail Glukhikh
76976f7e52 SourceNavigationHelper: reformat + style fix 2018-02-08 17:10:36 +03:00
Alexander Udalov
80a7f92309 Extract logic to get function parameters for default value generation
For some reason, this logic was a bit different in JVM (FunctionCodegen)
and JS (FunctionBodyTranslator). For example, in JS the
EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND diagnostic was
reported even in the case when no expected function was found for the
actual function at all, which made it quite difficult to write
multiplatform sources for JS stdlib where it both should be compiled as
a part of the multiplatform project, and by itself (suppressing
NO_ACTUAL_FOR_EXPECT): in the latter case, the new error must have been
suppressed everywhere as well

 #KT-21913
2018-02-08 14:14:10 +01:00
Alexander Udalov
97314d010d Serialize default argument values presence for actual declarations correctly
When default argument value was present in the expected declaration, we
did not correctly serialize that fact to the metadata for the actual
declaration (`declaresDefaultValue` was used). Therefore, it was
impossible to use that actual declaration without passing all parameter
values in another module, where it was seen as a deserialized descriptor

 #KT-21913
2018-02-08 14:11:57 +01:00
Alexander Udalov
22595acbfd Fix AssertionError on overloading function with property in actual class
#KT-22352 Fixed
2018-02-08 14:11:56 +01:00
Alexander Udalov
56be83cdd3 Improve fake override construction for expected classes
Fake overrides for abstract members from expected classes should become
non-abstract (final, in fact) in non-abstract expected subclasses

 #KT-22031 Fixed
2018-02-08 14:11:55 +01:00
Denis Zharkov
88a23c73c7 Ignore @Nullable annotation for vararg parameter
See the comment in code for clarification

 #KT-19786 Fixed
2018-02-08 13:36:10 +03:00
Denis Zharkov
cfd612e2c1 Minor. Reformat signatureEnhancement.kt 2018-02-08 13:36:10 +03:00
Mikhail Glukhikh
8edf8b9e4d MemberInfoUtils: when no facade is available, use resolutionApi methods 2018-02-08 13:03:41 +03:00
Mikhail Glukhikh
8b8cb0abba KotlinRunConfigurationProducer: get rid of resolve via facade 2018-02-08 13:03:40 +03:00
Denis Zharkov
2ad93a0330 Use extension registry when unpacking serialized type alias
It's funny here that "extension" here means protobuf extensions
while initial issue is about extension function types

 #Fixed KT-22728
2018-02-08 12:39:26 +03:00
Denis Zharkov
fbef21bf17 Remove setting usePreciseJavaTracking in gradle.properties
It's already true by default since 9b28d1a21c
2018-02-08 12:38:19 +03:00
Alexander Udalov
bb013ec2bf Update bootstrap to 1.2.40-dev-165 2018-02-08 10:15:30 +01:00
Mikhael Bogdanov
0954d1ab1b Don't generate hash in sam wrapper class name
#KT-17091 Fixed
2018-02-08 10:11:48 +01:00
Alexander Udalov
ba5cc65792 Rename JvmPackageTable -> JvmModuleProtoBuf, PackageTable -> Module
This protobuf message is going to contain more information about the
module than just the table of package parts
2018-02-07 17:25:43 +01:00
Mikhael Bogdanov
5d6d1bf182 Explicitly specify 'idea.home.path' in android tests 2018-02-07 15:33:54 +01:00
Dmitry Petrov
5678b3d52a Handle nullable case in '==' with smart cast using safe call 2018-02-07 14:30:59 +03:00
Dmitry Petrov
00325ae539 Handle equality checks for 'when' and data classes 2018-02-07 14:30:59 +03:00
Dmitry Petrov
299eb24ca9 Minor: simplify OperatorExpressionGenerator#invokeConversionFunction 2018-02-07 14:30:59 +03:00
Dmitry Petrov
22d59bb709 Minor: include descriptor itself in exception from DependenciesCollector 2018-02-07 14:30:59 +03:00
Dmitry Petrov
4776535205 Implement IR primitives for number comparisons in JVM BE 2018-02-07 14:30:59 +03:00
Dmitry Petrov
bf18186045 More precise implicit cast generation
If an expression 'x' has a definitely non-null type 'T1',
and is used in position with an expected type 'T2',
cast 'x' to 'T2!!' (most common non-null type T*: T* <: T2).
2018-02-07 14:30:59 +03:00
Dmitry Petrov
9137e68d4e Implement special desugaring for numeric comparisons in PSI2IR
This introduces the following IR built-in functions required for proper
implementation of the number comparisons:

- ieee754Equals(T, T): Boolean,
    for each T in {Float?, Double?}

- less(T, T): Boolean
  lessOrEqual(T, T): Boolean
  greater(T, T): Boolean
  greaterOrEqual(T, T): Boolean
    for each T in {Int, Long, Float, Double}
2018-02-07 14:30:59 +03:00
Dmitry Petrov
f4ed4ec9d9 Distinguish numeric comparisons in FE, store info in BindingContext
When we an equality or comparison operator expression
with both arguments "statically known to be of primitive numeric types"
(that is, either inferred type T for an operand is a primitive numeric
type, or a smart cast to a primitive numeric type T is possible in the
corresponding context), comparisons should be performed on primitive
numbers with corresponding widening conversions.

This differs from default 'equals' and 'compareTo' implementations in
case of floating-point numbers: for Float and Double, IEEE 754
comparisons are used instead of total order implemented by j.l.Float and
j.l.Double.

Examples:

fun ex1(x: Double, y: Double) = x < y
-- will use IEEE 754 comparison for Double, because
   both 'x' and 'y' have type Double

fun ex2(x: Double, y: Any) = y is Double && x < y
-- will use IEEE 754 comparison for Double, because
   smart cast to Double is possible for 'y'

fun ex3(x: Comparable<Double>, y: Double) = x is Double && x < y
-- will use IEEE 754 comparison for Double, because
   smart cast to Double is possible for 'x',
   even though corresponding operator convention is resolved to
   'Comparable<Double>#compareTo(Double)' (which would use total order)

fun ex4(x: Any, y: Any) = x is Double && y is Int && x < y
-- will use IEEE 754 comparison for Double with 'y' promoted to Double,
   because smart cast to Double is possible for 'x',
   and smart cast to Int is possible for 'y',
   and least common primitive numeric type for Double and Int is Double.
2018-02-07 14:30:59 +03:00
Alexey Sedunov
930e51e30e Misc: Update test data due to changes in 'actual' constructor checking
Now actual class constructor is considered an implementation
only if it has 'actual' modifier itself
2018-02-07 14:13:16 +03:00
Nicolay Mitropolsky
91a4bbed2e Uast: KotlinUNestedAnnotation with light annotation (IDEA-185890) 2018-02-07 10:17:40 +03:00
Nicolay Mitropolsky
cb05baa02b LightAnnotations: wrapping nested annotations with KtLightAnnotationForSourceEntry 2018-02-07 10:17:40 +03:00
Nicolay Mitropolsky
48ea52def1 Uast: KotlinUNestedAnnotation for processing nested annotations (IDEA-185890) 2018-02-07 10:17:40 +03:00
Yan Zhulanow
1f81c0cdfe Kapt: Fix compilation errors when the referenced class has '$' in the beginning of its name (KT-22493) 2018-02-06 22:16:01 +03:00
Yan Zhulanow
5fc9c5671c Kapt: Escape nested comments in doc comments (KT-22469) 2018-02-06 22:16:01 +03:00
Yan Zhulanow
abda4bfb57 Kapt: Remove comments inside enum values (KT-22350) 2018-02-06 22:16:01 +03:00
Yan Zhulanow
a171874b2f Fix "Illegal Android Identifier" inspection reports non-instrumentation unit tests (KT-22168) 2018-02-06 22:16:00 +03:00
Yan Zhulanow
4e8969e1c2 Kapt: Fix array of anonymous type handling (KT-22468) 2018-02-06 22:16:00 +03:00
Yan Zhulanow
144ec9285f Minor: Get rid of duplicating option descriptions in Kapt plugin 2018-02-06 22:16:00 +03:00
Yan Zhulanow
e38a41d2f2 Evaluate: Fix compiling evaluator issues led to improper expression caching
1. Do not save a ClassLoader reference inside the context, as we don't use it anyway after evaluation.
This is to avoid custom ClassLoader nesting.

2. Do not use 'findClass()' as it caches the loaded classes and always returns the first evaluated class if it's in cache.
2018-02-06 22:16:00 +03:00
Yan Zhulanow
da74bcbcc0 Evaluate: Support dex in newer Android build tools 2018-02-06 22:16:00 +03:00
Yan Zhulanow
7c7c929b0e Kapt: Disable location mapping by default, allow to enable it manually 2018-02-06 22:16:00 +03:00
Yan Zhulanow
5668a7af92 Kapt: Replace original Javac diagnostic messages with those with Kotlin location mapped
There is no Messages dialog in newer versions of IDEA/Android Studio in which the error messages were mapped before. The new Build window shows only the original locations, so now we need to replace Java file diagnostics with ones mapped to Kotlin source files.

The side effect is that diagnostics on the same locations are automatically merged.
2018-02-06 22:16:00 +03:00
Yan Zhulanow
b0e97de8a8 Kapt: Move line metadata to .kaptMetadata external files (KT-22386)
Placing location table inside .java file triggers annotation processor to run on each line table modification (even when the stub declarations themselves are the same). So we move it to the separate file.
2018-02-06 22:16:00 +03:00
Yan Zhulanow
bf9eed931b Parcelable: Fix 'Simple' test (new boolean serializer) 2018-02-06 22:15:59 +03:00
Yan Zhulanow
145ddf3b1f Parcelable: Add CREATOR field (and other generated declarations) in light classes (KT-19300, KT-19853) 2018-02-06 22:15:59 +03:00
Ilya Gorbunov
90dff281ba Actualize ReadMe files
- Actualize build requirements and steps
- Extract Gradle plugin readme to the corresponding folder
- Rewrite Libraries and Maven Tools readme

#KT-20995 Fixed
2018-02-06 21:17:58 +03:00
Ilya Gorbunov
aa74f163f7 Minor: improve table formatting 2018-02-06 21:17:57 +03:00
Ilmir Usmanov
ad385f42a9 Fix continuaion retrieval on generated coroutineContext intrinsic code
Use fake continuation instead on real one in JVM BE.
Pass continuation parameter to closure generator in JS BE.

 #KT-22577: Fixed
2018-02-06 21:14:37 +03:00
Sergey Igushkin
e8cd8b566e Delay kapt dependencies resolution from configuration phase
Store kapt configurations instead of classpath files in the tasks
Delay wrapping kapt subplugin options to task execution (when the
classpath can be safely resovled)

Issue #KT-18821 Fixed
2018-02-06 21:01:57 +03:00
Nicolay Mitropolsky
8ac95b54a2 Uast: support for Kotlin array literals 2018-02-06 17:53:17 +03:00
Alexey Sedunov
358bc62fc1 Minor: Regenerate tests 2018-02-06 17:06:03 +03:00
Alexander Udalov
12e31cedfd Write lambdaClassOriginName for lambdas copied during inline
Similarly to anonymousObjectOriginName which is written for copied
anonymous objects

 #KT-21320
2018-02-06 13:05:22 +01:00
Alexander Udalov
6da3f37fc3 Write anonymousObjectOriginName for classes copied during inline
#KT-21320
2018-02-06 13:05:22 +01:00
Mikhail Glukhikh
81122ed236 Fix a pack of broken IDE action tests
Related to KT-20281.
For Java resolve we can use also resolve with 'null' platform,
which is possible situation in tests.
2018-02-06 15:02:38 +03:00
Alexander Podkhalyuzin
09d167eafb Ask just extensions, not in some area #KT-21978 Fixed 2018-02-06 14:58:18 +03:00
Alexey Sedunov
c602c51642 Slicer: Sort tree nodes to produce stable test data 2018-02-06 14:23:20 +03:00
Alexey Sedunov
adca8eb7f1 Rename: Substitute synthetic expression parent before analysis
This fixes rename conflicts test
2018-02-06 14:23:20 +03:00
Alexey Sedunov
049439ce1d Rename: Update test data (follow-up for unnecessary reformatting fix) 2018-02-06 14:23:20 +03:00
Alexey Sedunov
d51da8bafd Misc: Fix Android SDK path in Gradle import tests 2018-02-06 14:23:19 +03:00
Mikhail Glukhikh
7995ae05c5 Introduce inspection for redundant not-null extension receiver of inline
Related to KT-22303
2018-02-06 14:17:01 +03:00
Mikhael Bogdanov
ad48099ca6 Move java 8 tests to java8 folder 2018-02-06 10:32:14 +01:00
Dmitry Savvinov
7e512ba018 Enable contracts in the 'compiler' module 2018-02-06 10:58:47 +03:00
Mikhail Glukhikh
19beaf57a7 JVM facade: for Java resolve, always use JvmPlatform resolver
So #KT-20281 Fixed
2018-02-06 09:50:10 +03:00
Mikhail Glukhikh
c90056f8c4 Introduce inspection for nullable extension receiver of inline function
So #KT-22303 Fixed
2018-02-06 09:50:09 +03:00
Mikhail Glukhikh
08d3f20e09 Reformat: AbstractMultiModuleHighlightingTest 2018-02-06 09:50:08 +03:00
Mikhail Glukhikh
3ba6b70f73 Show expect / actual gutter even for incomplete compatibility
So #KT-18445 Fixed
So #KT-21115 Fixed
2018-02-06 09:50:00 +03:00
Mikaël Peltier
a2a3043607 KT-18731 Use reference equality to compare enums
Fix of https://youtrack.jetbrains.com/issue/KT-18731
2018-02-05 18:34:44 +03:00
Pavel V. Talanov
bc54c95bc3 JavaResolveExtension: create facade by original element
Fixes semantic difference erroneously introduced in c030a047aa
 #KT-22593 Fixed
2018-02-05 16:26:47 +01:00
Pavel V. Talanov
7b8d501670 Dsl highlighting: Provide gutter for marker annotation definition
Allows to jump to corresponding page in 'color and font' settings
2018-02-05 16:22:23 +01:00
Pavel V. Talanov
0d5d826bc5 Dsl highlighting: reasonable default colors 2018-02-05 16:22:22 +01:00
Pavel V. Talanov
b9c832a952 Implement custom highlighting for dsls
A declaration is considered a part of dsl if it's marked with
    a marker annotation (which is in turn must be marked as @DslMarker)
Highlighting attributes are then chosen randomly from a preset list
    based on marker annotation fqname
2018-02-05 16:22:20 +01:00
Pavel V. Talanov
5ab00ee9f7 HighlighterExtension can provide custom highlighting for calls 2018-02-05 16:22:19 +01:00
Alexander Udalov
91a9038b2f Regenerate Gradle options
After f9e195351a
2018-02-05 16:17:30 +01:00
kenji tomita
1875d129ea Inspection to get rid of unnecessary ticks in references #KT-18124 Fixed 2018-02-05 17:31:08 +03:00
Alexander Udalov
9e500831dd Allow expect/actual annotation constructors to have default values
When a parameter has a default argument value both in the expected
annotation and in the actual annotation, they must be equal. This check
has been only implemented for the case when actual annotation is Kotlin
source code, and NOT a Java class coming from an actual typealias. The
latter case would require a bit more work in passing a platform-specific
annotation-value-reading component to ExpectedActualDeclarationChecker,
and is therefore postponed.

For now, Java annotations that are visible through actual type aliases
cannot have default argument values for parameters which already have
default values in the expected annotation declaration

 #KT-22703 Fixed
 #KT-22704 Open
2018-02-05 14:13:32 +01:00
Alexander Udalov
71fe8c02a3 Fix rendering of type aliases
- render 'actual' modifier if it's present
- do not render a space after type parameter list
2018-02-05 13:38:06 +01:00
Zalim Bashorov
e0245a9dc7 KJS: support default arguments for expected declarations 2018-02-05 13:38:06 +01:00
Alexander Udalov
db4ce703a6 Support default arguments for expected declarations
#KT-21913 Fixed
2018-02-05 13:38:05 +01:00
Alexander Udalov
d356f52873 JS: remove MULTIPLATFORM directive from box tests
Move all sources into one module and use "!LANGUAGE:
+MultiPlatformProjects" instead
2018-02-05 13:38:05 +01:00
Alexander Udalov
d465f5fd8e Extract ExpectedActualResolver out of ExpectedActualDeclarationChecker
The point is that it's placed in module 'resolution' where it can be
accessed for example in ArgumentsToParametersMapper to load default
argument values from expected function
2018-02-05 13:38:05 +01:00
Alexander Udalov
ea30388ae5 Minor, use another way to check that descriptor is from sources
This way this function can be moved to module 'resolution', where
DescriptorToSourceUtils is not available
2018-02-05 13:38:04 +01:00
Alexander Udalov
ac5444ef7c Add declaresOrInheritsDefaultValue, move hasDefaultValue to 'resolution'
'hasDefaultValue' needs to be adapted to support locating default values
in 'expect' functions, and this is not possible in module 'descriptors',
where it was originally declared. Therefore, move it to module
'resolution' and copy its current logic to a separate function
'declaresOrInheritsDefaultValue' which is used in 5 places.
'hasDefaultValue' itself is updated in subsequent commits.

Besides changing imports, also use a simpler declaresDefaultValue in
some places, which does not include default values inherited from
supertypes: this is OK for constructors, and in LazyJavaClassMemberScope
for functions from built-ins which do not have default argument values
at all
2018-02-05 13:38:04 +01:00
Alexander Udalov
7eb66f2579 Minor, support 'expect'-only files in codegen tests 2018-02-05 13:38:04 +01:00
Alexander Udalov
f75b774d80 Do not report unused parameters for actual constructors
Extract common part for functions and constructors in
processUnusedParameter
2018-02-05 13:38:04 +01:00
Alexander Udalov
1bdec829ea Treat constructors as actual only if the 'actual' modifier is present
Exactly as this is done for functions in
FunctionDescriptorResolver.initializeFunctionDescriptorAndExplicitReturnType

 #KT-21906 Fixed
2018-02-05 13:38:04 +01:00
Alexander Udalov
f198a28276 Fix type parameter bound check in expect-actual checker
Also make TypeParameterUpperBounds a "strong" incompatibility, meaning
that non-actual members from platform module are _not_ going to be
matched to the expected members if this incompatibility exists between
them, and therefore NO_ACTUAL_FOR_EXPECT will be reported on the
expected declaration, instead of ACTUAL_MISSING on the platform member.
This is needed because the difference in type parameter upper bounds can
have effect on the function signature on the platform (e.g. on JVM,
Array<T> -> T[], but Array<T> -> Comparable[] if T : Comparable<T>), and
it would be incorrect to report ACTUAL_MISSING on the member that has
nothing to do with the expected declaration that happens to coincide
with it in everything except type parameter bounds

 #KT-21864 Fixed
2018-02-05 13:38:04 +01:00
Alexander Udalov
8c6b140865 Simplify diagnostic message for ACTUAL_MISSING
#KT-21939 Fixed
2018-02-05 13:38:03 +01:00
Mikhael Bogdanov
1530fbee1b Fix ir test execution 2018-02-05 12:07:36 +01:00
Mikhail Zarechenskiy
5dacfae793 Support calling inline functions inside inline classes 2018-02-05 12:07:41 +03:00
Mikhail Zarechenskiy
2536eb4d45 Generate argument expression instead of constructor for inline classes 2018-02-05 12:07:40 +03:00
Mikhail Zarechenskiy
928a342ace Initial version of codegen for inline classes 2018-02-05 12:07:40 +03:00
Mikhail Zarechenskiy
fbc02dee58 Refactoring: extract method to generate suspend method out 2018-02-05 12:07:40 +03:00
Mikhail Zarechenskiy
d1049e5553 Refine type mapping for nullable inline class types 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
d5400f11a3 Basic inline class mapping to the underlying representation 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
4b4525ec17 Support !LANGUAGE directive in signature tests 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
d1a8ec06dd Reformat typeSignatureMapping.kt file 2018-02-05 12:07:38 +03:00
Mikhail Zarechenskiy
a463fb1d5e Add basic declaration checker for inline classes 2018-02-05 12:07:38 +03:00
Mikhail Zarechenskiy
915455ebe9 Introduce InlineClasses language feature
Allow to write `inline` modifier in front of class declaration
2018-02-05 12:07:38 +03:00
Denis Zharkov
9b28d1a21c Make precise java classes tracking in Gradle enabled by default
#KT-22192 Fixed
2018-02-05 11:54:53 +03:00
Natalia Selezneva
74a9881e9d Fix "Virtual pointer hasn't been disposed" exception in tests. Add sdk to ProjectJdkTable. 2018-02-05 09:46:57 +03:00
Nikolay Krasko
f05e926670 Update idea to 173.3.4 (173.4548.28) 2018-02-03 00:15:45 +03:00
Nikolay Krasko
5a9ea89e9c Collect statistics about used Kotlin formatter 2018-02-03 00:15:45 +03:00
Nikolay Krasko
d1e6a61197 Fix testInGlobalPropertyWithGetter test in 173 branch
Workaround for IDEA-185462. It was introduced in 173 idea and
fixed in 181.
2018-02-03 00:15:45 +03:00
Vyacheslav Gerasimov
5b0d908d85 Add log4j & jdom to tests-common testCompile
Fixes NCDFEs in IrBlackBoxCodegenTestGenerated
2018-02-02 19:54:27 +03:00
Ilya Gorbunov
c06204d0d4 Remove obsolete test classpath helpers 2018-02-02 17:59:29 +03:00
Ilya Gorbunov
381344141f Drop StdlibTest from compiler tests
Reason: stdlib built with the fresh compiler is going to be tested in Compiler Bootstrap Test configuration.
2018-02-02 17:59:27 +03:00
Ilya Gorbunov
8f78d73cd7 Use fqnames for SortedSet and TreeSet from java.util
Remove internal typealiases for SortedSet and TreeSet
2018-02-02 17:56:56 +03:00
Ilya Gorbunov
b456c52902 Import kotlin.coroutines.experimental for generated sequences on all platforms
This will add import to common generated sources
2018-02-02 17:56:56 +03:00
Natalia Selezneva
cdbe0b8fa9 Scratch tests: delete scratch file after creation 2018-02-02 17:44:42 +03:00
Natalia Selezneva
6ca1b10f41 Use correct logger for debugging scratch files 2018-02-02 17:44:35 +03:00
Natalia Selezneva
847990a4f6 Tests: call super.teardown from finally block in android tests 2018-02-02 17:44:28 +03:00
Vyacheslav Gerasimov
36167c7b8f Add annotations to lint plugin dependencies
Fixes `warning: unknown enum constant` during lint plugin build
2018-02-02 16:58:43 +03:00
Alexey Tsvetkov
6c4f3df851 Remove intellij-core usages from kotlin-gradle-plugin-integration-tests
We can use only relocated intellij-core from kotlin-compiler-embeddable.
Non-source usages do not resolve in IDE (which also breaks debugger).
2018-02-02 15:40:11 +03:00
Alexey Tsvetkov
8f144fc57a Fix red code in IDE in kotlin-gradle-plugin-integration-tests 2018-02-02 15:40:10 +03:00
Alexey Tsvetkov
7c329b59b6 Shade test jars from compiler used in Gradle tests
This fixes `VerifyError` for all integration tests calling
`KotlinTestUtils.findAndroidSdk()`.
The exception was thrown because `:kotlin-gradle-plugin-integration-tests`
was depending on both relocated intellij-core (from kotlin-compiler-embeddable)
and non-relocated intellij-core (transitevely through tests jars from compiler).

A call to `findAndroidSdk()` was triggering classloading
for `KotlinTestUtils` which had bytecode references to
`org.jetbrains.kotlin.idea.KotlinLanguage` loaded from the embeddable compiler
and to `com.intellij.lang.Language` loaded from non-relocated intellij-core.

`KotlinLanguage` from the embeddable compiler was a subclass of relocated
`org.jetbrains.kotlin.com.intellij.lang.Language` thus it was not
assignable to `com.intellij.lang.Language` causing `VerifyError`.

The solution is to create relocated jar combining the necessary test jars
from the compiler.
2018-02-02 15:40:10 +03:00
Alexey Tsvetkov
7cba035f80 Ensure tasks using android sdk or android jar have proper dependencies
A test task, that uses android dependency but does not depend on
a corresponding configuration, would fail when it was run after
'clean' task.
I've extracted 'useAndroidSdk', 'useAndroidJar' extensions
making it harder for a developer to forget to set up task dependencies.
2018-02-02 15:40:10 +03:00
Anton Bannykh
3ead464671 JS: fix callable reference with implicit extension receiver (KT-22638 fixed) 2018-02-02 14:34:34 +03:00
Alexander Udalov
f4e2102787 Minor, remove extra empty lines from -X arguments help 2018-02-01 19:38:32 +01:00
Alexander Udalov
5338df6960 Do not depend on Shadow plugin in subprojects
Since buildSrc depends on the Shadow plugin, it's already in the
classpath of all build scripts
2018-02-01 19:38:31 +01:00
Alexander Udalov
ad0cd7c176 Use the same JVM args for buildSrc as for main project 2018-02-01 19:38:30 +01:00
Alexander Udalov
f9e195351a Minor, rephrase usage help for -no-stdlib/-no-reflect compiler arguments 2018-02-01 19:38:30 +01:00
Alexander Udalov
28c77bfb01 Fix kotlin.annotation.Target's kdoc
The original sentence was incorrect because it did not exclude type
aliases
2018-02-01 19:27:43 +01:00
Alexander Udalov
616ba1fbe4 Minor, remove obsolete JDK 9 EA version guard 2018-02-01 19:27:43 +01:00
Alexander Udalov
efd92547ef Remove unused description file 2018-02-01 19:26:39 +01:00
Vyacheslav Gerasimov
dd9ea0bc87 Remove unnecessary dependencies on :prepare:idea-plugin:idea-plugin 2018-02-01 18:11:25 +03:00
Vyacheslav Gerasimov
ec511f7a78 Use dependsOn for dependencies on dist & ideaPlugin tasks
instead `shouldRunAfter`
2018-02-01 18:11:25 +03:00
Vyacheslav Gerasimov
a595fdd312 Make root dist & ideaPlugin depend on all corresponding tasks in child projects 2018-02-01 18:11:25 +03:00
Alexey Tsvetkov
74e47e024f Replace testCompile with testRuntime dependencies
Compile dependencies broke incremental compilation
because packed compiler was present in idea
test compile classpath (we do not track changes in
fat jars)
2018-02-01 17:39:55 +03:00
Alexey Tsvetkov
4ee34fc355 Avoid building kotlin-compiler-embeddable before running idea tests
kotlin-compiler-embeddable is a runtimeOnly dependency of
kotlin-compiler-runner, so embeddable jar was built
before idea tests execution.
Building the jar takes ~20s on my machine, which is a waste
of time since idea does not use embeddable compiler.
2018-02-01 17:39:55 +03:00
Alexey Tsvetkov
29d2679e8d Do not configure dist task for every published module
This change avoids compiling kotlin-compiler-embeddable,
kotlin-gradle-plugin, and other gradle plugins,
when running `./gradlew dist`
2018-02-01 17:39:55 +03:00
Alexey Tsvetkov
d5ee77eb07 Avoid exception when listing configuration contents 2018-02-01 17:39:54 +03:00
Alexey Sedunov
f35af11423 Rename: Make improvements for "by-convention" calls
- Convert between conventions call for 'get' and 'invoke'
- Drop 'operator' when converting 'get'/'invoke' to something other than
  'invoke'/'get' respectively

 #KT-12365 Fixed
2018-02-01 15:41:09 +03:00
Alexey Sedunov
caeb594e09 Rename: Replace name identifiers via AST to prevent unwanted reformatting
#KT-8563 Fixed
2018-02-01 15:41:06 +03:00
Alexey Sedunov
58bf42c1dd Rename: Support KtTypeAlias in RenameKotlinClassProcessor
#KT-21719 Fixed
2018-02-01 15:41:04 +03:00
Alexey Sedunov
90392a8d8a Loop to Call Chain: Do not generate lambda with double wrapping block
#KT-22476 Fixed
2018-02-01 15:41:03 +03:00
Alexey Sedunov
8c9c1609c0 Move Class to Top Leve: Suggest file name based on new class name
#KT-17977 Fixed
2018-02-01 15:41:01 +03:00
Alexey Sedunov
4d52bf04fe Kotlin Ultimate: Support NodeJS CLI run configuration
#KT-16710 Fixed
2018-02-01 15:35:35 +03:00
Alexey Sedunov
1f7fab837f Gradle: Import production output path for JavaScript modules 2018-02-01 15:35:34 +03:00
Alexey Sedunov
80887a84ca Kotlin Ultimate: Add "Build" action to JS run configurations
#KT-20522 Fixed
2018-02-01 15:35:34 +03:00
Ilmir Usmanov
8ffb205f1c Reformat coroutineContext related code 2018-02-01 13:18:43 +03:00
Ilmir Usmanov
18c03f94f8 Move coroutineContext to correct package
from kotlin.coroutines.experimental.instrinsics to kotlin.coroutines.experimental

 #KT-22400
2018-02-01 13:18:32 +03:00
Natalia Selezneva
efabf80d37 Scratch: do not store psiFile in ScratchFile 2018-02-01 11:07:54 +03:00
Natalia Selezneva
c32a7dd852 Scratch: add logging 2018-02-01 10:21:55 +03:00
Natalia Selezneva
2140b9457d Minor: fix formatting 2018-02-01 10:21:55 +03:00
Natalia Selezneva
ac7beb41f3 Rearrange checkboxes in scratch panel 2018-02-01 10:21:55 +03:00
Natalia Selezneva
d6d2d4271b Scratch: restore information about module in scratch panel after ide restart 2018-02-01 10:21:55 +03:00
Natalia Selezneva
0a274a7e61 Align output in scratch file 2018-02-01 10:21:55 +03:00
Natalia Selezneva
8e98f703ac Change colors for scratch output 2018-02-01 10:21:55 +03:00
Natalia Selezneva
dc71ac09b2 Scratch: do not report errors from generated file to editor 2018-02-01 10:21:55 +03:00
Natalia Selezneva
ad90095dc7 Show multple errors in scratch toolwindow 2018-02-01 10:21:55 +03:00
Natalia Selezneva
d7c6dacc86 Temporary workaround: rename scratch files with kt extension to kts before additional api will be added in IDEA 2018-02-01 10:21:55 +03:00
Natalia Selezneva
c4971de7c1 Scratch: add Make before Run checkbox 2018-02-01 10:21:55 +03:00
Natalia Selezneva
a96cf147fc Scratch: add multifile tests 2018-02-01 10:21:55 +03:00
Natalia Selezneva
23ef50203e Use correct check for isRepl checkbox in scratch panel 2018-02-01 10:21:55 +03:00
Natalia Selezneva
654890fac3 Scratch: implement compiling executor 2018-02-01 10:21:55 +03:00
Natalia Selezneva
dda0b38fb9 Scratch: tests for repl execution 2018-02-01 10:21:55 +03:00
Natalia Selezneva
1a84c05db2 Scratch: implement output handlers for displaying execution results 2018-02-01 10:21:55 +03:00
Natalia Selezneva
01e62c9bdb Scratch: implement run action with repl 2018-02-01 10:21:55 +03:00
Natalia Selezneva
2ccf4b7d7f Initial support for scratch files 2018-02-01 10:21:55 +03:00
Alexey Sedunov
82a997e0a2 Kotlin Ultimate: Support Jest run configurations for Kotlin sources
#KT-21531 Fixed
2018-02-01 04:40:31 +03:00
Alexey Sedunov
2c0af794ea JS: Drop obsolete "Kotlin (JavaScript)" run configuration
#KT-21312 Fixed
2018-02-01 04:40:30 +03:00
Vyacheslav Gerasimov
bb6ab6309a Fix runIdeTask dependencies for communiti and ultimate 2018-01-31 21:36:03 +03:00
Vyacheslav Gerasimov
3e67bfd9b3 Exclude Kotlin plugin when unzipping intellij sdk 2018-01-31 20:10:25 +03:00
Vyacheslav Gerasimov
e20b6738f6 Extract removing bundled Kotlin plugin to separate task 2018-01-31 18:53:59 +03:00
Vyacheslav Gerasimov
59effef423 Delete bundled Kotlin plugin
Idea fails to start with two Kotlin plugins
2018-01-31 17:49:52 +03:00
Vyacheslav Gerasimov
527bdef447 Fix runIdeTask plugin path 2018-01-31 17:49:52 +03:00
Mikhail Glukhikh
babcea9edc Fix completion test (companion object is allowed in annotation scope) 2018-01-31 14:44:33 +03:00
Nicolay Mitropolsky
cf6e21daad Light annotations made strictly non-physical (KT-22565) 2018-01-31 14:31:35 +03:00
Mikhail Glukhikh
00ceac54fc Fix "create enum constant" test (create type alias is no longer here) 2018-01-31 13:56:07 +03:00
Nikolay Krasko
209c66ca1b Set better defaults on Imports tab in Code Style -> Kotlin (KT-22575)
"Top level symbols" and "Java Statics and Enum Members" are always
returned to 2 after saving to not-number option

 #KT-22575 Fixed
2018-01-31 13:27:30 +03:00
Nikolay Krasko
607fa30c5a Can't add import for using with '*' in settings (KT-22570)
#KT-22570 Fixed
2018-01-31 13:27:29 +03:00
Nikolay Krasko
894db730b2 Fix modification check for Kotlin import settings (KT-22557)
#KT-22557 Fixed
2018-01-31 13:27:29 +03:00
Nikolay Krasko
c0aa2c5469 Lost IF_RPAREN_ON_NEW_LINE settings from Kotlin code style 2018-01-31 13:27:29 +03:00
Nikolay Krasko
17da150bc2 Add ability to customize and save IF_RPAREN_ON_NEW_LINE setting 2018-01-31 13:27:29 +03:00
Ilya Chernikov
d70b9c1d76 Detect new activity after delayed shutdown correctly
fixes #KT-22549, test

(cherry picked from commit 50f34db)
2018-01-31 10:25:29 +01:00
Mikhail Glukhikh
98b0f91d84 Fix parcelize delete creator field test (companion is retained now) 2018-01-31 11:48:03 +03:00
Mikhail Glukhikh
294dcf36e8 Fix J2K 'testAnnotationInterface3' (annotation diagnostic changed) 2018-01-31 11:24:40 +03:00
Toshiaki Kameyama
677b05cc8c KT-22167 "Add annotation target" quick fix does nothing and disappears from menu 2018-01-30 20:25:08 +03:00
Mikhail Glukhikh
6fbf5a8904 Reverts commit 2472966
(Remove unused function parameter: minor improvement)
Transformation was not equivalent due to change signature in between
This revert fixes broken quick-fix tests (remove parameter based)
2018-01-30 18:43:25 +03:00
Vyacheslav Gerasimov
d0b232c172 Update readme part about dependencies 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
68b5dc756c Remove intellij-core from testRuntime if full idea is already there
Looks like it makes tests flacky
2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
29caa00f23 Add asm-all to jps-plugin dependencies 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
bc86f40fd8 Update kotlinx-coroutines version to 0.20 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
89a07ded1c Extract versions and remove unnecessary '.jar' extensions 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
3e34b95610 Use KotlinTestUtils.findAndroidSdk() in BuildCacheRelocationIT 2018-01-30 17:06:18 +03:00
Vyacheslav Gerasimov
052be93c97 Add some logging to intellij-sdk build script 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
558a2cb8a8 Explicit intellijUltimateEnabled should override teamcity build 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
3d1e0c3b39 Add dependency versions for 171, 181, AS 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
ca6889b4c6 Fix build script for kotlin-gradle-subplugin-example 2018-01-30 17:06:17 +03:00
Vyacheslav Gerasimov
07b191f460 Update dependency versions after migration to 173 2018-01-30 17:06:17 +03:00
Ilya Chernikov
8ab121b373 Exclude new dependencies locations from CodeConformanceTest 2018-01-30 17:06:17 +03:00
Ilya Chernikov
555e9674b2 Fix dependencies to the cross-project tasks 2018-01-30 17:06:17 +03:00
Ilya Chernikov
434bbafe58 Implement runners without intellij plugin, share common part 2018-01-30 17:06:16 +03:00
Ilya Chernikov
0a95e7b20f Fix dependencies and artifacts contents after review 2018-01-30 17:06:16 +03:00
Ilya Chernikov
058ef31d7a Fixes after review 2018-01-30 17:06:16 +03:00
Ilya Chernikov
14e586d5a5 Refactor android sdk preparation project after review 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
e83845ea72 Build changes to support Android Studio 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
b2ca302bf7 Support downloading Android Studio 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
f4feb71ad2 Extract repeated versions to a single location 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
df17f20ec7 Fix project sync when intelliUltimateEnabled is not set 2018-01-30 17:06:16 +03:00
Dmitry Jemerov
a58a6290cc Fix typo 2018-01-30 17:06:15 +03:00
Ilya Chernikov
5dc094d290 Implement correct and fast ultimate/community sdks handling 2018-01-30 17:06:15 +03:00
Ilya Chernikov
6f1e6f1f1b Fix tests after rebasing and messing with the dependencies 2018-01-30 17:06:15 +03:00
Ilya Chernikov
246f73c879 Cleanup unused ant-related bits and script constants 2018-01-30 17:06:15 +03:00
Ilya Chernikov
0c35e79283 Fix idea home path usages 2018-01-30 17:06:15 +03:00
Ilya Chernikov
2dc4769c0a Fixes after rebase 2018-01-30 17:06:15 +03:00
Ilya Chernikov
172a29ba04 Implement NodeJS plugin downloading 2018-01-30 17:06:15 +03:00
Ilya Chernikov
48cbcbc496 Switch jsr305 usages to the maven version
since it is not available in the intellij ultimate SDK
2018-01-30 17:06:14 +03:00
Ilya Chernikov
acc84d2524 Rollback incorrect tests fix 2018-01-30 17:06:14 +03:00
Ilya Chernikov
7218bd536c Implement single idea sdk scheme, some refactoring 2018-01-30 17:06:14 +03:00
Ilya Chernikov
5f7c783bb2 Stop using com.intellij.openapi.components.service functions:
they are getting obfuscated in the ultimate SDK, which prevents us
from using ultimate sdk for all modules.
Could probably be rolled back after fixing KT-18563
2018-01-30 17:06:14 +03:00
Ilya Chernikov
d38b1c361a Add ultimate sdk 2018-01-30 17:06:14 +03:00
Ilya Chernikov
1219572aa0 Extract intellij params to buildSrc's build script 2018-01-30 17:06:14 +03:00
Ilya Chernikov
05f0978865 Fix after review 2018-01-30 17:06:14 +03:00
Ilya Chernikov
fbbece3c86 Fix publishing problem 2018-01-30 17:06:13 +03:00
Ilya Chernikov
7e21573cf4 Convert the rest of the project to intellij repo prepared in buildSrc 2018-01-30 17:06:13 +03:00
Ilya Chernikov
e23b1529b3 Convert intellij usages in the groovy build scripts 2018-01-30 17:06:13 +03:00
Ilya Chernikov
4eb557724c Convert compiler projects to the new intellij deps 2018-01-30 17:06:13 +03:00
Ilya Chernikov
a418a3ac49 Renaming for easier conversion, some more manual conversion 2018-01-30 17:06:13 +03:00
Ilya Chernikov
6f21c36d68 Switch first project to the new custom dependencies schema 2018-01-30 17:06:13 +03:00
Ilya Chernikov
47507ad694 Switch all usages of dx.jar to the new mechanism, cleanup and refactoring 2018-01-30 17:06:13 +03:00
Ilya Chernikov
eabbebd458 Prepare intellij sdk deps in buildSrc 2018-01-30 17:06:13 +03:00
Yan Zhulanow
59c8f33450 Fix jps android test 2018-01-30 17:06:12 +03:00
Ilya Chernikov
46be5e25be Rewrite android sdk dependencies to avoid config-time tasks execution 2018-01-30 17:06:12 +03:00
Ilya Chernikov
febab82c7e Switch jps android test to platform 26 2018-01-30 17:06:12 +03:00
Ilya Chernikov
7120fe190a Fix overrides of the findViewById in android tests for platform 26 2018-01-30 17:06:12 +03:00
Ilya Chernikov
587f76251e Fix os-specific downloads in android sdk 2018-01-30 17:06:12 +03:00
Ilya Chernikov
e8494a5371 Fix uast-kotlin dependencies and tests 2018-01-30 17:06:12 +03:00
Ilya Chernikov
a6f8db5d02 Fix script-util tests 2018-01-30 17:06:12 +03:00
Ilya Gorbunov
7710cc455c Refactor helper tasks for TeamCity builds
Invoke them properly from TeamCityBuild.xml acting as a temporary adapter.
Remove obsolete tasks from TeamCityBuild.xml.

Patch plugin version with regex replacement in plugin.xml.
2018-01-30 17:06:12 +03:00
Ilya Chernikov
b5db681e06 Switch tests to android sdk 26 2018-01-30 17:06:11 +03:00
Ilya Chernikov
c153a386ab Fix tests 2018-01-30 17:06:11 +03:00
Ilya Chernikov
a4f28cd94f Make all dependencies to idea sdk intransitive 2018-01-30 17:06:11 +03:00
Ilya Chernikov
e76cd802d8 Fix jps tests 2018-01-30 17:06:11 +03:00
Ilya Chernikov
b2926a9322 Add classpath printing tasks to all relevant projects 2018-01-30 17:06:11 +03:00
Ilya Chernikov
0b63e11ea8 Replace android sdk dependencies with custom project build, cleanup update_dependencies.xml 2018-01-30 17:06:11 +03:00
Ilya Chernikov
98204aa2d3 Move jflex download out from update_dependencies, add lexer (ant) tasks to frontend project 2018-01-30 17:06:11 +03:00
Ilya Chernikov
90e5558704 Re-add node.js tests, switch to direct usage of node_utils.xml, remove node parts from update_dependencies.xml 2018-01-30 17:06:10 +03:00
Ilya Chernikov
7f86fb9343 Switch to idea NodeJS plugin usage via intellij gradle plugin 2018-01-30 17:06:10 +03:00
Ilya Chernikov
69787bd0d1 Switch spring usages to regular dependency 2018-01-30 17:06:10 +03:00
Ilya Chernikov
d301938d23 Rewrite TeamCityBuild.xml tasks in gradle, finally drop build.xml files
also:
  proxying previous tasks from TeamCityBuild.xml to gradle,
  cleaning update_dependencies.xml from ant dependencies
2018-01-30 17:06:10 +03:00
Ilya Chernikov
12f0f019da Switch robolectric usages to regular dependency 2018-01-30 17:06:10 +03:00
Ilya Chernikov
361d8536ac Switch ant usages to regular dependency 2018-01-30 17:06:10 +03:00
Ilya Chernikov
486c3a2aff Do not depende on the ideaSdk location in integration tests
assume that tests are always run from the project's root
2018-01-30 17:06:10 +03:00
Ilya Chernikov
f96153693e Make tools.jar search non-throwing 2018-01-30 17:06:09 +03:00
Ilya Chernikov
80ad969f7b Switch markdown usages to regular (teamcity) dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
78d2c655d5 Switch native-platform usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
4a47fb3ffb Switch protobuf usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
a952d797f1 Switch org.json:json usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
8f96157d7f Switch kotlinx-coroutines usages to regular dependency 2018-01-30 17:06:09 +03:00
Ilya Chernikov
8bc95295eb Drop other references to ideaSdk 2018-01-30 17:06:09 +03:00
Ilya Chernikov
9766508512 Drop drop lib folder and all (arguably obsolete) dependent usages 2018-01-30 17:06:09 +03:00
Ilya Chernikov
713fb9a0e7 Drop ideaSdk downloading in update_dependencies 2018-01-30 17:06:08 +03:00
Ilya Chernikov
b490a79d95 Replace direct usages of ideaSdk in tests with property passed from build scripts 2018-01-30 17:06:08 +03:00
Ilya Chernikov
eb8ef6e803 Drop unused sources 2018-01-30 17:06:08 +03:00
Ilya Chernikov
d39d2883e2 Ignore local data dir in idea and git 2018-01-30 17:06:08 +03:00
Ilya Chernikov
26369c3cca Cleanup obsolete ideaSdk helpers 2018-01-30 17:06:08 +03:00
Ilya Chernikov
28689f631c Convert instrumentation 2018-01-30 17:06:08 +03:00
Ilya Chernikov
10732a1bdd Convert ultimate runner to intellij plugin 2018-01-30 17:06:08 +03:00
Ilya Chernikov
5d3579c079 Convert idea ultimate module to intellij plugin 2018-01-30 17:06:08 +03:00
Ilya Chernikov
f0edb602da Convert ide-runner to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
556287f9bb Move idea plugin artifacts one dir deeper to simplify runIde task
Running idea via specifying plugins dir (instead of plugin.path property
allow idea to select proper plugin version without a need to remove a bundled
plugin. But in order to make it work, the regular and ultimate plugins
should have separate parent dirs.
2018-01-30 17:06:07 +03:00
Ilya Chernikov
06c8cbf7d6 Convert all remaining plugin modules to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
9b51a547d8 Convert generators to intellij plugin, clean up dependencies 2018-01-30 17:06:07 +03:00
Ilya Chernikov
0d264793ce Convert idea plugin modules to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
3912025e14 Convert jps module to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
8266777bd5 Convert js modules to intellij plugin 2018-01-30 17:06:07 +03:00
Ilya Chernikov
74411d9b9c Convert all compiler modules to intellij plugin 2018-01-30 17:06:06 +03:00
Ilya Chernikov
6614695616 Convert more projects 2018-01-30 17:06:06 +03:00
Ilya Chernikov
743f599262 Add infrastructure and helpers for using intellij plugin, convert first project 2018-01-30 17:06:06 +03:00
Mikhail Glukhikh
a0d0bc074b Cleanup: KotlinPullUpHelper 2018-01-30 16:32:20 +03:00
Mikhail Glukhikh
cefa17f877 Reformat: KotlinPullUpHelper 2018-01-30 16:30:08 +03:00
Mikhail Glukhikh
d88b5746c7 Delete companion manually during pull up 2018-01-30 16:29:22 +03:00
Mikhail Glukhikh
7c6a217579 Reformat: KotlinInlineCallableProcessor 2018-01-30 16:03:14 +03:00
Mikhail Glukhikh
6181ba47c8 Delete companion manually during callable inlining 2018-01-30 16:02:32 +03:00
Mikhail Glukhikh
9b1f323118 Retain empty companion in KtNamedDeclarationStub.remove 2018-01-30 15:41:38 +03:00
Mikhail Glukhikh
5abb9dd23e Create actual fix: handle companions correctly #KT-21114 Fixed 2018-01-30 15:41:37 +03:00
Mikhail Glukhikh
f46fa263ef Fix two psi checker tests (related to annotation diagnostic / parsing) 2018-01-30 15:41:06 +03:00
Mikhail Glukhikh
86f25bff63 KtVisitor: delegate constructors to KtNamedDeclaration
In particular, enables back "Unused symbol" on constructors
2018-01-30 15:24:39 +03:00
Mikhail Glukhikh
460688526d Fix testAnnotationInterface3 in J2K (error message) 2018-01-30 15:23:41 +03:00
Mikhail Glukhikh
899da99232 Fix testAnnotation in "member visibility can be private" 2018-01-30 14:59:47 +03:00
Dmitry Savvinov
404122654f Advance bootstrap version to 1.2.30-dev-672 2018-01-30 13:32:07 +03:00
Mikhail Zarechenskiy
c80beea6fd [NI] Refactoring: extract method to create resolution result out 2018-01-30 13:01:21 +03:00
Mikhail Zarechenskiy
0e31162df4 [NI] Fix substitution for receiver when resolving constructor super call 2018-01-30 13:00:44 +03:00
Mikhail Zarechenskiy
2a0bb68e1c [NI] Fix substitution of NotNullTypeParameter 2018-01-30 13:00:43 +03:00
Mikhail Zarechenskiy
4cd07f59a0 [NI] Don't fail on captured type that contains type variable 2018-01-30 13:00:42 +03:00
Mikhail Zarechenskiy
145c04e7e2 [NI] Fix substitution of incorporation constraint type 2018-01-30 13:00:40 +03:00
Mikhail Glukhikh
725704e70f ExclExclCallFixes: reformat 2018-01-30 11:23:18 +03:00
Mikhail Glukhikh
2472966749 Remove unused function parameter: minor improvement 2018-01-30 11:23:18 +03:00
Mikhail Glukhikh
1298ef7fed Redundant Unit expression: simplify code a bit 2018-01-30 11:18:01 +03:00
Mikhail Glukhikh
cd9e298e53 getParentOfTypesAndPredicate: Class<T> -> Class<out T> 2018-01-30 11:17:27 +03:00
Toshiaki Kameyama
18de0f75ab Redundant Unit inspection: fix false positive for single expression
So #KT-22097 Fixed
2018-01-30 10:03:36 +03:00
Mikhail Glukhikh
30acc224ec Reformat: redundant setter 2018-01-30 10:00:02 +03:00
Toshiaki Kameyama
69f3f04fe4 Correct report of "redundant setter" for override & empty block cases
So #KT-22364 Fixed
2018-01-30 09:59:55 +03:00
Alexander Udalov
0ad3872d1b Remove unneeded constructor parameters in CallCheckerContext 2018-01-29 19:38:03 +01:00
Dmitry Savvinov
1171fdb14d Add draft of changelog for 1.2.30 2018-01-29 19:50:04 +03:00
Dmitry Savvinov
a39aba4269 Revert "Add changelog for 1.2.30"
This reverts commit 4b70654c7e.
2018-01-29 19:45:08 +03:00
Dmitry Savvinov
4b70654c7e Add changelog for 1.2.30 2018-01-29 19:42:26 +03:00
Toshiaki Kameyama
28123eaf7b Add intention for changing setter accessibility #KT-22409 Fixed 2018-01-29 19:09:19 +03:00
Alexey Sedunov
7f97d58970 Type Hierarchy: Do not use JVM class mapping in non-JVM modules
#KT-21424 In Progress
2018-01-29 18:56:29 +03:00
Alexey Sedunov
089b34a8a9 Minor: Regenerate tests 2018-01-29 18:56:28 +03:00
Mikhail Glukhikh
1f8e2a1057 Reformat: unfold return to ... 2018-01-29 18:01:10 +03:00
Toshiaki Kameyama
3a81be6cfb Do not insert returns before Nothing in "Replace return with 'if'"
So #KT-22159 Fixed
2018-01-29 17:56:26 +03:00
Mikhail Glukhikh
f28bec0db1 Reformat: if-then utilities 2018-01-29 17:49:34 +03:00
Mikhail Glukhikh
3b8f5bce41 Reformat: "if then to safe access" inspection 2018-01-29 17:44:19 +03:00
Toshiaki Kameyama
fad7818bf0 Fix "if to safe access" false positive for check on incorrect type
So #KT-21881 Fixed
2018-01-29 17:43:01 +03:00
Mikhail Glukhikh
5798595206 Cleanup: IntentionDescriptionTest 2018-01-29 16:28:45 +03:00
kenji tomita
a28bc830f5 Add Intention for single character substring #KT-22171 Fixed 2018-01-29 16:23:01 +03:00
Mikhail Glukhikh
29eb594309 Inspection to replace Java Collections methods: simplify type check
Related to KT-22038
2018-01-29 15:52:45 +03:00
Mikhail Glukhikh
068f520c01 Inspection to replace Java Collections methods: fix formatting 2018-01-29 15:52:45 +03:00
Toshiaki Kameyama
be4739e65e Inspection to replace Java Collections methods: extend set of types
So #KT-22038 Fixed
2018-01-29 15:52:44 +03:00
Alexey Sedunov
bd8a4d78fa Line Markers: Don't show test run line markers for top-level functions
#KT-13509 Fixed
2018-01-29 14:48:41 +03:00
Mikhail Glukhikh
8cbf364457 Remove braces: add parentheses to if-else in more general case
Related to KT-18308
2018-01-29 14:32:36 +03:00
Toshiaki Kameyama
44c15d8311 Remove braces: add parentheses to if-else inside expression
So #KT-18308 Fixed
2018-01-29 14:32:36 +03:00
Alexander Udalov
19e38bbc72 Do not run annotation checkers for every non-annotated element 2018-01-29 12:22:41 +01:00
Alexander Udalov
46b8deedf7 Run classifier usage checkers on constructor calls
In some cases, REFERENCE_TARGET for annotation entries is the annotation
class descriptor, and in others -- the constructor of that class
2018-01-29 12:22:41 +01:00
Alexander Udalov
8cd7686535 Introduce DeclarationCheckerContext, remove SimpleDeclarationChecker 2018-01-29 12:22:40 +01:00
Alexander Udalov
4cb5483c13 Introduce CheckerContext and ClassifierUsageCheckerContext
To reduce the number of parameters in classifier usage checker
implementations, and to unify the API with call checkers
2018-01-29 12:20:36 +01:00
Alexander Udalov
e2def0c60e Do not report "invalid type of annotation member" on error types
In case the referred type is actually an enum that is not found in
dependencies due to a configuration problem, this usage could be valid.
So we can avoid reporting an error here, to reduce the number of
diagnostics.

Also do not report "default value of annotation parameter must be a
compile-time constant" in the same case for the same reason
2018-01-29 12:20:36 +01:00
Natalia Selezneva
c251386fc3 Rearrange script templates in GradleScriptTemplateProvider
#KT-22473 Fixed
2018-01-29 11:16:29 +03:00
Alexey Sedunov
b091500adc Rename: Wrap facade class when renaming file
This prevents assertion error (introduced in IDEA 181)
caused by facade light class invalidation
and fixes failing test
2018-01-29 01:34:48 +03:00
Alexey Sedunov
80643c5603 Rename: Fix processing of functions without light methods
#KT-22461 Fixed
2018-01-29 01:34:48 +03:00
Alexander Udalov
245d1de2a2 Remove runtime dependency on projectDist(":kotlin-compiler")
This dependency makes IDEA reindex kotlin-compiler.jar after every
Gradle build, which takes time and breaks some key IDE features
2018-01-28 10:14:24 +01:00
Dmitry Savvinov
4d951de616 Propagate nullability changes to enhancement for JSR-305 types
Fix TypeUtils.makeNullableAsSpecified for SimpleTypeWithEnhancement and
FlexibleTypeWithEnhancement: change nullability of enhancement too. This
fixes several false-positive warnings, like in KT-20855 and KT-20466.

Note that it removes warning in some cases (see testdata change for
uselessElvisRightIsNull.kt). However, this removes warning about
*unnecessary* elvis, i.e. this fixed introduces weak false-negatives, which
is acceptable for the moment.

#KT-20855 Fixed Target versions 1.2.30
#KT-20466 Fixed Target versions 1.2.30
#KT-21238 Fixed Target versions 1.2.30
2018-01-26 12:49:14 +03:00
Nikolay Krasko
4c76dc7287 Forbid modification for KtLambdaExpression in JavaCodeBlockModificationListener
See IDEA-185462 for details
2018-01-26 12:42:17 +03:00
Nikolay Krasko
4d2061d836 Minor: reformat coverage 2018-01-26 12:42:17 +03:00
Nikolay Krasko
6d7c779df2 Better diagnostic for file absence in updateJar (KT-22272)
#EA-96117 Fixed
 #KT-22272 Fixed
2018-01-26 12:42:16 +03:00
Toshiaki Kameyama
7e417272b2 "Join lines" works incorrectly in case of line containing more than one string literal (KT-22374)
#KT-22374 Fixed
2018-01-26 12:42:16 +03:00
Mikhael Bogdanov
cc346aef64 Support @JvmStatic for interface companion objects in backend 2018-01-26 10:09:21 +01:00
Mikhael Bogdanov
8bfd6d7404 Support JVM_TARGET in diagnostic tests 2018-01-26 10:09:20 +01:00
Mikhael Bogdanov
c4da370b0b Allow to use @JvmStatic in interface companion object 2018-01-26 10:09:20 +01:00
Mikhael Bogdanov
2340756b88 Minor. Reformat 2018-01-26 10:09:20 +01:00
Dmitry Savvinov
253cd3871b Support effect system-related args in platform 2018-01-26 11:30:44 +03:00
Dmitry Savvinov
b29a6e48fb Refactor language features, which control effect system
- Introduce new language feature 'ReadDeserializedContracts', which
allows to deserialize contracts from metadata.

- Introduce new language feature 'AllowContractsForCustomFunctions',
which allows reading contracts from sources.

- Use new features instead of combination 'CallsInPlaceEffect ||
ReturnsEffect'

- Rename 'CallsInPlaceEffect' -> 'UseCallsInPlaceEffect',
'ReturnsEffect' -> 'UseReturnsEffect'. As names suggest, they control
if it is allowed to use corresponding effect in analysis.

We have to introduce separate 'ReadDeserializedContracts' to enable
contracts only in some modules of the project, because libraries are
read with project-wide settings (see KT-20692).
2018-01-26 11:30:44 +03:00
Dmitry Savvinov
78850087be Revert reformatting for OperationsMapGenerated.kt 2018-01-26 11:00:28 +03:00
Dmitry Petrov
5e34f290ce Reified 'as?' produces nullable result
Previously, this was treated as a regular CHECKCAST, causing KT-22410.

 #Fixed KT-22410 Target versions 1.2.30
2018-01-26 10:22:59 +03:00
Dmitry Petrov
bd25bf14df Minor: reformat code in org.jetbrains.kotlin.codegen.optimization 2018-01-26 10:18:17 +03:00
Yan Zhulanow
e12deb54d6 Android Extensions: Fix "Inconsistent file tree" exception on Activity creation (KT-22349) 2018-01-25 22:03:30 +03:00
Yan Zhulanow
7b055c2172 Kapt: Prefer non-aliased imports over aliased. Make sure the imported short names are unique (KT-22083) 2018-01-25 22:03:29 +03:00
Ilya Gorbunov
233376eef0 Improve min/max specialization for longs and 3-arg overloads in JS 2018-01-25 21:41:18 +03:00
Ilya Gorbunov
2da9f12bc5 Inline findAnyOf(chars) into indexOfAny/lastIndexOfAny
This helps to reduce allocation count

#KT-22042
2018-01-25 21:37:22 +03:00
Cuihtlauac ALVARADO
923d9f03fc Update test results
Separated issue reported: KT-22522

#KT-22369 Fixed
2018-01-25 21:15:08 +03:00
Denis Zharkov
31e73e90d6 Explicitly state that PluginDeclarationProviderFactory is source-only
Before this change `filesScope` was effectively empty in cases when
module info is a library, thus looking
into PackageIndexUtil.packageExists(name, indexedFilesScope, project)
was kind of redundant since it always returns false for empty scopes

The initial motivation was run by 1716720604
that made PackageIndexUtil::packageExists calls much more frequent
2018-01-25 14:41:28 +03:00
Denis Zharkov
2224f95294 Minor. Avoid wrapping GlobalSearchScope.EMPTY_SCOPE 2018-01-25 14:41:28 +03:00
Denis Zharkov
4d378912bf Minor. Reformat JVM/JS analyzer facades 2018-01-25 14:41:28 +03:00
Toshiaki Kameyama
4232ad8dfe "Join lines" works incorrectly in case of line with more than one string literal (KT-22374)
#KT-22374 Fixed
2018-01-24 20:09:32 +03:00
Toshiaki Kameyama
c06aaf6128 Some Live Templates should probably be enabled also for "expressions" not only "statements" (KT-19194)
Consider if-then, if-else, do-while, while positions without block as
statement position.

 #KT-19194 Fixed
2018-01-24 20:09:32 +03:00
Alexander Udalov
543db380d2 Use isJvmInterface in JVM back-end instead of isInterface
To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
2018-01-24 15:54:35 +01:00
Alexander Udalov
a46a2b9b1c Support nested classes in annotation classes
#KT-16962 In Progress
2018-01-24 15:54:35 +01:00
Alexey Sedunov
5947b4eb8e Minor: Fix Maven server url 2018-01-24 17:52:41 +03:00
Alexey Sedunov
c96eb8df85 Minor: Fix test data for ConvertFunctionTypeParameterToReceiverIntention 2018-01-24 17:28:34 +03:00
Sergey Igushkin
a59fd3bc85 Remove the usage of repository.jetbrains.com 2018-01-24 17:12:45 +03:00
Ilya Gorbunov
32b68ae1d5 Rearrange platform specialized functions
Place them according to their operation to ArrayOps and Filtering.
2018-01-24 02:10:05 +03:00
Ilya Gorbunov
eda8bbacb3 Remove obsolete JvmVersion annotation from generated functions
These functions are already generated in jvm-only file
2018-01-24 02:10:01 +03:00
Sergey Igushkin
20c4775da0 Remove repository.jetbrains.com mirror of Maven Central in libraries. 2018-01-23 23:41:39 +03:00
Sergey Igushkin
0c78a2c026 Remove some of the remaining mentions of repository.jetbrains.com 2018-01-23 23:35:50 +03:00
Alexander Udalov
f516667640 Exclude META-INF/services from kotlin-reflect-sources.jar 2018-01-23 17:11:20 +01:00
Alexander Udalov
3bf5f44b9d Exclude .proto files from kotlin-reflect.jar
#KT-22459 Fixed
2018-01-23 17:11:09 +01:00
Vyacheslav Gerasimov
399282234e Add changelog for 1.2.21 2018-01-23 17:47:17 +03:00
Ilya Gorbunov
6b9520ec73 KT-16661 Simplify String.split a bit more
Check that limit is reached only once in a loop, move nextIndex check to the end of loop.
2018-01-23 13:29:35 +03:00
Vsevolod
510e17246f KT-16661 Simplify Strings#split
Do not search for next occurrence if limit is reached.
2018-01-23 13:29:29 +03:00
Vsevolod
2805371bdc KT-16661 Provide fast-path for Strings#split with single delimiter
Optimize single delimiter split when no matches is found:
Return listOf() of single element instead of adding 'this' to result
because underlying array in ArrayList is created lazily and
by default its size is 16.

Pre-size resulting list in split when limit is known.
2018-01-23 13:29:05 +03:00
Dmitry Petrov
72ffbb9825 Add test for array modification within for-in-array-withIndex loop body 2018-01-23 10:55:24 +03:00
Dmitry Petrov
40d1925e19 Provide optimized code generation for for-in-withIndex for sequences
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
2399a39414 Provide optimized code generation for for-in-withIndex for CharSequences
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
9c9e507172 Provide optimized code generation for for-in-withIndex for iterables
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
08622b0953 Provide optimized code generation for for-in-withIndex for arrays
#KT-5177 In Progress
2018-01-23 10:55:24 +03:00
Dmitry Petrov
e07e9c0ea5 Refactor RangeCodegenUtil: introduce isTopLevelExtensionOnType 2018-01-23 10:55:24 +03:00
Dmitry Petrov
fb487b31ba Minor: format code in RangeCodegenUtil 2018-01-23 10:55:24 +03:00
Dmitry Petrov
5c1321a29f Minor: format code in org.jetbrains.kotlin.codegen.range 2018-01-23 10:55:24 +03:00
Alexey Tsvetkov
f77586574f Always sort files in K2JSCompiler
Previously files were sorted only when IncrementalDataProvider
was not null to normalize js output in case of incremental compilation.
Because of that an output js file could be different after rebuild
in IC tests.
The issue could be reproduced anywhere, but the tests failed only on
Windows, and it seems tests were not run on Windows for some time.
2018-01-22 18:34:17 +03:00
Alexey Tsvetkov
21f2b68357 Fix BuildLogParserParametrizedTest on Windows: normalize line separators 2018-01-22 18:34:17 +03:00
Alexey Tsvetkov
6fc5c3325c Minor: rename file to match class name 2018-01-22 18:34:17 +03:00
Alexey Sedunov
737d7dcc2f Kotlin Facet: Use Kotlin SDK for non-JVM imported modules 2018-01-22 12:21:13 +03:00
Alexey Sedunov
70cb08bfdb Misc: Update test data (new 'allopen' Spring annotations added) 2018-01-22 12:21:12 +03:00
Denis Zharkov
2e933a165a Avoid retaining all protobuf objects in DeserializedMemberScope
Object model for deserialized protobuf isn't very cheap, so
loading just our stdlib's packages several times (as we do in the IDE)
might lead to ~ 96 MB of retained memory just by these objects.

While in fact many of them remain unused

 #KT-21517 Fixed
2018-01-22 10:48:25 +03:00
Nikolay Krasko
b701117ffb Minor: reformat, and warning fixes in outdated notification subsystem 2018-01-19 22:41:52 +03:00
Nikolay Krasko
2386cfbd07 Do not spell check overridden declaration names (KT-15000)
#KT-15000 Fixed
2018-01-19 22:41:51 +03:00
Anton Bannykh
ff00831109 JS: minor fixes in kotlin-test-js-it
Jasmine version 2.6.0 doesn't support Promise-based
asynchronous tests.
Also the error message for an unexpected test result was incorrect.
2018-01-19 20:16:31 +03:00
Ilmir Usmanov
f4ad5182b8 Fix OOM error in ReturnUnitMethodTransformer
#KT-22345: Fixed
2018-01-19 20:13:23 +03:00
Ilya Gorbunov
40aa2280a5 Replace .. with until or indices where appropriate
Replace indices.reversed() with lastIndex..0 as it is not optimized in JS yet
2018-01-19 19:53:09 +03:00
Alexander Udalov
513f50785e Use processResources task to copy compiler.xml to IDEA plugin
This fixes tests broken in 4b2d281bba and 95f9884799
2018-01-19 17:26:33 +01:00
Alexander Udalov
4b2d281bba Include META-INF/extensions/compiler.xml into IDEA plugin
This fixes tests and IDEA run configurations broken in 95f9884799
2018-01-19 15:13:40 +01:00
Mikhail Glukhikh
577c6cde82 KtInvokeFunctionReference: protect from KNPE in getLambdaExpression
So EA-114887 Fixed
2018-01-19 16:16:33 +03:00
Mikhail Glukhikh
26c1673da0 J2K: KtInvokeFunctionReference 2018-01-19 16:16:31 +03:00
Mikhail Glukhikh
117c5a29fb KtInvokeFunctionReference.java -> kt 2018-01-19 16:16:22 +03:00
Mikhail Glukhikh
b1bff24cde Move lambda inside: protect from KNPE in getLambdaExpression
So EA-114888 Fixed
2018-01-19 16:16:21 +03:00
Mikhail Glukhikh
f675d9fd81 Convert reference to lambda: protect from root fq name EA-114907 Fixed 2018-01-19 16:16:19 +03:00
Mikhail Glukhikh
3c19af3645 Convert reference to lambda: reformat 2018-01-19 16:16:18 +03:00
Mikhail Glukhikh
9d9b2b2a58 Fix stub inconsistency in "inline type parameter fix"
Fixes one quick-fix test
2018-01-19 16:16:17 +03:00
Mikhail Glukhikh
1924172189 Inline type parameter fix: reformat 2018-01-19 16:16:16 +03:00
Mikhail Glukhikh
ee3f89df87 Remove unused function parameter: delete empty constructor accurately
So #KT-22221 Fixed
Fixes also some quick-fix tests
2018-01-19 16:16:15 +03:00
Mikhail Glukhikh
c4ef95dbf7 Remove empty primary constructor: reformat 2018-01-19 16:16:13 +03:00
Mikhail Glukhikh
ac1c40c0e6 Add function to supertype fix: get rid of incorrect type comparator
So EA-100297 Fixed
2018-01-19 16:16:12 +03:00
Mikhail Glukhikh
7f947bed1e Add function to supertype fix: reformat 2018-01-19 16:16:11 +03:00
Mikhail Glukhikh
925e4e0a67 KotlinUnusedImportInspection: use LocalQuickFixOnPsiElement 2018-01-19 16:16:10 +03:00
Mikhail Glukhikh
a3dda258c8 KotlinUnusedImportInspection (minor): specify platform type 2018-01-19 16:16:09 +03:00
Mikhail Glukhikh
dade8deea6 KotlinUnusedImportInspection: reformat 2018-01-19 16:16:07 +03:00
Mikhail Glukhikh
c54dd6385c KotlinUnusedImportInspection: check for disposal of progress indicator
So #KT-22335 Fixed
2018-01-19 16:16:06 +03:00
Mikhail Glukhikh
c52fcdde70 Remove explicit type: reformat 2018-01-19 16:16:05 +03:00
Mikhail Glukhikh
512e287f3a Remove setter parameter type: do not suggest if type is empty
So #KT-22339 Fixed
2018-01-19 16:16:04 +03:00
Mikhail Glukhikh
f0b172ca35 Remove setter parameter type: reformat 2018-01-19 16:16:02 +03:00
Sergey Igushkin
c8900d672f Update Gradle plugins build instructions 2018-01-19 12:58:39 +03:00
Mikhael Bogdanov
4c1eb21805 Minor. Add assertion message 2018-01-19 10:42:02 +01:00
Nicolay Mitropolsky
2623ae714c Uast: consistency updates for ULambdaExpression 2018-01-19 10:45:58 +03:00
Nicolay Mitropolsky
25cd54713b Uast: consistency for imports-expressions 2018-01-19 10:45:58 +03:00
Nicolay Mitropolsky
d5d49c65b4 Uast: tests for UClass.uastSuperTypes 2018-01-19 10:45:58 +03:00
Mikhael Bogdanov
7b212c5650 Add support for android MPP
#KT-18462 Fixed
2018-01-18 15:21:19 +01:00
Toshiaki Kameyama
2a10d8e837 KT-15176 Remove "Create type alias" intention when called on java class 2018-01-18 16:23:40 +03:00
Dmitry Savvinov
44920f42d8 [NI] Fix unit coercion
Consider following case:

fun foo(): Unit = run { "hello" }

Previously, NI would analyze lambda body without expected type, because
it is a type variable 'R' from 'run', which hasn't been fixed yet. This
leads to treating "hello" as lambda-return argument and adding bogus
'String' constraint on 'R', and, consequently, type mismatch.

Now, we peek into current constraint system and check if return-type of
lambda is type variable with upper-Unit constraint (which is exactly
condition for its body to be Unit-coerced). If so, then we provide
expected Unit-type for body explicitly, and the rest will be done
automatically (in particular, in aforementioned example "hello" wouldn't
be treated as lambda return argument).
2018-01-18 15:13:45 +03:00
Alexander Udalov
b3eeb2f735 Remove unneeded members of ConstantValueFactory 2018-01-18 12:49:38 +01:00
Alexander Udalov
82574cb570 Do not store ClassDescriptor in EnumValue
Only store the ClassId of the enum class and the Name of the entry, and
resolve the needed descriptor in getType() instead, which now takes the
module instance where that descriptor should be resolved
2018-01-18 12:49:38 +01:00
Alexander Udalov
9290d58ed0 Improve "firstArgumentValue" and "argumentValue" extension functions
Using the argument value, which is of type "Any?", is more implicit and
thus difficult to read than using the ConstantValue instance and casting
it to the needed constant value implementation before taking the value
2018-01-18 12:49:38 +01:00
Alexander Udalov
899002b681 Refactor JavaEnumValueAnnotationArgument and implementations
Only require implementations to be able to compute the enum class name
and the corresponding entry name. Only this should be necessary to
correctly resolve the argument; the resolvers will find the
corresponding class descriptor if necessary
2018-01-18 12:49:38 +01:00
Alexander Udalov
907f53e539 Refactor ConstantValue implementations
Remove KotlinBuiltIns and take a ModuleDescriptor instance in getType
instead. This will allow to create constant values in contexts where
there's no module or built-ins accessible (such as, deserialization of
module annotations during indexing of .kotlin_module files in IDE).

Note that some values (KClassValue, EnumValue, AnnotationValue) still
take module-dependent objects (KotlinType, ClassDescriptor and
AnnotationDescriptor respectively). This is to be refactored later
2018-01-18 12:49:38 +01:00
Alexander Udalov
5e97517c8b Fix bug in StringValue.equals
Also simplify equals() implementations of other constant values
2018-01-18 12:49:38 +01:00
Alexander Udalov
95f9884799 Move META-INF/extensions/compiler.xml to module 'cli' 2018-01-18 12:48:04 +01:00
Alexander Udalov
02857dbfdb JS: support "LANGUAGE" directives in box tests 2018-01-18 12:46:27 +01:00
Alexander Udalov
8b3d439d5b JS: minor, simplify code locating default argument values
At the only call site of getDefaultArgument it is checked that the
parameter actually _declares_ default value, so it's not necessary to
try to load that value from supertypes
2018-01-18 12:46:27 +01:00
Nikolay Krasko
ae2d67a5b1 Update "Kotlin configured but no stdlib" status on file update (KT-22356)
Provide feedback before project re-import is finished.

 #KT-22356 Fixed
2018-01-18 12:13:54 +03:00
Nikolay Krasko
2637a36e22 Inspection doesn't suggest Maven Plugin for kotlin-stdlib-jre8 (KT-18007)
#KT-18007 Fixed
2018-01-18 12:13:53 +03:00
Nikolay Krasko
4a2440ea0f Reformat and cleanup idea-maven_main module 2018-01-18 12:13:53 +03:00
Mikhael Bogdanov
7f1cc81d39 Support test directives in android tests 2018-01-18 10:08:58 +01:00
Mikhael Bogdanov
ef1a3ec32d Convert CodegenTestsOnAndroidGenerator to Kotlin 2018-01-18 10:08:58 +01:00
Mikhael Bogdanov
7e6542b8c8 Renema CodegenTestsOnAndroidGenerator.java to CodegenTestsOnAndroidGenerator.kt 2018-01-18 10:08:57 +01:00
Denis Zharkov
1716720604 Optimize declaration providers for case of non-existing packages
Avoid creating memoized function nodes when the value is obviously null
Otherwise, it may lead to about 25M retained by empty concurrent hashmap
nodes
2018-01-18 11:40:26 +03:00
Denis Zharkov
0f74bb4a7a Get rid of compile dependency to 'compiler-embeddable' from :idea
Previously, it's been added transitively from :kotlin-compiler-runner
as a compile dependency instead of runtime as it's declared in compiler-runner
2018-01-18 11:39:34 +03:00
Alexey Tsvetkov
72f2406083 Turn IC on by default for MPP projects 2018-01-17 21:23:43 +03:00
Sergey Igushkin
5deb20543f Get rid of gradle-api artifacts uploaded to and used from JB repo
Remove redundant Maven dependency to `gradle-api` scoped as provided
2018-01-17 18:45:26 +03:00
Vyacheslav Gerasimov
d16883deaa Build: Clean previous output before instrumentation
Otherwise it may lead to unnecessary classes (left from previous plugin build) being packed to plugin
2018-01-17 16:57:56 +03:00
Dmitry Savvinov
c704f2de9a Reformat 'resolution' module according to new codestyle 2018-01-17 16:47:45 +03:00
Vyacheslav Gerasimov
e2b83aecd7 Fix publishing to Gradle plugin portal 2018-01-17 15:33:15 +03:00
Anton Bannykh
7b0070ea62 Promise-based async integration test for kotlin-test-js 2018-01-17 14:46:13 +03:00
Dmitry Jemerov
ca57309374 Temp revert fix for KT-10591 as it causes non-obvious test breakage 2018-01-17 11:39:35 +01:00
Alexey Sedunov
a752f3f38e Misc: Rename class 2018-01-17 12:54:39 +03:00
Alexey Sedunov
62580a47dc Misc: Add test for KT-7316
#KT-7316 Fixed
2018-01-17 12:53:57 +03:00
Alexey Sedunov
54f4f5ff24 Configuration: Add Kotlin SDK for non-JVM projects
#KT-16976 Fixed
2018-01-17 12:52:51 +03:00
Alexey Sedunov
af1d6124ce JS: Do not specify NodeJS path in Gradle projects
We rely on node_modules directory content which must be populated
by the build script itself
2018-01-17 12:45:45 +03:00
Alexey Sedunov
c6a9c36275 Analyze Data Flow: Support cross-language analysis
#KT-16833 Fixed
2018-01-17 12:40:34 +03:00
Dmitry Petrov
6cb68531ae Minor: add missing "'" 2018-01-17 12:31:07 +03:00
Dmitry Petrov
bba8168150 Add test for extension properties declaration in IR 2018-01-17 12:31:07 +03:00
Dmitry Petrov
1f841e35bc Formatting: psi2ir 2018-01-17 12:31:07 +03:00
Dmitry Petrov
432c743771 Formatting: ir.tree and some common code 2018-01-17 12:31:07 +03:00
Dmitry Petrov
fdd000c94f Update testData to new format 2018-01-17 12:31:07 +03:00
Dmitry Petrov
4d54036d21 Use declaration properties in RenderIrElementVisitor 2018-01-17 12:31:07 +03:00
Dmitry Petrov
7dc15b15bb Add basic properties to IR declarations 2018-01-17 12:31:07 +03:00
Dmitry Petrov
2f09c51dca Formatting: IR test classes 2018-01-17 12:31:07 +03:00
Nikolay Krasko
704ce121bc Use other property name in Java with Kotlin static import tests 2018-01-17 12:05:06 +03:00
Nikolay Krasko
1c7e42f1d4 Collapsed comments containing * get removed in the summary line (KT-21994)
#KT-21994 Fixed
2018-01-17 12:05:05 +03:00
Nikolay Krasko
a1b20535b2 Search same place for it usages in rainbow highlighter (KT-22242)
Reuse KotlinTargetElementEvaluator for getting same declaration
context for implicit 'it' parameter.

 #KT-22242 Fixed
2018-01-17 12:05:04 +03:00
Vyacheslav Gerasimov
f86b77083f Add sources and javadoc to kotlin-annotations-android 2018-01-16 21:19:46 +03:00
Alexey Tsvetkov
d1d786dffa Fix lookup tracking in JPS with enabled daemon
#KT-21962 fixed
2018-01-16 21:09:57 +03:00
Alexey Tsvetkov
220fab0d3f Test JPS with Daemon and IC 2018-01-16 21:09:57 +03:00
Alexey Tsvetkov
ca09be1411 Minor: move 'KotlinJpsBuildTestIncremental' to separate file 2018-01-16 21:09:57 +03:00
Nicolay Mitropolsky
b4db744a9b Uast: KotlinStringULiteralExpression.getExpressionType() made always return String 2018-01-16 20:38:00 +03:00
Dmitry Jemerov
e46f69bb36 Disable "Decompile" button if bytecode generation threw exception
#KT-13791 Fixed
2018-01-16 17:54:49 +01:00
Dmitry Jemerov
404f9cc7d8 KotlinBytecodeToolWindow: convert to .kt 2018-01-16 17:54:48 +01:00
Dmitry Jemerov
bad76eb5c2 KotlinBytecodeToolWindow: rename to .kt 2018-01-16 17:54:47 +01:00
Dmitry Jemerov
5b3ab97b4e Highlight 'var' primary constructor parameters as mutable
#KT-11467 Fixed
2018-01-16 17:54:45 +01:00
Dmitry Jemerov
571b424b33 Use DescriptorToSourceUtilsIde.getAnyDeclaration in super navigation
#KT-16333 Fixed
2018-01-16 17:54:44 +01:00
Dmitry Jemerov
cc90dfa65b GotoSuperActionHandler: convert to .kt 2018-01-16 17:54:43 +01:00
Dmitry Jemerov
690c3433d6 GotoSuperActionHandler: rename to .kt 2018-01-16 17:54:42 +01:00
Dmitry Jemerov
106e1b8661 Don't include unindented comments preceding a function into its text range
#KT-10591 Fixed
2018-01-16 17:54:29 +01:00
Dmitry Jemerov
075541da21 Show location info for members defined in object literals
#KT-22179 Fixed
2018-01-16 17:54:27 +01:00
Dmitry Jemerov
564490c9d4 Don't require presence of PropertiesComponent
#KT-22214 Fixed
2018-01-16 17:54:19 +01:00
Dmitry Jemerov
1b6f6e8bf7 Don't indent block comments of typealiases
#KT-22230 Fixed
2018-01-16 17:54:16 +01:00
Dmitry Savvinov
c2b532b167 Reformat the rest of 'frontend'-module according to new codestyle 2018-01-16 18:26:21 +03:00
Dmitry Savvinov
e5f0ffb0c2 Reformat 'frontend' module according to new codestyle 2018-01-16 17:51:51 +03:00
Kirill Rakhman
b567817d1f Make completion for overriding functions respect suspend modifier
Fixes #KT-22200
2018-01-16 15:42:03 +01:00
Kirill Rakhman
8bc020f31b Fix modifier order in generated overriden functions
Fixes #KT-21600
2018-01-16 15:42:02 +01:00
Alexey Sedunov
99be75cbfc Refactoring: Use modifier list in CallableInfo where possible 2018-01-16 17:06:53 +03:00
Alexey Sedunov
ba0a91d74c Quick Fixes: Drop deprecated KotlinCommonIntentionActionsFactory
Also update relevant test to use new action factory API
2018-01-16 17:06:53 +03:00
Alexey Sedunov
908bf71ae6 Quick Fixes: Support cross-language "Create from Usage" with Kotlin target 2018-01-16 17:06:53 +03:00
Alexey Sedunov
d44313876c Create from Usage: Support primary constructor insertion 2018-01-16 17:06:52 +03:00
Alexey Sedunov
877874978f Misc: Add action text assertions to CommonIntentionActionsTest 2018-01-16 17:06:52 +03:00
Toshiaki Kameyama
113e9f496e Add quickfix for UnsafeCastFromDynamicInspection #KT-20915 Fixed 2018-01-16 17:06:51 +03:00
Vyacheslav Gerasimov
f709a382ae Update changelog for 1.2.20 2018-01-16 16:13:54 +03:00
Alexey Sedunov
05b618eec8 Gradle: Use copyable user data for compiler plugin options
#KT-22227 Fixed
2018-01-16 16:09:18 +03:00
Alexey Sedunov
5892944bfc Convert Enum to Sealed Class: Support expect/actual classes 2018-01-16 16:09:17 +03:00
Alexey Sedunov
9d5d85a1c5 Convert Sealed Class to Enum: Support expect/actual classes
#KT-18912 Fixed
2018-01-16 16:09:17 +03:00
Natalia Selezneva
dbd7ceb5fd Fix Evaluate Expression for inline functions from multifile package class.
Find main class generated for debugger by its name instead of relativePath length.
 #KT-22311 Fixed
2018-01-16 16:00:32 +03:00
Cuihtlauac Alvarado
c5982e7ff5 Avoid pick environement variables test failures (#1467)
Remove all lines containing a "Picked up <ENVIRONMENT_VARIALBE>: ..."

Remove empty ERR: section

FIX: KT-22241
2018-01-16 12:33:19 +01:00
Mikhael Bogdanov
b539adf105 Support simple capturing in IR inliner 2018-01-16 11:53:25 +01:00
Mikhael Bogdanov
ca22bc57fd Don't capture primary constructor variables 2018-01-16 11:53:25 +01:00
Mikhael Bogdanov
28f4cc5b18 Generate parameter name in assertion for lateinit properties 2018-01-16 11:53:24 +01:00
Mikhael Bogdanov
e58558dffd Support mapped companions 2018-01-16 11:53:24 +01:00
Mikhael Bogdanov
e57efc7233 Support external functions 2018-01-16 11:53:23 +01:00
Mikhael Bogdanov
c1a1a7f9fb Code clean 2018-01-16 11:53:22 +01:00
Mikhael Bogdanov
9d7eca1376 Support throwNpe intrinsic 2018-01-16 11:53:22 +01:00
Mikhael Bogdanov
d62a7cc9d1 Unwrap fake override on field access 2018-01-16 11:53:21 +01:00
Mikhael Bogdanov
dfbe92344f Skip setter accessors for val 2018-01-16 11:53:21 +01:00
Mikhael Bogdanov
2b95e6bc0d Generate proper vararg array 2018-01-16 11:53:20 +01:00
Mikhael Bogdanov
724f3bf714 Return proper type after coercion 2018-01-16 11:53:20 +01:00
Mikhael Bogdanov
77b93ab7ad Add classType property in IrClassReference, support class references in codegen 2018-01-16 11:53:19 +01:00
Mikhael Bogdanov
b2970ef771 Skip noinline lambdas during inline 2018-01-16 11:53:19 +01:00
Mikhael Bogdanov
ab96e0102a Support IrGetClass 2018-01-16 11:53:18 +01:00
Mikhael Bogdanov
9a1f484771 Fix equals 2018-01-16 11:53:18 +01:00
Nicolay Mitropolsky
d7f0695a51 Uast: KotlinNullabilityUAnnotation.javaPsi type set to PsiAnnotation? 2018-01-16 13:26:22 +03:00
Ilya Chernikov
c7f8312e1b Shade kotlinx.coroutines in embeddable artefacts
fixes #KT-22196
2018-01-16 09:03:53 +01:00
Sergey Igushkin
3ed7df506b Bump bootstrap to 1.2.30-dev-441 2018-01-15 22:38:28 +03:00
Nicolay Mitropolsky
9ce9b434fe Uast: testdata fix for KotlinUastTypesTest.testEa101715 2018-01-15 20:58:18 +03:00
Denis Zharkov
886d3ef3a6 Optimize KotlinScriptDefinitionFromAnnotatedTemplate::isScript
Avoid multiple pattern compilation for script file regex
2018-01-15 18:20:27 +03:00
Denis Zharkov
b4e5f8cf1c Optimize collecting module info in IDE
The problem was that there is no special entity for libraries
in the IntelliJ model, and when we have an element for a library
we have to search through all of its dependencies
(see getOrderEntriesForFile call in collectInfosByVirtualFile)

But for popular library there could be quite a lot of dependencies,
while in most cases we need only the first one to obtain module
info for library itself (see changed usage in resolverForElement).

So it's worth replacing List with Sequence here
2018-01-15 18:20:27 +03:00
Denis Zharkov
d848238a46 Add cache for Module::languageVersionSettings
It might be useful because getExtraLanguageFeatures might be
rather expensive to compute

 #KT-21450 Fixed
2018-01-15 18:20:27 +03:00
Dmitry Jemerov
60874f29fe Inspection for scope functions conversion
#KT-17047 Fixed
2018-01-15 15:37:36 +01:00
Dmitry Jemerov
0b24be9460 Don't enclose 'this' in braces inside string templates 2018-01-15 15:03:39 +01:00
Dmitry Jemerov
560dc920e4 Don't increase nesting level if we aren't processing current expression 2018-01-15 15:03:39 +01:00
Dmitry Jemerov
3a7e4acf22 Reformat and cleanup 2018-01-15 15:03:39 +01:00
Dmitry Jemerov
d15fa83749 API for building visitors from lambdas 2018-01-15 15:03:39 +01:00
Nikolay Krasko
46ac14198c Don't try to cast light element to KtElement (EA-114820) 2018-01-15 14:05:51 +03:00
Nikolay Krasko
adf6ad6283 Check file before cast in KotlinCompletionContributor (EA-101984) 2018-01-15 14:05:50 +03:00
Nikolay Krasko
eae79e96ee Fix NPE in PlainTextPasteImportResolver.tryResolveReferences (EA-10589) 2018-01-15 14:05:50 +03:00
Nikolay Krasko
93d40b0492 Fix NPE in SourceNavigationHelper.findFirstMatchingInIndex (EA-91517) 2018-01-15 14:05:50 +03:00
Nikolay Krasko
2ca7045228 Rewrite KotlinNameSuggesterTest test with KotlinLightCodeInsightFixtureTestCase
Use proper project descriptors and avoid reconfigure for test project.
2018-01-15 14:05:50 +03:00
Ilmir Usmanov
ed11528664 Ignore unreachable code on tail call optimization
#KT-21759: Fixed
2018-01-15 12:57:10 +03:00
Ilmir Usmanov
25998c1f9b Reformat tail call optimization related code 2018-01-15 12:56:54 +03:00
Yan Zhulanow
2ee23ddd02 EA-101715: Handle also case with IntegerValueTypeConstructor 2018-01-15 12:39:35 +09:00
Yan Zhulanow
108e91f2a2 Kapt: Be less strict when it's impossible to add a generated Kotlin source directory for Android project (KT-22056, EA-114271) 2018-01-15 12:39:34 +09:00
Yan Zhulanow
283c762b8b Kapt: Remove laziness from diagnosticFactory and javacMessages, use factory from supertype (KT-22189)
writeDiagnostic() may be invoked after the 'context' is cleared, and lazy implementations will fail.
2018-01-15 12:39:34 +09:00
Yan Zhulanow
192489ae66 Minor: Remove bulk class added by mistake 2018-01-15 12:39:33 +09:00
Yan Zhulanow
1c5cd1b3a0 Minor: Fix problem in IDE with @TestOnly annotation resolution 2018-01-15 12:39:32 +09:00
Yan Zhulanow
81aae03b57 Use Gradle API to import annotations from compiler plugins instead of nasty data storage tasks
Tasks itself will be left for some time until all users migrate to the newer IDE plugin versions.
2018-01-15 12:39:31 +09:00
Yan Zhulanow
e7c1d94c0f Minor: Fix red code in IDE 2018-01-15 12:39:30 +09:00
Yan Zhulanow
e978c42e52 SamWithReceiver: Add Maven/Gradle importers for SamWithReceiver 2018-01-15 12:39:30 +09:00
Yan Zhulanow
0a3a493f25 AllOpen: Fix incorrect 'accessing non-final property in constructor' warning (KT-16619) 2018-01-15 12:39:29 +09:00
Yan Zhulanow
df19162c8c Kapt: Store line information in a file doc comment, instead of annotations (KT-21936) 2018-01-15 12:39:28 +09:00
Yan Zhulanow
c66947ba40 NoArg: Parse 'invokeInitializers' option in Maven importer (KT-19900) 2018-01-15 12:39:27 +09:00
Yan Zhulanow
3512675d96 Compiler plugins: Refactor Maven import handlers in order to support other plugin options 2018-01-15 12:39:26 +09:00
Yan Zhulanow
a85b4ddb0f Kapt: Clear stubs directory on non-incremental stub generation (KT-21735) 2018-01-15 12:39:25 +09:00
Nicolay Mitropolsky
f4a7ecc1bb Uast: Fix for missing local variables in ctor-s bodies
similar to how it is done in `KotlinUBlockExpression`
2018-01-12 22:32:52 +03:00
Dmitry Jemerov
322ac6340a Fix GradleConfigureProjectByChangingFileTestGenerated 2018-01-12 18:58:04 +01:00
Anton Bannykh
c6d7ffb3eb JS DCE: drop unknown file report severity to WARNING
*.kjsm and other files might be received when FileCollection is
used in Gradle as a dependency.

Example: `testCompile project(":$coroutines_core").sourceSets.test.output`
(a popular-ish solution to introduce dependencies between tests)
2018-01-12 20:00:34 +03:00
Anton Bannykh
5d6d321fb2 Reformat K2JSDce.kt 2018-01-12 20:00:34 +03:00
Dmitry Jemerov
ce5b1acfa7 Regenerate tests 2018-01-12 16:59:31 +01:00
Alexander Podkhalyuzin
b8dded2685 Simple implementation for kt paste into project view #KT-8352 Fixed 2018-01-12 15:57:34 +03:00
Alexander Udalov
b925b6ef9f Add test for obsolete issue
#KT-10494
2018-01-12 12:50:38 +01:00
Nikolay Krasko
aee7329b89 Modify incremental test in 173 branch - files are not created anymore 2018-01-12 13:54:45 +03:00
Nikolay Krasko
5a6d58a799 Update to 2017.3.2 (173.4127.27) 2018-01-12 13:54:43 +03:00
Nikolay Krasko
4c09a6cf06 Allow different diagnostics in Javac tests - workaround for IDEA-184289 2018-01-12 13:54:42 +03:00
Nicolay Mitropolsky
27b3cdf1fa Uast: KotlinAccessorCallExpression made implement JvmDeclarationUElement 2018-01-12 13:54:41 +03:00
Nicolay Mitropolsky
254caef0e6 Idea version set to 173.3942.27 2018-01-12 13:54:39 +03:00
Nicolay Mitropolsky
f8601479de Uast: handling @receiver annotations 2018-01-12 13:54:38 +03:00
Nicolay Mitropolsky
f91f42c253 Uast: Constructors.kt testdata fixes 2018-01-12 13:54:36 +03:00
Nicolay Mitropolsky
2c81362ce1 Uast: uastParent made final in KotlinAbstractUElement 2018-01-12 13:54:35 +03:00
Nicolay Mitropolsky
e7200d16c3 Uast: no more need to exclude UIdentifier from JvmDeclarationUElement check 2018-01-12 13:54:33 +03:00
Nicolay Mitropolsky
e22e466485 Uast: making AbstractKotlinUClass not inherit from AbstractJavaUClass 2018-01-12 13:54:32 +03:00
Nicolay Mitropolsky
084da3665a Uast: removing java-uast usage from KotlinUastLanguagePlugin and KotlinEnumConstantClassReference 2018-01-12 13:54:31 +03:00
Nicolay Mitropolsky
260c549cd7 Uast: AbstractKotlinUVariable annotations now are retrieved from Kotlin Psi, not from compiled (KT-21025)
and `KotlinNullabilityUAnnotation` now is created for every `AbstractKotlinUVariable`
2018-01-12 13:54:29 +03:00
Nicolay Mitropolsky
f0723a5c07 Uast: WrappedUAnnotation as replacement for usage of JavaUAnnotation (KT-21025) 2018-01-12 13:54:28 +03:00
Vyacheslav Gerasimov
53d6c17417 Set correct until-build for Idea 173 plugin 2018-01-12 13:54:26 +03:00
Nicolay Mitropolsky
a278e4ccef Fixing non-running tests, that used MockApplication environment 2018-01-12 13:54:25 +03:00
Alexey Sedunov
c1cf03d89c Data Inflow: Support grouping by expression nullability 2018-01-12 13:54:23 +03:00
Nicolay Mitropolsky
0a1580159f Uast: Constructors.kt testData fixes 2018-01-12 13:54:22 +03:00
Alexey Sedunov
683bbe396d Data Inflow: Support grouping by leaf expressions 2018-01-12 13:54:20 +03:00
Alexey Sedunov
b46784ab86 Safe Delete: Suppress walking through light field initializer
This fixes some tests failing in 173 branch

 #KT-21508 Fixed
2018-01-12 13:54:19 +03:00
Nikolay Krasko
cbfd7088bf Fix inAnnotation test in 173 branch 2018-01-12 13:54:17 +03:00
Nikolay Krasko
c0582ed732 Update file name replace in QuickFix tests 2018-01-12 13:54:16 +03:00
Nicolay Mitropolsky
502a6fa9f1 Uast: SuperCalls.render.txt testdata fix 2018-01-12 13:54:14 +03:00
Nicolay Mitropolsky
5f6e5c5779 Uast: AbstractKotlinUClass compilation fix 2018-01-12 13:54:13 +03:00
Nicolay Mitropolsky
b51a7c6957 Spring: fix for package-completion tests
because otherwise `java` package name interfere with `java` directory name completion from somewhere
2018-01-12 13:54:12 +03:00
Nicolay Mitropolsky
1fd8abb0bb Spring: removing needless EP-s because they ported to UAST in platform 2018-01-12 13:54:10 +03:00
Nicolay Mitropolsky
79abc8743e KotlinSpringComponentScanInspection made to support platform JamReferenceContributor 2018-01-12 13:54:09 +03:00
Vyacheslav Gerasimov
0cad41bb0c Drop missing gradle extensions from gradle.xml 2018-01-12 13:54:07 +03:00
Nikolay Krasko
23bd0b3db5 Update test data because of changed action name in 173 2018-01-12 13:54:06 +03:00
Nicolay Mitropolsky
29fd34d1de Idea version set to 173.3727.22(RC1) 2018-01-12 13:54:05 +03:00
Nicolay Mitropolsky
8c27bf98f4 UAST: StringTemplateComplex testdata fix 2018-01-12 13:54:03 +03:00
Alexey Sedunov
f3dad53ad4 Line Markers: Respect subclass module when filtering out duplicates
#KT-21010 Fixed
2018-01-12 13:54:02 +03:00
Alexey Sedunov
d37c8397f5 Move: Fix applicability check in IDEA 173 2018-01-12 13:54:00 +03:00
Vyacheslav Gerasimov
ab50ccf995 Fix formatting for new kotlin dsl gradle project build script 2018-01-12 13:53:59 +03:00
Vyacheslav Gerasimov
560e2d1ced Drop new Kotlin Dsl gradle project wizard which has been merged to idea 2018-01-12 13:53:58 +03:00
Nicolay Mitropolsky
aa43bebbf1 SpringTestFixtureExtension: option to forbid facet autoconfigure added 2018-01-12 13:53:56 +03:00
Nicolay Mitropolsky
3a06b8fe3b SpringKotlinAutowiringInspection: getting rid of SpringJavaInjectionPointsAutowiringInspection 2018-01-12 13:53:55 +03:00
Nicolay Mitropolsky
bef100b46e AbstractIntentionTest: isApplicableOnPooled made run under ProgressIndicator 2018-01-12 13:53:53 +03:00
Vyacheslav Gerasimov
09f31076e6 Update ideaVersion to 173.3415.22 2018-01-12 13:53:52 +03:00
Nicolay Mitropolsky
2f30ca3fac Ultimate-plugin: UAST added as dependency 2018-01-12 13:53:51 +03:00
Nicolay Mitropolsky
f4a8a98157 Ultimate-plugin: multiplePropertiesAnnotationConfig.kt test data fixes
`@Qualifier` should not be there. It was a bug in platform
2018-01-12 13:53:49 +03:00
Nicolay Mitropolsky
6cb556dd6b AbstractQuickFixTest: FORCE_PACKAGE_FOLDER directive added
It was added as workaround for IDEA-176033 (IDEA-176032 in particular)
2018-01-12 13:53:48 +03:00
Nicolay Mitropolsky
ab0c081897 AbstractExtractionTest: fix for invalid files
`configureByFile` should be run after other configurations (like `configureKotlinRuntimeAndSdk`) because they could make configured file invalid
2018-01-12 13:53:46 +03:00
Nicolay Mitropolsky
dd45780de9 RecursiveMethodCallMarkerInfo and SuspendCallMarkerInfo forced to target Leaf-elements
because of restriction added in IDEA 173
2018-01-12 13:53:45 +03:00
Nicolay Mitropolsky
34bdc04fbe AbstractNavigateToLibraryTest: fix for invalid files
otherwise current file is invalidated by `configureAs` and `additionalConfig`
2018-01-12 13:53:44 +03:00
Nicolay Mitropolsky
7758875955 EdtTestUtil.runInEdtAndWait fix for proper user action emulation
changed because `com.intellij.ide.IdeEventQueue` doesn't consider events from `SwingUtilities.invokeAndWait` as user interaction
2018-01-12 13:53:42 +03:00
Nicolay Mitropolsky
0acfce55a8 KotlinCoreEnvironment: set ideaCompatibleBuildNumber = "173.1" 2018-01-12 13:53:41 +03:00
Nicolay Mitropolsky
6bfe168dd7 UAST: SimpleKotlinRenderLogTest.testWhenAndDestructing testdata fix 2018-01-12 13:53:39 +03:00
Nicolay Mitropolsky
8a23a62c90 AbstractJavaToKotlinConverterForWebDemoTest: setup fix: JvmElementProvider and JavaModuleSystem added 2018-01-12 13:53:38 +03:00
Mikhail Glukhikh
8810e15f08 ExpressionOfTypeProcessor: get member name in read action 2018-01-12 13:53:36 +03:00
Mikhail Glukhikh
3f9054b28b Fix find usages tests in 173 (run via ProgressIndicator) 2018-01-12 13:53:35 +03:00
Nicolay Mitropolsky
cfcee0a1fe Workaround for CoreEnvironment initialization: explicitly setting versions for extensions 2018-01-12 13:53:34 +03:00
Nicolay Mitropolsky
6b656d4da5 Spring gutter icons SpringApiIcons -> SpringApiIcons.Gutter fix.
Following the patch in idea https://upsource.jetbrains.com/IDEA/revision/ultimate-527b9189219f191b62eed59d699f57acccda05c3
2018-01-12 13:53:32 +03:00
Nicolay Mitropolsky
099c1a84ec Idea version set to 173.3302.8 2018-01-12 13:53:31 +03:00
Nikolay Krasko
60149e3021 Update file structure tests as FileStructurePopup api was changed in 173 2018-01-12 13:53:29 +03:00
Nicolay Mitropolsky
f5e3a5faa4 Spring-Kotlin: Gutter repaired (KT-20550, KT-20566)
Platform now allows Gutter to be placed only on leafs elements, this patch fixes it for `KotlinSpringClassAnnotator`.
2018-01-12 13:53:28 +03:00
Ilya Gorbunov
9e21744bf5 streamex version was changed in 173-snapshot to 0.6.5 2018-01-12 13:53:27 +03:00
Nicolay Mitropolsky
208a986eab UAST: support for JvmDeclarationUElement 2018-01-12 13:53:25 +03:00
Nicolay Mitropolsky
f1579d01af UAST test data fixes: LocalVariableWithAnnotationKt fix for variable type
it is not clear for me why it was not `String`
2018-01-12 13:53:24 +03:00
Nicolay Mitropolsky
7c3c59de00 UAST test data fixes: @null in render
as a "nullability" annotation for primitive types
2018-01-12 13:53:22 +03:00
Nicolay Mitropolsky
9fed8f1d24 idea-version set to since-build="173.1" until-build="181.*" 2018-01-12 13:53:21 +03:00
Vyacheslav Gerasimov
ceaa34201e Fix GradleNoduleBuilder use qualified names check 2018-01-12 13:53:19 +03:00
Nicolay Mitropolsky
4c775a9516 JvmFacade-related tests repair 2018-01-12 13:53:18 +03:00
Simon Ogorodnik
7da9268e10 Fix proguard settings for 173 (ignore com.intellij.util.io.TarUtil) 2018-01-12 13:53:16 +03:00
Simon Ogorodnik
f940c0b86f Fix compilation in 173 (GradleModuleBuilder.java) 2018-01-12 13:53:15 +03:00
Anton Bannykh
4f97040ce5 Fix compilation (MockParameterInfoUIContext.java)
(cherry picked from commit 21b0956)
2018-01-12 13:53:14 +03:00
Nicolay Mitropolsky
7eb2d0d185 KotlinLanguageInjector using Registry to enable annotation injections
(cherry picked from commit 8bdfeb7)
2018-01-12 13:53:12 +03:00
Simon Ogorodnik
12daf4389e Fix compilation in 173 (MockParameterInfoUIContext.java) 2018-01-12 13:53:11 +03:00
Dmitry Jemerov
53a3d08a0e Fix compatibility with BuildScriptDataBuilder API changes 2018-01-12 13:53:09 +03:00
Nicolay Mitropolsky
d7fcc69315 KotlinLanguageInjector#injectInAnnotationCall optimization: using PsiClassNamePatternCondition to avoid calling getResolvedCall 2018-01-12 13:53:08 +03:00
Nicolay Mitropolsky
81b6a61edf KotlinLanguageInjector can inject into files modified for autocompletion 2018-01-12 13:53:07 +03:00
Nicolay Mitropolsky
1435911437 KotlinLanguageInjector understands patterns-injections into Java annotations 2018-01-12 13:53:05 +03:00
xiexed
743dc80b4d KtLightAbstractAnnotation build fix for 173 (#1283) 2018-01-12 13:53:04 +03:00
Dmitry Jemerov
70caae4c6f Register new service and EPs added in 173 2018-01-12 13:53:02 +03:00
xiexed
defb5a9d10 Fixes for 173 after 28.08.17 changes in IDEA (#1271)
* `JarFileSystem.getJarRootForLocalFile` now is nullable in IDEA

* Spring-related renamings following ones in IDEA
2018-01-12 13:53:01 +03:00
Nicolay Mitropolsky
6690f9f1da Build fix for KotlinSpringClassAnnotator after collectNavigationMarkers nullability changes in IDEA 173 2018-01-12 13:52:59 +03:00
Vyacheslav Gerasimov
3f15f7a394 UAST: Fix testPropertyWithAnnotation 2018-01-12 13:52:58 +03:00
Vyacheslav Gerasimov
e6efaaf752 UAST: Add testConvertTypeInAnnotation 2018-01-12 13:52:56 +03:00
Vyacheslav Gerasimov
92c23aa0ed UAST: override getFunctionalInterfaceType + test 2018-01-12 13:52:55 +03:00
Vyacheslav Gerasimov
8eddb10870 UAST: Properly handle annotations on local variables 2018-01-12 13:52:54 +03:00
Vyacheslav Gerasimov
35fa8efbf3 Fix compilation after moving to idea 173 2018-01-12 13:52:52 +03:00
Vyacheslav Gerasimov
8f7a354592 Download IDEA 173.3188.16 2018-01-12 13:52:51 +03:00
Nikolay Krasko
2a0b7e293f Minor: KotlinCodeFragmentFactory.kt cleanup 2018-01-11 22:08:18 +03:00
Natalia Selezneva
4d6c83b5b9 Debugger: do not fail if j2k couldn't convert expression creating codeFragment from text 2018-01-11 22:08:17 +03:00
Ilmir Usmanov
c023831a00 Ignore open modifier on top-level suspend function when generating light classes
#KT-21642: Fixed
2018-01-11 19:33:47 +03:00
Nikolay Krasko
5da156e93c Setup modules before test configuration in NavigateToStdlibSourceTest.kt 2018-01-11 15:03:03 +03:00
Nikolay Krasko
91a9d3cf80 Search class after full test configuration in AbstractHierarchyWithLibTest 2018-01-11 15:02:14 +03:00
Nikolay Krasko
2f817662d5 Process only project scope in AbstractHierarchyWithLibTest 2018-01-11 15:01:47 +03:00
Nikolay Krasko
8ade03ac0b Avoid using mock JDK because of bad cast in ProjectJdkTableImpl.getState
com.intellij.openapi.projectRoots.impl.MockSdk cannot be cast to com.intellij.openapi.projectRoots.impl.ProjectJdkImpl
2018-01-11 15:00:57 +03:00
Nikolay Krasko
e710cbb0bb Don't fail during error reporting on invalid elements 2018-01-11 14:56:32 +03:00
Alexander Udalov
2593ce73f1 Update copyright in generated sources
To fix tests that are checking that the generated data is up to date
2018-01-11 12:45:36 +01:00
Nicolay Mitropolsky
9cb62d66cb KtLightAnnotation: handling vararg with single arg (EA-114679)
It is deprecated but yet possible form of usage
2018-01-11 14:05:15 +03:00
Ilya Gorbunov
6197c5bf7f Add sample for coerceIn with floating point range
#KT-20357
2018-01-11 09:05:28 +03:00
Ilya Gorbunov
8fc83e3ff5 Add samples for coerceIn, coerceAtLeast, coerceAtMost for comparable types
#KT-20357
2018-01-11 09:05:28 +03:00
shiraji
17573a3c21 Add samples for coerceIn
#KT-20357
2018-01-11 09:05:28 +03:00
shiraji
4559da9848 Add samples for coerceAtMost
#KT-20357
2018-01-11 09:05:28 +03:00
shiraji
db607e231c Add samples for coerceAtLeast
#KT-20357
2018-01-11 09:05:27 +03:00
kenji tomita
1db0e5c23e Add samples for reversed list views
#KT-20357
2018-01-11 09:05:27 +03:00
AdamMc331
2fc26ba08f Added samples for property delegates as part of KT-20357. 2018-01-11 09:05:27 +03:00
Vyacheslav Gerasimov
892e901f35 Update changelog for 1.2.20 2018-01-10 20:32:05 +03:00
Ilmir Usmanov
32a94c70e9 Use tail call optimization if ARETURN has multiple sources
#KT-21977: Fixed
2018-01-10 20:14:32 +03:00
Ilmir Usmanov
5dbab2f907 Disable tail call optimization, if the call is inside try block
#KT-21165: Fixed
2018-01-10 20:13:55 +03:00
Denis Zharkov
3cfe43f83a Add -Xsupport-compatqual-checker-framework-annotations flag
It's implemented through Jsr305State while it's not related
to jsr-305 becasue currently it's the most convenient way
to introduce the flag.

Probably, it's worth renaming Jsr305State to something more abstract
like NullabilityAnnotationsConfiguration

 #KT-21982 Fixed
2018-01-10 17:02:46 +03:00
Simon Ogorodnik
40706de3db Add ability to resolve kdoc links from package view 2018-01-10 16:37:07 +03:00
Alexey Sedunov
75ce68197f Configuration: Fix API version UI update on language version change
#KT-21979 Fixed
 #KT-21980 Fixed
2018-01-10 16:24:30 +03:00
Alexey Sedunov
9d1fbbd1c6 Move: Correctly determine target module for deferred files 2018-01-10 16:24:28 +03:00
Alexey Sedunov
253c5f2d9b Gradle: Compile Gradle models/model builders for plugins under JVM 1.6
This prevents imports failure in projects using older versions of Gradle
2018-01-10 16:24:27 +03:00
Alexey Sedunov
258bd1e8c0 Maven: Fix <args> parsing on import to the Kotlin facet
#KT-22153 Fixed
2018-01-10 16:24:25 +03:00
Ilya Chernikov
6f135e89d7 Make daemon starting more tolerant to the failures - retry
(cherry picked from commit 386cfec)
2018-01-10 13:38:20 +01:00
Ilya Gorbunov
c8bd623d69 Samples: add some operations to do with the constructed ranges 2018-01-10 15:32:51 +03:00
kenji tomita
4cb2b12f01 Add samples for range construction operators 2018-01-10 15:32:50 +03:00
Andre Perkins
31d650a041 Add sample for emptySet 2018-01-10 15:32:50 +03:00
Jake Wharton
11696ac4c0 Implement String.toBoolean() for JS.
#KT-16348
2018-01-10 15:32:49 +03:00
Dmitry Jemerov
86c10b635a Initial implementation of method separators
#KT-13029 Fixed
2018-01-10 13:17:33 +01:00
Dmitry Jemerov
fd01351740 Implement display of code construct start for Kotlin
#KT-20470 Fixed
2018-01-10 13:17:33 +01:00
Dmitry Jemerov
968e6ecde4 KotlinPairMatcher: convert to .kt
(cherry picked from commit 0bc4f26)
2018-01-10 13:17:33 +01:00
Dmitry Jemerov
0c429857de KotlinPairMatcher: rename to .kt
(cherry picked from commit e386c35)
2018-01-10 13:17:33 +01:00
Nicolay Mitropolsky
4a4bf5635d Uast: KtLightAnnotation converting support (KT-21702) 2018-01-10 15:12:12 +03:00
Dmitry Jemerov
99a9634609 Don't generate references to eap-1.1 and eap-1.2 repositories
Now all Kotlin EAP releases are published only to kotlin-eap on Bintray
2018-01-10 12:13:02 +01:00
Dmitry Petrov
5ffd6a737e Closures in scripts have outer expression
#KT-22029 Fixed Target versions 1.2.30
2018-01-10 14:08:56 +03:00
Dmitry Petrov
d25ebadf53 Minor: formatting 2018-01-10 14:08:56 +03:00
Dmitry Jemerov
e80dae1802 Update copyright in generated tests 2018-01-10 11:55:28 +01:00
Dmitry Jemerov
5ec5807399 TestGenerator: J2K 2018-01-10 11:20:57 +01:00
Dmitry Jemerov
993db696ec TestGenerator: rename to .kt 2018-01-10 11:19:25 +01:00
Dmitry Jemerov
da678a4be2 Use new JRE chooser in Kotlin script run configuration 2018-01-09 18:43:21 +01:00
Dmitry Jemerov
ebc9c217c1 Get rid of PluginJetFilesProvider, use a more sane impl instead 2018-01-09 18:43:20 +01:00
Dmitry Jemerov
685d38218d Extension point for detecting build system type used in project
Now we use a non-deprecated way to detect Maven modules
2018-01-09 18:43:19 +01:00
Dmitry Jemerov
0ca2117ac7 Remove the usages of some of the deprecated APIs 2018-01-09 18:43:11 +01:00
Dmitry Jemerov
361824e170 Fix HighlightingTestGenerated and LambdaImplicitHintsTest 2018-01-09 18:04:39 +01:00
Dmitry Jemerov
8c7f57ca83 Honor "Use continuation indent in argument lists" for indent by Enter
#KT-22121 Fixed
2018-01-09 15:41:21 +01:00
Dmitry Jemerov
d79ac58340 Refactoring: replace WrappingStrategy interface with lambda 2018-01-09 15:41:20 +01:00
Dmitry Jemerov
67897d9b3d Don't wrap argument list containing anonymous functions
Just like for objects and lambdas, don't consider line breaks inside
anonymous functions as line breaks inside argument list
2018-01-09 15:41:18 +01:00
Dmitry Jemerov
a5cc9809ac Improved logic for chained lambda indentation
#KT-22071 Fixed
2018-01-09 15:41:17 +01:00
Dmitry Jemerov
54c262c505 Use receiver type of extension members as qualifier in Goto Symbol
#KT-17217 Fixed
2018-01-09 15:41:15 +01:00
Dmitry Jemerov
0104ed7d44 Show line marker navigation actions in Alt-Enter menu
#KT-14951 Fixed
2018-01-09 15:41:09 +01:00
Dmitry Jemerov
63af3c8e03 Delegate Ctrl-Shift-Enter to plain handler if needed
#KT-11503 Fixed
2018-01-09 15:32:22 +01:00
Dmitry Jemerov
f36f85f55c Don't require documentation in test sources
#KT-21837 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
165ac97c4b SortModifiersInspection detects modifiers before annotations
#KT-22013 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
408c753837 Check that a file with .kt extension is actually a KtFile
#KT-22111 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
69c8da7403 Cleanup: apply all inspection quickfixes 2018-01-09 13:54:56 +01:00
Dmitry Jemerov
6f722d647f Reformat 2018-01-09 13:54:56 +01:00
Dmitry Jemerov
6299e0e941 Check correct element to determine if 'if' rbrace needs wrapping
#KT-22093 Fixed
2018-01-09 13:54:56 +01:00
Dmitry Jemerov
e9ca6a6038 Call arguments should not affect parameter names returned in MethodInfo
The parameter names are only used for blacklist filtering, and should
correspond only to the function being called; the order and number of
actually provided arguments does not matter.
2018-01-09 13:49:03 +01:00
Dmitry Jemerov
599bb878f1 Rename test to correspond to the name of code under test 2018-01-09 13:49:02 +01:00
Dmitry Jemerov
78682ac493 Respect imports when rendering class names in type hints
#KT-19524 Fixed
2018-01-09 13:49:01 +01:00
Dmitry Jemerov
45282af38b Prototype of inlay hints for suspending calls (KT-20187) 2018-01-09 13:48:31 +01:00
Dmitry Jemerov
d060203896 Don't show type hints for SAM constructors
#KT-22050 Fixed
2018-01-09 13:34:11 +01:00
Dmitry Jemerov
0991dba626 Better position of argument name hint for multiline varargs
#KT-20614 Fixed
2018-01-09 13:34:10 +01:00
Dmitry Jemerov
6c23d3a220 Show inlay hints for implicit parameters and receivers of lambdas
#KT-20533 Fixed
2018-01-09 13:34:09 +01:00
Dmitry Jemerov
da157fafdc Add inlay hints for values returned from lambdas
#KT-20067 Fixed
2018-01-09 13:34:01 +01:00
Dmitry Jemerov
e558837214 Cleanup: better function name 2018-01-08 14:41:49 +01:00
Toshiaki Kameyama
3b212558e2 KT-21949 Please add a separate Color Scheme settings for properties synthesized from Java accessors (#1458) 2018-01-08 13:04:43 +01:00
Toshiaki Kameyama
19c35ef48c KT-21213 multiline kdoc - intellij joins lines together without space (#1459)
* KT-21213 multiline kdoc - intellij joins lines together without space

* Use \n directly as a line separator #KT-21213

* Remove unused import #KT-21213
2018-01-05 15:29:11 +01:00
Dmitry Jemerov
d51dd97156 Avoid exception from DocumentImpl.setInBulkUpdate in reformat inspection
#KT-21036 Fixed
2018-01-04 19:03:55 +01:00
Toshiaki Kameyama
266b40b654 KT-21974 Editor color scheme option for Kotlin typealias names (#1457) 2018-01-04 17:39:39 +01:00
Sergey Igushkin
06903f803b (minor) Separate the Gradle annotations from CompilerArgumentAware 2018-01-03 22:14:23 +03:00
Sergey Igushkin
d881efdeb1 Improve disambiguation of subplugin option inputs
The original approach required evaluating the existing input properties
of the task. This led to evaluation of the property values, and could
execute incorrectly if the task was not properly initialized at that
moment.
The new approach fixes that by first grouping options from each
subplugin by key and then adding disambiguating index suffixes.
2018-01-03 22:14:23 +03:00
Sergey Igushkin
1be9e04797 Move conditional task caching setup into the task constructors;
Add 'kotlin.caching.enabled' flag to switch the caching for all tasks;
Rename and change semantics of cache support checks: make two instead
    of one, `isBuildCacheSupported` and `isBuildCacheEnabledForKotlin`;
Remove FileOptionKind entries that are redundant at the moment;
Improvements in BuildCacheIT.kt and other refactoring  suggestions from
    the review
    https://upsource.jetbrains.com/kotlin/review/KOTLIN-CR-1647
2018-01-03 22:14:22 +03:00
Sergey Igushkin
fd066ea4d5 Fix top-level property of an API-level-dependent class: move to the body 2018-01-03 22:14:22 +03:00
Sergey Igushkin
c5a88c5fb7 Add BuildCacheRelocationIT, remove same files testing as redundant. 2018-01-03 22:14:22 +03:00
Sergey Igushkin
6bea643176 Fix JS DCE classpath duplicated in two input properties
* Do not add the classpath elements to source to avoid them being
  treated as task inputs without proper classpath normalization
* Move resolution of the classpath configuration to execution time
2018-01-03 22:14:22 +03:00
Sergey Igushkin
67b5527c68 Fix Kotlin destination dir added to Java task without normalization.
Issue #KT-20604 Fixed
2018-01-03 22:14:22 +03:00
Sergey Igushkin
97edda44c8 Turn on relocatable build cache -- change PathSensitivity to RELATIVE 2018-01-03 22:14:22 +03:00
Sergey Igushkin
c852d0b6cb Subplugin options refactoring & Gradle input improvements
Introduce FilesSubpluginOption Special kind of SubpluginOption that
holds a list of files together with the kind of these files with respect
to the task.

Add a logic for handling such options and converting them into
task inputs.

Refactor CompilerPluginOptions: make it store subplugin options to be
able to add options from KotlinCompile to the kapt tasks.

Introduce WrapperSubpluginOption for encoded and complex options.

Remove pluginOptions from the Gradle inputs built from the
compiler args.

Do not cache Kotlin compilation with kapt1 enabled: since we are going
to drop kapt1 it anyway, there's no point in implementing
proper cache for it, so just disable the caching of the task in case
kapt1 is used.
2018-01-03 22:14:22 +03:00
Sergey Igushkin
93097014a0 Add integration tests for Gralde build cache support.
Add an up-to-date'ness test for subplugin options.
2018-01-03 22:14:21 +03:00
Sergey Igushkin
57f710c931 Explicit opt-in switch for Kapt caching. 2018-01-03 22:14:21 +03:00
Sergey Igushkin
7ee3b81939 Add Kotlin sources output as a separate output directory for kapt. 2018-01-03 22:14:21 +03:00
Sergey Igushkin
4a69d1545b Disable IC when IC cache is missing
Check task build directory for any files
2018-01-03 22:14:21 +03:00
Sergey Igushkin
14c80baec8 Make the tasks cacheable, add logic that decides whether to cache them 2018-01-03 22:14:21 +03:00
Sergey Igushkin
26c158cbae Annotate the properties with @PathSensitive (+ override source) 2018-01-03 22:14:21 +03:00
Sergey Igushkin
e46b56acbc Add @LocalState of buildServicesWorkingDir to KotlinCompile 2018-01-03 22:14:21 +03:00
Sergey Igushkin
627fe52858 Map compiler arguments to Gradle inputs. 2018-01-03 22:14:20 +03:00
Sergey Igushkin
a8ba8fbf77 Make pluginOptions.classpath a separate input in the Gradle tasks
(cherry picked from commit b03e758)
2018-01-03 22:14:20 +03:00
Sergey Igushkin
a752d30f12 Move CompilerArgumentAware to the <...>.internal package. 2018-01-03 22:14:20 +03:00
Sergey Igushkin
62f2876230 Refactor compiler arguments in Gradle tasks:
Pull create/setup args functions up to CompilerArgumentsAware interface
Remove diamond-shaped CompilerArgumentsAware inheritance
Provide the default implementation for serialization in the interface
Make KotlinJsDce implement CompilerArgumentsAware
Implement the compiler args logic for Kapt & GenerateStubs tasks
2018-01-03 22:14:20 +03:00
Toshiaki Kameyama
6b2c22aff1 Add intention to specify all types explicitly in destructuring assignment
#KT-16260 Fixed
2018-01-03 17:23:31 +01:00
Dmitry Jemerov
3529d61a7d Exclude generated test classes from language statistics 2018-01-03 14:57:01 +01:00
Toshiaki Kameyama
eb12cfd444 KT-18674 Join Lines should join strings (#1305)
* Join Lines should join strings #KT-18674 Fixed

* #KT-18674 Fixed
2018-01-03 11:27:16 +01:00
Toshiaki Kameyama
16695c1af5 KT-21929 Inappropriate quick fix for a sealed class instantiation (#1444) 2018-01-03 11:20:58 +01:00
Toshiaki Kameyama
de185b79d0 KT-21780 Wrong redundant setter inspection (#1453) 2018-01-03 11:14:23 +01:00
Toshiaki Kameyama
640c28ceaf KT-14670 Support kotlinPackageName() macro in live templates (#1455)
* KT-14670 Support kotlinPackageName() macro in live templates

* Use context.psiElementAtStartOffset.containingFile #KT-14670
2018-01-03 10:41:28 +01:00
Dmitry Jemerov
84d63051f9 Add a rule for invalid characters in names 2018-01-02 13:17:31 +01:00
Dmitry Jemerov
f83c5344d7 Apply same style for top-level and object properties
#KT-20437 Fixed
2018-01-02 12:46:03 +01:00
Dmitry Jemerov
1c7d97289b Naming convention inspection for test functions
#KT-21547 Fixed
2018-01-02 12:46:02 +01:00
Dmitry Jemerov
37d2ff2d4d Report more friendly messages from naming conventions inspection
#KT-19736 Fixed
2018-01-02 12:46:01 +01:00
Dmitry Jemerov
429bf5bb98 Reformat 2018-01-02 12:46:00 +01:00
Toshiaki Kameyama
79ff36592d KT-15320 Live templates: please add function which returns the "outer" class name 2018-01-02 12:35:20 +01:00
Ilya Gorbunov
e2306ecf94 Keep exception primary constructors for binary compatibility in JS
Resort to a workaround for KT-22053 in direct Throwable inheritors.
2017-12-29 21:21:20 +03:00
Ilya Gorbunov
3825187e93 Update expected reachable node count 2017-12-29 21:20:59 +03:00
Ilya Gorbunov
a1f67e347f Relax nullability of UninitializedPropertyAccessException constructor parameters
To make it consistent with other exception types
2017-12-29 21:16:17 +03:00
Ilya Gorbunov
4e26ca5659 Add missing exception constructors to common and JS declarations
Add test to validate exception properties after calling various constructors.

Make NumberFormatException a descendant of IllegalArgumentException in all platforms.

#KT-21861 Fixed
#KT-21191 Fixed
2017-12-29 21:16:17 +03:00
Ilya Gorbunov
496df371f4 Provide the guide for sample authoring 2017-12-29 20:42:46 +03:00
Pavel V. Talanov
03a8ce63b2 Scripts: fix any file deletion potentially leading to reindex 2017-12-29 20:14:59 +03:00
Dmitry Jemerov
25ea53457e Send source code in exceptions as attachments, not text (common cases)
#KT-17678 In Progress
2017-12-29 15:35:53 +01:00
Toshiaki Kameyama
817dadc120 Specify type: do not suggest nullable type if not null is overridden
So #KT-12814 Fixed
2017-12-29 17:28:44 +03:00
Mikhail Glukhikh
50eaca1ac4 Add modifier fix: improve style a bit 2017-12-29 17:17:38 +03:00
Toshiaki Kameyama
184651d366 Do not suggest "add inner" quick fix for interfaces etc. #KT-18396 Fixed 2017-12-29 16:43:47 +03:00
Toshiaki Kameyama
84a6ef6ac4 Add inspection to detect is checks for object types #KT-21741 Fixed 2017-12-29 16:24:18 +03:00
Dmitry Jemerov
247881baf9 Apply style guide and enable reformat inspection 2017-12-29 13:51:53 +01:00
Mikhail Glukhikh
0df3ffbe36 Build fix: convert reference to lambda
Related to KT-19283 (fixes mistake in 3f005924)
2017-12-29 14:36:10 +03:00
Dmitry Jemerov
896246a7f5 More cleanup after J2K 2017-12-29 10:19:50 +01:00
Dmitry Jemerov
d0e8e176c4 Catch exceptions from decompiler service
EA-108937 - RE: InvocationExprent.toJava
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
9a61abfb9f Don't add null module info to list
EA-113650 - TCE: LazyModuleDependencies.getModulesWhoseInternalsAreVisible
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
2c4180222a Check if containing file is KtFile
EA-109460 - CCE: KtElementImplStub.getContainingKtFile
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
4b6efe3eb0 Take read action in KtLightParameter.isEquivalentTo()
EA-109775 - (OperatorReferencesSearcher) assert: PsiFileImpl.getStubTree
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
7f1dd88600 KtLightParameter: convert to .kt and cleanup 2017-12-29 10:19:50 +01:00
Dmitry Jemerov
98d26ae59f KtLightElementParameter: rename to .kt 2017-12-29 10:19:50 +01:00
Dmitry Jemerov
cde84a7923 Handle I/O exceptions when updating library jars
EA-101940 - FNFE: FileUtil.openOutputStream
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
254f766aaf Take longer read action in forEachKotlinOverride()
EA-114124 - assert: CompositeElement.getChildrenAsPsiElements
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
768fce4722 Check for project disposed when reporting outdated libraries
EA-106858 - assert: ComponentManagerImpl.getPicoContainer
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
cc2faa67f9 Don't pass null element to RefactoringFactory.createRename()
EA-114286 - IAE: RenameProcessor.$$$reportNull$$$
2017-12-29 10:19:50 +01:00
Dmitry Jemerov
9a156541c1 Don't try to read attribute for files with no ID
(EA-114351 - CCE: PersistentFSImpl.getFileId)
2017-12-29 10:19:50 +01:00
Toshiaki Kameyama
5e765c525e Do not suggest quickfix 'Specify type explicitly' with existing type
So #KT-15180 Fixed
2017-12-28 21:06:48 +03:00
Mikhail Glukhikh
5475f99cec Elvis -> if-then: handle case with safe cast separately #KT-17816 Fixed 2017-12-28 20:31:55 +03:00
Mikhail Glukhikh
ec60c92fe9 Lambda -> reference: build bound reference for complex qualified
So #KT-19073 Fixed
2017-12-28 20:31:53 +03:00
Mikhail Glukhikh
73bca21f94 Allow using add modifier quick-fixes in batch mode #KT-21950 Fixed 2017-12-28 20:31:47 +03:00
Mikhail Glukhikh
2e71691ab2 Fix potential leak in "unused lambda expression body" fix 2017-12-28 20:31:45 +03:00
Mikhail Glukhikh
8e23ca597d Add extra tests for KT-20429, simplify code a bit 2017-12-28 20:31:44 +03:00
Toshiaki Kameyama
a65304556c CFG: provide "used as expression" in enum constant constructor
This allows to avoid
"unused return value of a function with lambda expression body"
for such a situation
So #KT-20429 Fixed
2017-12-28 20:31:42 +03:00
Mikhail Glukhikh
e10fa218f5 Extend range of "use expression body" to left brace..end of return
Range is extended iff we are in DO_NOT_SHOW case,
otherwise just return is highlighted to avoid ugly highlighting
So #KT-19771 Fixed
2017-12-28 20:31:41 +03:00
Mikhail Glukhikh
95e7d29743 Minor: improve style in "operator to function" 2017-12-28 20:31:40 +03:00
Toshiaki Kameyama
52df70a576 Do not suggest replacing comparison to null with function call
So #KT-20620 Fixed
2017-12-28 20:31:38 +03:00
Mikhail Glukhikh
d7807b5ae3 Do not report "redundant Unit return type" on expression bodies
So #KT-21983 Fixed
2017-12-28 20:31:37 +03:00
Mikhail Glukhikh
232ec63121 Inline dialog: handle case with unknown occurrence number correctly
So #KT-21963 Fixed
2017-12-28 20:31:36 +03:00
Mikhail Glukhikh
947e853d9e Inline dialog: show "inline all and keep" for occurred once declarations
So #KT-21964 Fixed
2017-12-28 20:31:35 +03:00
Mikhail Glukhikh
d5bb7e457e Inline dialog: unify messages with each other #KT-21965 Fixed 2017-12-28 20:31:33 +03:00
Mikhail Glukhikh
3f00592443 Do not suggest "convert ref to lambda" for reflect types #KT-19283 Fixed 2017-12-28 20:31:27 +03:00
Mikhail Glukhikh
fc93e7a727 Do not report "redundant suspend" on override / open #KT-21938 Fixed 2017-12-28 20:31:24 +03:00
Sergey Igushkin
276a6acc3e Use .withDependencies { ... } to set up default versions with Gradle 4.4
+ Improve the test for omitted Kotlin module versions.

Issues: #KT-21806 Fixed, #KT-21203 Fixed
2017-12-28 19:47:02 +03:00
Vyacheslav Gerasimov
8b7a8f7bef Update changelog for 1.2.20 2017-12-28 16:15:54 +03:00
Dmitry Jemerov
fc51673c83 Update copyright profile 2017-12-28 10:47:43 +01:00
Ilya Chernikov
efc470df2b Reading KOTLIN_HOME only once
may fix #KT-21145, or at least make it less flaky
2017-12-28 09:43:44 +01:00
Ilya Chernikov
945da50b61 Add kotlin-compiler-client-embeddable to the plugin's lib since...
it's used in the `KotlinJsr223JvmScriptEngine4Idea`
Fixes #KT-18613
2017-12-28 09:43:43 +01:00
Vyacheslav Gerasimov
6116b5c497 Update coroutines version to 0.20 2017-12-28 00:35:15 +03:00
Ilya Gorbunov
042f81f23b Fix Volatile usages in common and JS code 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
a33a3867b8 JS: Move declaration to match their packages in JVM and Common stdlib
Mostly internal, but also two public annotations
2017-12-27 21:55:24 +03:00
Ilya Gorbunov
d2eb8b4a3f Do not compile SynchronizedLazyImpl for platforms other than JVM 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
b6595d661d Improve expect declarations in kotlin.text
- Replace overloads with default parameters in expect declarations by suppressing errors
- Remove meaningless inline modifier
2017-12-27 21:55:24 +03:00
Ilya Gorbunov
824b506abe Remove inheritance between LinkedHashSet/Map and HashSet/Map 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
c5c6eed170 Make common ArrayList declaration not open and implementing RandomAccess 2017-12-27 21:55:24 +03:00
Ilya Gorbunov
fb13347864 Extract kotlin.collections expect classes into separate files
Add missing expect declarations for AbstractMutableMap/Set.
2017-12-27 21:55:24 +03:00
Ilya Gorbunov
93ef16deaf Move expect declarations to the appropriate packages
So that they match actual declarations in Kotlin/JVM stdlib.
2017-12-27 21:55:24 +03:00
Pavel V. Talanov
dd32c4e66a Revert minor semantic differences introduced in c030a047aa
Fix 'pull members up' and 'kotlin injected into kotlin' tests
2017-12-27 20:24:26 +03:00
Anton Bannykh
2df85ae4a9 kotlin-test-js: pass test function result to test framework (e.g. Promise) 2017-12-27 19:57:49 +03:00
Anton Bannykh
3e0d83b7d1 Make :js:npm a separate project to avoid calling update_dependencies 2017-12-27 17:35:34 +03:00
Alexander Udalov
129fad6ade Minor, merge two KotlinCoreEnvironment-creating functions 2017-12-27 14:50:04 +01:00
Alexander Udalov
613297ad60 Rename ModuleScriptData -> ModuleChunk and refactor related code
Use the term "build file" instead of the old "module"/"module script"
2017-12-27 14:50:03 +01:00
Alexander Udalov
f3f8db989a Fix test data for annotations on DefaultImpls members
After ea5505f80c, the annotations are now generated correctly
2017-12-27 14:12:14 +01:00
Chris Povirk
ac87ad422d Recognize Checker Framework declaration annotations.
We are migrating Guava to use these annotations rather than jsr305's
@Nullable. We can't use the Checker Framework's _@Nullable_ yet because
we promise compatibility with Java 7, which doesn't support type
annotations. This is related to but distinct from
https://youtrack.jetbrains.com/issue/KT-21408, which is about a
different jsr305 annotation we use, @ParametersAreNonnullByDefault.

I've also updated some docs to mention Kotlin's existing support for the
Checker Framework _@NonNull_.
2017-12-27 13:23:06 +01:00
Anton Bannykh
79359b7bc2 JS: test kotlin-test as box tests, support nested, fix mpp
Support tests inside nested classes and companion objects (KT-21850
fixed).
Don't launch multiplatform tests twice (KT-21567 fixed).
2017-12-27 15:22:26 +03:00
Nikolay Krasko
3bf8436895 Fix licence check after "jetbrains/kotlin/idea/copyright" package move 2017-12-27 13:44:55 +03:00
Nikolay Krasko
b7ff00ec34 Remove author tag from JavaSdkUtil to fix CodeConformanceTest 2017-12-27 13:27:59 +03:00
Nikolay Krasko
419abadcda Search for Kotlin sources in project too in fallback scope
When debugging in Gradle or Maven we may miss debug scope completely,
but still want to be responsible for building source positions for all
Kotlin source files (other PositionManagers may produce unexpected
results).
2017-12-27 01:09:53 +03:00
Ilya Gorbunov
f468990f97 Add racing version of each Lazy test
Run several concurrent accesses to a lazy value
many times and validate invariants.
2017-12-26 23:14:11 +03:00
Ilya Gorbunov
4827aadcfd Improve stability of lazy test, make some tests take less time 2017-12-26 23:14:09 +03:00
Ilya Gorbunov
934b3cc54e Do not read volatile _value field second time it is already initialized 2017-12-26 23:14:07 +03:00
Ilya Gorbunov
5d62277fa5 Make SafePublicationLazyImpl.initializer volatile
This establishes happens-before relation between nulling out the initializer and
checking whether it is null. This will prevent the subsequent _value reads
being reordered before the initializer reads.

#KT-21868 Fixed
2017-12-26 23:13:14 +03:00
Sergey Igushkin
685b138f79 (minor) Fix testAndroidExtensionsIncremental() ambiguous file operation 2017-12-26 21:38:15 +03:00
Sergey Igushkin
01931c2ae6 Fix Kotlin internal files created in 'build/' ignoring custom buildDir
Issue #KT-10537 Fixed
2017-12-26 21:38:15 +03:00
Ilya Chernikov
953a485fe7 Increment repl line generation on compilation error
fixes #KT-17921 and #KT-21141
Tests added to the JSR223 local eval example
2017-12-26 19:27:32 +01:00
Ilya Chernikov
2d8e73f3f6 Make JSR 223 examples compatible with embeddable compiler, strip ...
some dependencies.
Fixes #KT-17561 and related issues
Warning: API changed slightly
2017-12-26 19:27:31 +01:00
Sergey Igushkin
d51b17c1b2 Fix @OutputFile annotation on a String property outputFile. 2017-12-26 20:29:45 +03:00
Sergey Igushkin
9d1091cdaa Add java-gradle-plugin for kotlin-gradle-plugin tasks validation;
Make task properties validation fail on warnings; run it during IT
2017-12-26 20:29:45 +03:00
Sergey Igushkin
7031087a93 Mark Gradle task properties with input/output annotations. 2017-12-26 20:29:45 +03:00
Sergey Igushkin
d62ced3a82 Compile against gradleApi() 2017-12-26 20:29:45 +03:00
Mikhail Glukhikh
72ec55769b Improve wording for "change package" fix for source root case 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
429c31c010 Improve wording in some inspections 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
1534488dd1 Test minor: output all available fixes in local inspection tests 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
2f987f08fa Forbid word 'can' in local inspections with level > INFORMATION
Inspection texts were changed accordingly
2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
56230420f8 AbstractApplicabilityBasedInspection: move visitor inside base class 2017-12-26 18:39:51 +03:00
Mikhail Glukhikh
3268189215 Cache intention inside IntentionBasedInspection
So intention is created only once.
Case with multiple intentions is no more allowed.
So #KT-21137 Fixed
2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
5affb9a25c Refactoring: "package matching directory" is now an inspection 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
3f1a3dfeb2 Refactoring: make "loop to call chain" AbstractKotlinInspection 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
f44fba746e Refactoring: make "unnecessary variable" inspection applicability-based 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
221aac9820 J2K registerInspectionBasedProcessing: use correct target for applyTo 2017-12-26 18:39:50 +03:00
Mikhail Glukhikh
5a1a35bb35 Refactoring: "replace put with assignment" is now applicability-based 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
9e919829c8 Refactoring: "simplify assert not null" is now an inspection 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
8ebe16c9b2 Minor: reformat XML 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
bc361363d5 Refactoring: "simplify negated binary expression" is now an inspection 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
35d85ddd1f Refactoring: "replace with operator assignment" is now an inspection 2017-12-26 18:39:49 +03:00
Mikhail Glukhikh
c995f70631 J2K processing: simplify (minor) 2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
6b5aeaa9a6 J2K inspection-based processing: use more accurate isApplicable
Information level is taken into account in both base and pre-fix
isApplicable calls
2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
ada7287c66 Refactoring: make "replace call with binary operator" an inspection 2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
6d4b5bc48f Refactoring: "introduce when subject" is now an inspection 2017-12-26 18:39:48 +03:00
Mikhail Glukhikh
a8b01a6b00 Refactoring: make "if-then to safe access" an inspection 2017-12-26 18:39:47 +03:00
Mikhail Glukhikh
91bcfb97c6 Refactoring: make "replace get or set" an inspection 2017-12-26 18:39:47 +03:00
Mikhail Glukhikh
756cb32eaf Refactoring: make "replace array equality ..." an inspection 2017-12-26 18:39:47 +03:00
Mikhail Glukhikh
33d94cd5e1 J2kPostProcessing: add inspection-based processing #KT-21635 Fixed 2017-12-26 18:39:46 +03:00
Mikhail Glukhikh
67b78bce39 Introduce AbstractApplicabilityBasedInspection
Related to KT-21635, KT-21137
2017-12-26 18:39:46 +03:00
Nikolay Krasko
bf393505a9 More nullability update in selectors for compatibility in 181 2017-12-26 17:37:38 +03:00
Nikolay Krasko
e66e8bcd07 Use platform types to prepare for nullability check in 181 2017-12-26 17:08:11 +03:00
Joscha Alisch
809cc220ed Select lambda after other args when it's outside argument list (KT-21214)
#KT-21214 Fixed
2017-12-26 13:09:17 +03:00
Nikolay Krasko
976a158ce1 Support alternative source popup for Kotlin files (KT-21958)
#KT-21958 Fixed
2017-12-26 12:49:27 +03:00
Nikolay Krasko
449fee74e8 Skip all same line locations when stepping over inline call (KT-20351)
#KT-20351
2017-12-26 12:46:45 +03:00
Nikolay Krasko
f39250c9a2 Fix irrelevant additional stops on breakpoint on line with inlines (KT-21945)
#KT-21945 Fixed
2017-12-26 12:46:45 +03:00
Nikolay Krasko
f38a4f509d Minor: code rearrange 2017-12-26 12:46:45 +03:00
Nikolay Krasko
c5886bc7a2 Remove sleep() from soSuspendableCallInEndOfFun and guarantee suspending 2017-12-26 12:46:45 +03:00
Ilya Gorbunov
10639eaf6a Add pattern and options properties to common Regex
And add a test that accesses them and checks they work as expected.
2017-12-26 05:40:37 +03:00
Ilya Gorbunov
d9edc5f221 Replace Regex constructor-like functions with secondary constructors
Historically secondary constructors were not supported in Kotlin/JS, so they had to
be emulated with constructor-like top level functions, now they can be rewritten
as true secondary constructors.

#KT-22003 Fixed
2017-12-26 05:40:35 +03:00
Ilya Gorbunov
053f3b6ac0 Tests: use helper function to assert compile-time and run-time type check
To cleanup warnings about useless cast or type check that is always true.
2017-12-26 04:55:44 +03:00
Ilya Gorbunov
ecd42f14b3 Compile common stdlib tests against common stdlib
Declare platform-specific test utilities as expect.
2017-12-26 04:55:40 +03:00
Pavel V. Talanov
c030a047aa Fix getting ModuleResolver by element for script files
Fixes EA-105435 (some isntances)
JavaResolveExtension: refactor API
2017-12-25 20:12:51 +03:00
Pavel V. Talanov
2af0bf4c71 Drop JsProjectDetector
It leads to undesired behaviour
    such as returning library source when only binaries are queried
It is redundant since js libraries do not include kotlin source files
    (real binary format is used for this purpose for along time now)
2017-12-25 20:12:48 +03:00
Pavel V. Talanov
6551ee5403 Test completion in script files
Test for 'JavaResolutionUtils.getJavaDescriptorResolver' failing with AE
Tests ebd3ac6dc8
See EA-105435
2017-12-25 20:12:46 +03:00
Sergey Igushkin
149b197b24 Fix unconditional warning in JS compilation with sourceMap disabled. 2017-12-25 15:30:01 +03:00
Sergey Igushkin
66d3c94193 Fix both moduleFile and destination passed to the compiler
when it is run not in daemon from Gradle; don't pass the destination in
such case.

Issue #KT-21637 Fixed
2017-12-25 15:29:34 +03:00
Sergey Igushkin
00d7150944 Fix warning check in tests:
* Fix the regex that could not actually find warnings
* Suppress an unused parameter warning in the test project
* Add allWarningsAsErrors to ExecutionStrategyIT
2017-12-25 15:28:33 +03:00
Sergey Igushkin
41086f26ae Fix duplicate classpath entry in JS Gradle compilation causing warnings
Issue #KT-21943 Fixed
2017-12-25 15:15:54 +03:00
Nikolay Krasko
93e7e9b28c Minor: regenerate tests 2017-12-22 17:06:12 +03:00
Alexey Tsvetkov
d7edbb8dfc Track changes in inline function when friend paths are disabled in JS 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
a4d122478b Replace testCancelLongKotlinCompilation with less flaky test 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
ee94a64718 Explicitly request rebuild when untracked java file is removed
Previously a rebuild was happenning because FileNotFoundException
was thrown when getting psiFile of removed file.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
61cb39a600 Include tests from incremental-compilation-impl in compiler tests 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
50bf74b909 Turn off class redeclaration test for JS IC temporarily
So the tests could be run on TC.
Turn on after KT-19846 is fixed.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
5b646ba4fa Generate source maps in JS IC tests
#KT-21700 fixed
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
0fee7883ed Recompile only files from last iteration after compile error 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
3914c1b0e9 Allow to edit non-JPS build logs in "Show difference" window for non-JPS IC tests 2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
ff2e3ecfc4 Add JS specific IC build log in test
JS IC compares proto using a source file path as a key,
so moving file causes recompilation of its usages
unlike JVM IC that uses a class file path as a key.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
7712044146 Fix IC test build log diverged from JPS
JPS marks dirty direct usages of removed classes since 172.* before a build.
Generic IC also marks dirty all subclasses and their usages.
That is necessary because a method from a removed class could be used
through a subclass.
JPS and generic IC logs diverged in 172 branch, but non-JPS tests
were not run on CI.
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
ad1978940b Recompile inline function usages in JS when offset is changed
Otherwise source maps would differ after rebuild
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov
a31f503fa5 Recompile all subclasses of removed classes 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
e8162cd99d Unify processing of removed files for JS and JVM IC 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
d0ca0dca2b Avoid processing incremental changes after first build for JVM 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
91bb57c5a3 Make general IC logs similar to JPS IC logs 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
fec2d08d22 Compile actual and expected declarations together
#KT-20840 fixed
2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
123fd64a34 Fix stdlib usages in IC tests
* Use stdlib from dist
* Check that stdlib exists
* Don't add stdlib for JS, because compiler adds one by default
(stdlib would be read twice which is slow)
2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
e3a9ad5a74 Minor: remove unused variable 2017-12-22 16:12:19 +03:00
Alexey Tsvetkov
dfe176efca Avoid computing source files changes in IC for Gradle 2017-12-22 16:12:19 +03:00
Nikolay Krasko
5a8c0f8f42 Minor: fix compile error in test data 2017-12-22 15:27:11 +03:00
Toshiaki Kameyama
9fad40b586 KT-21928 Structure view doesn't show default constructor 2017-12-22 15:27:10 +03:00
Dmitry Jemerov
3178dee759 Insert line break before elvis when converting if to elvis
This ensures correct indentation
2017-12-22 10:35:23 +01:00
Dmitry Jemerov
6208c69c72 Add option for wrapping closing paren in multiline if conditions 2017-12-22 10:35:23 +01:00
Dmitry Jemerov
7711f8e3a7 Add predefined code style for Kotlin style guide 2017-12-22 10:35:23 +01:00
Dmitry Jemerov
d69382f129 Don't apply indent on Enter after modifier list
#KT-9562 Fixed
2017-12-22 10:35:23 +01:00
Dmitry Jemerov
43ef113b7a Correctly apply annotation wrap before modifier keyword
#KT-20314 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
fa19bd6d9b Apply indent of continuation call start to its children
#KT-15099 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
5652fa762f Force no line break after dot in chained calls
#KT-20362 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
06fa61bb6f Line breaks in objects and lambdas don't trigger call paren wrapping
#KT-19727 Fixed
2017-12-22 10:35:22 +01:00
Dmitry Jemerov
79a509df7b Option to apply normal indent to children of 'if' expressions 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
640bf22e4f Refactoring: extract 'continuationIf' method 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
44ee228ac9 Don't wrap parentheses in long argument list containing only object 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
a2175c2ef5 KotlinFormattingModelBuilder: J2K 2017-12-22 10:35:21 +01:00
Dmitry Jemerov
57844968b0 KotlinFormattingModelBuilder: rename to .kt 2017-12-22 10:35:20 +01:00
Mikhael Bogdanov
ea5505f80c Generate annotations in proper order in DefaultImpls 2017-12-22 10:02:04 +01:00
Mikhael Bogdanov
c9d0ab38cf Generate proper java parameter names for DefaultImpls
#KT-21919 Fixed
2017-12-22 10:02:04 +01:00
Alexander Podkhalyuzin
12a8048bf7 Fixed exception reporting in Kotlin plugin and IDEA releases 2017-12-22 11:33:36 +03:00
Sergey Igushkin
a88206c5ea (minor) Fix platform-dependent line separators in source maps test 2017-12-21 20:49:58 +03:00
Ilya Gorbunov
94a0e508d9 Use empty array instead of presized for Collection.toArray
#KT-21918
2017-12-21 20:10:28 +03:00
Alexander Podkhalyuzin
8203d1c3fe Extracted Kotlin.JVM IDE into separate module
This change is required to have possibility to build plugin against
minor IDEs, which don't have Java. So we want to extract idea-jvm
2017-12-21 18:34:02 +03:00
Alexander Podkhalyuzin
2bb02beb84 Do not report exceptions/errors in very specific case
In IDEA special property can be used for that, Kotlin plugin should honor that
2017-12-21 18:34:00 +03:00
Alexander Podkhalyuzin
5e21dc5560 Removed non ASCII char to reduce pain in compilation. 2017-12-21 18:34:00 +03:00
Ilmir Usmanov
c8904b1c7c Replace POP with ARETURN if it pops Unit and ARETURN shall return Unit
#KT-16880: Fixed
2017-12-21 18:08:39 +03:00
Toshiaki Kameyama
2cdc246a27 Inspection to highlight usages of Collections.sort() and replace them with .sort() method from Kotlin stdlib
#KT-11023 Fixed
2017-12-21 15:05:48 +01:00
Alexey Sedunov
4ac870500f Minor: Fix test data 2017-12-21 16:01:29 +03:00
Emmanuel Duchastenier
a8ddf03b53 README: IntelliJ IDEA 2017.3 is not early access anymore
update README.md with direct download link to IntelliJ IDEA latest version
2017-12-21 13:51:24 +01:00
Nikolay Krasko
e6aeb66875 Sort files according to given scope in debugger (KT-21931)
#KT-21931 Fixed
2017-12-21 15:46:28 +03:00
Nikolay Krasko
7c73356893 Early exit from getSourcePosition() for non-kotlin source files 2017-12-21 15:46:28 +03:00
Mikhael Bogdanov
50608d0844 Don't delete nested default lambda classes during inline transformation 2017-12-21 12:52:29 +01:00
Mikhael Bogdanov
b65dcf27ee Provide test source mapping data for separate and non-separate compilation
Compilation in same module or in separate ones
2017-12-21 12:52:28 +01:00
Mikhael Bogdanov
f4f7c83eeb Copy nested objects of default lambda during inline 2017-12-21 12:52:28 +01:00
Mikhael Bogdanov
3513f1a86a Properly process default lambda source mapping
#KT-21827 Fixed
2017-12-21 12:52:27 +01:00
Nicolay Mitropolsky
657123f2c0 LightClassUtil.extractPropertyAccessors refactoring to fix KotlinShortNamesCacheTest.testGetMethodsByNameWithCustomPropertyAccessors test
After light classes caching the test started to fail.
 Also refer Simon Ogorodnik.
2017-12-21 12:25:51 +03:00
Sergey Igushkin
710c726c9a Improve kapt arguments & javac options usability with Kotlin DSL
Issue #KT-21596 Fixed
2017-12-20 20:49:30 +03:00
Toshiaki Kameyama
411feab9ae KT-21698 Create interface shouldn't suggest to declare it inside a class which implements it 2017-12-20 18:14:55 +01:00
Vyacheslav Gerasimov
1deed28464 Add missing changelog for [1.2.20 - 1.1.60] versions 2017-12-20 19:10:26 +03:00
Pavel V. Talanov
aec893180e Minor, JvmAnalyzerFacade: drop logging
Prevent log spam
2017-12-20 17:19:09 +03:00
Dmitry Jemerov
78a87ac0cf Regenerate test 2017-12-20 15:03:25 +01:00
Mikhail Glukhikh
484bf0115f Fix "fake JVM field" inspection test XML 2017-12-20 16:31:10 +03:00
Kirill
7842fa4796 Support callable references in "implicit this" inspection
Second part of #KT-21510
2017-12-20 14:16:39 +03:00
Kirill
74e5a9425a Support callable references in "explicit this" inspection
So #KT-21510 Fixed
2017-12-20 14:16:33 +03:00
Dmitry Jemerov
d3adf57145 Don't apply highlighting to zero-length elements
#KT-19820 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
52ccfcecfc Fix highlighting of TODO calls in lambdas
#KT-19915 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
0159d19539 Apply rainbow highlighting in anonymous initializers
#KT-18839 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
94a7673c2d Don't show type hints for destructuring declarations with explicit type
#KT-21833 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
b0b69b2ad0 Put argument name hint before spread element
#KT-21645 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
c336159b2b Don't show argument name hints for dynamic calls.
Mark function descriptors created for dynamic calls as having
synthesized parameter names.

 #KT-21275 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
3e7e01dc4d Add mapOf() to default parameter name hints blacklist
#KT-18829 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
fd7aaa1579 Add single-arg 'assert' method to parameter name hints blacklist
#KT-17965 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
cf6b71aa05 Don't show type hint for local variable initialized with object
#KT-17964 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
77c186442a Don't show parameter name hints when calling Java methods with unknown
parameter names

 #KT-17843 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
6d63dd9d83 Enable "Configure Kotlin plugin updates" with no open project
#KT-20380 Fixed
2017-12-20 12:02:04 +01:00
Dmitry Jemerov
1a9d2ab4ee Fix name of inspection description file 2017-12-20 11:56:04 +01:00
kenji tomita
3cd4d90bf8 Use BodyResolveMode.PARTIAL and ProblemHighlightType.GENERIC_ERROR_OR_WARNING 2017-12-20 11:56:04 +01:00
kenji tomita
37351c344f code style inspection: to -> Pair function used not in infix form 2017-12-20 11:56:04 +01:00
Mikhail Glukhikh
41739602bc Inline handler: fix reference detection for properties 2017-12-20 13:54:36 +03:00
Mikhail Glukhikh
ce441e2163 Extract common class from two KotlinInline<...>Dialogs #KT-17212 Fixed 2017-12-20 13:54:30 +03:00
Mikhael Bogdanov
3e1f471121 Rollback change in 'usesDefaultArguments' 2017-12-20 10:58:35 +01:00
Mikhael Bogdanov
32b90a1cae Generate type checker barriers in bridges 2017-12-20 10:48:52 +01:00
Mikhael Bogdanov
be18cb9b16 Fix default methods visibility 2017-12-20 10:48:51 +01:00
Mikhael Bogdanov
9365d1d859 Remove redundant extra default mask for function with N*32 parameters 2017-12-20 10:48:51 +01:00
Mikhael Bogdanov
ef5c3512cd Skip FAKE_OVERRIDE fields 2017-12-20 10:48:50 +01:00
Mikhael Bogdanov
aeb74f7e70 Skip bridge generation for non real declaration on first step they would be processed later
~

~
2017-12-20 10:48:50 +01:00
Mikhael Bogdanov
4657ae06f4 Don't cast receiver to super type on super calls 2017-12-20 10:48:49 +01:00
Mikhael Bogdanov
a936f75423 Fix empty vararg processing in intrinsics 2017-12-20 10:48:49 +01:00
Mikhael Bogdanov
420b9fdaa9 Support interface companion object lowering 2017-12-20 10:48:48 +01:00
Mikhael Bogdanov
24336113a2 Support class companion object lowering 2017-12-20 10:48:48 +01:00
Mikhael Bogdanov
224adfabc5 Support synthetic accessors for constructors 2017-12-20 10:48:47 +01:00
Mikhael Bogdanov
5cbfdf6024 SyntheticAccessorLowering refactoring 2017-12-20 10:48:47 +01:00
Mikhael Bogdanov
7da847e943 Fix coercion after call 2017-12-20 10:48:46 +01:00
Mikhael Bogdanov
4df0a1bb1f Fix parameter indices on lowering 2017-12-20 10:48:46 +01:00
Mikhael Bogdanov
0729566458 Support javaClass for Void type 2017-12-20 10:48:45 +01:00
Mikhael Bogdanov
f7968e1b61 Fix inner class lowering: don't try to process nested classes on processing outer 2017-12-20 10:48:45 +01:00
Mikhael Bogdanov
dde0535c5a Fix cast for IMPLICIT_NOTNULL 2017-12-20 10:48:44 +01:00
Mikhael Bogdanov
05b56b0c4a Update ArrayConstructor to support inline 2017-12-20 10:48:44 +01:00
Mikhael Bogdanov
665a697093 Support simple function inlining in ir 2017-12-20 10:48:43 +01:00
Mikhael Bogdanov
54dc828c8e Rename ExpressionLambda to PsiExpressionLambda 2017-12-20 10:48:43 +01:00
Mikhael Bogdanov
0e2bd46124 Remove cycle check and resolvedCall from 'preformInline' method 2017-12-20 10:48:42 +01:00
Mikhael Bogdanov
4711e2f9da Don't use kind for static check
Lowers should perform proper transformations
2017-12-20 10:48:42 +01:00
Mikhael Bogdanov
3432014971 Add 'generateModule' method to CodegenFactory 2017-12-20 10:48:41 +01:00
Mikhael Bogdanov
06fd996266 Switch LocalFunctionLowering to LocalDeclarationLowering 2017-12-20 10:48:41 +01:00
Mikhael Bogdanov
1f053be289 Support default function lowering 2017-12-20 10:48:40 +01:00
Mikhael Bogdanov
83710a8ed6 HACK: process unbound symbols 2017-12-20 10:48:40 +01:00
Mikhael Bogdanov
5032064bf0 Enable tailrec lower 2017-12-20 10:48:39 +01:00
Mikhael Bogdanov
84e960b3a4 Enable lateinit lowering 2017-12-20 10:48:39 +01:00
Mikhael Bogdanov
039e036e22 Support IrExpressionBody in codegen 2017-12-20 10:48:38 +01:00
Mikhael Bogdanov
4017195ff1 Always include stdlib in IrTests 2017-12-20 10:48:38 +01:00
Mikhael Bogdanov
e16bdd4287 Switch JvmBackendContext to CommonBackendContext
(cherry picked from commit 5d4736c)
2017-12-20 10:48:37 +01:00
Nikolay Krasko
f963b8bd42 Fix QuickFixTestGenerated$DeprecatedSymbolUsage$TypeAliases
Revert asking super isAvailable in DeprecatedSymbolUsageInWholeProjectFix
2017-12-20 12:27:36 +03:00
Nikolay Krasko
b80403cf13 Consistency for replace string quick fix message
https://youtrack.jetbrains.com/issue/KT-21746#comment=27-2634335
2017-12-20 12:27:36 +03:00
Vyacheslav Gerasimov
95cc3fe1b7 Fix availability of AddFunctionParametersFix
fixes RenameTestGenerated.testAutomaticVariableRenamerWithQuotation_AutomaticVariableRenamerWithQuotation
2017-12-19 21:23:38 +03:00
Nicolay Mitropolsky
bb4d6d1059 LightClassEqualsTest fix by creating lightclasses with createNoCache 2017-12-19 20:03:59 +03:00
Nicolay Mitropolsky
4c5cf0f7e7 *kapt3-idea* added to test-dependencies in *uast-kotlin* 2017-12-19 18:22:14 +03:00
Mikhael Bogdanov
ef433d163e Apply common header directives to second file in AbstractCompileKotlinAgainstKotlinTest 2017-12-19 16:11:39 +01:00
Mikhael Bogdanov
819a3a95b3 Add support for contract feature in inliner 2017-12-19 16:11:39 +01:00
Pavel V. Talanov
4890979476 ScriptDefinitionsManager: ignore reloadDefinitionsBy calls
If definitions are not loaded yet
2017-12-19 17:15:39 +03:00
Pavel V. Talanov
106f571814 scriptTemplatesFromCompilerSettings: fix ScriptDefinitionsManager access
#KT-21545 Fixed
2017-12-19 17:15:36 +03:00
Mikhail Glukhikh
4bff0fb338 Unused symbol: revert entry point check optimization to fix regression
E.g. JUnit 3 tests was highlighted as unused after it
2017-12-19 15:59:30 +03:00
Mikhail Zarechenskiy
9eca8cd451 [NI] Fix hierarchy of resolution atoms for lambda with non-local return 2017-12-19 15:11:04 +03:00
Mikhail Zarechenskiy
c6d8b39b4f [NI] Prioritize type variables related to output type for fixation 2017-12-19 15:11:04 +03:00
Mikhail Zarechenskiy
d818af5287 [NI] Don't forget to analyze whole block for last postponed expression 2017-12-19 15:11:03 +03:00
Anton Bannykh
8ed8e05a68 JS: honor ignoreTestFailures flag and report failures to TC (KT-20735
fixed)
2017-12-19 14:38:15 +03:00
Alexey Sedunov
0ab924a298 Change Signature: Fix overrider search for suspend functions
#KT-21288 Fixed
2017-12-19 13:47:02 +03:00
Alexey Sedunov
b5bd5942e7 Kotlin Facet: Do not auto-advance version in imported projects
#KT-21879 Fixed
2017-12-19 13:47:02 +03:00
Alexey Sedunov
88540360b4 Misc: Fix NPE on external project import 2017-12-19 13:47:02 +03:00
Nicolay Mitropolsky
4a6cc3913d Fix for "safe delete" after caching added to light elements 2017-12-19 13:32:23 +03:00
Alexey Tsvetkov
18fae9e16d Allow override removing temporary module files after build
For debug purposes
2017-12-18 21:19:15 +03:00
Alexey Tsvetkov
5bffef6de7 Allow customizing directory for temporary module files 2017-12-18 21:19:15 +03:00
Alexey Tsvetkov
37b00b91fc Avoid generating too long path for temp module file
#KT-21841 fixed
2017-12-18 21:19:15 +03:00
Toshiaki Kameyama
a4fbe95112 KT-21770 Pasting into an interpolated string shouldn't escape $ 2017-12-18 18:25:43 +01:00
Toshiaki Kameyama
eb25ac44e6 KT-17928 Support code folding for primary constructors 2017-12-18 18:14:27 +01:00
Dmitry Jemerov
18cb9593c8 Add 'reformat' flag to DeprecatedSymbolUsageFixBase 2017-12-18 18:10:36 +01:00
Dmitry Jemerov
48021ce5a1 Disallow formatting in KotlinQuickFix.isAvailable() 2017-12-18 18:10:34 +01:00
Dmitry Jemerov
64f01e53af Check that add() method is in fact MutableCollection.add()
#KT-18881 Fixed
2017-12-18 18:10:33 +01:00
Dmitry Jemerov
94b8614fb8 Don't suggest mapTo() transformation over range literals
#KT-18816 Fixed
2017-12-18 18:10:32 +01:00
Dmitry Jemerov
09d27ca61c Don't generate .forEach { return } when converting loop to call chain
#KT-17161 Fixed
2017-12-18 18:10:31 +01:00
Dmitry Jemerov
b775b901cc Fix incorrect replacement with 'any' instead of 'all'
#KT-17730 Fixed
2017-12-18 18:10:24 +01:00
Dmitry Jemerov
ba4cf4dcc6 Delete unused class 2017-12-18 18:10:21 +01:00
Dmitry Jemerov
d0a8dd7dc8 Update EAP channel names in plugin update check dialog 2017-12-18 18:10:14 +01:00
Ilya Chernikov
3e2003e60d Do not log daemon connection errors as exceptions - may reduce number of ...
redundant report if the problem is corrected on retry

(cherry picked from commit 260fe36)
2017-12-18 17:08:15 +01:00
Ilya Chernikov
f83dc0a067 Make daemon session retrieval more robust to the daemon failures 2017-12-18 16:49:53 +01:00
Ilya Chernikov
1101bb7fb4 Treat "daemon is dying" state as a case for fallback compilation strategy in jps 2017-12-18 16:49:52 +01:00
Ilya Chernikov
6e34f57acf Retry socket connection on connection errors, number of retries and...
retry interval are configurable via the system props
2017-12-18 16:49:51 +01:00
Ilya Chernikov
1cd14f00eb Ignore connection error on the (optional) daemon.clearJarCache call
May fix issues with NoSuchObjectException and UnmarshalException - the
stacktraces often point to this place
2017-12-18 16:49:50 +01:00
Mikhail Glukhikh
0d64ab4846 Fix corner cases (override/script/null/etc.) in "might be const"
Related to KT-20644
2017-12-18 17:23:41 +03:00
Alexey Tsvetkov
3f082346ae Do not set api version to language version when language version is null
#KT-21852 fixed
    #KT-21574 fixed
2017-12-18 16:22:07 +03:00
Dmitry Petrov
17b4d4a973 Differentiate accessors by FieldAccessorKind
Otherwise accessors for backing fields (as in '{ field }') clash with
accessors for properties (as in '{ prop }').

 #KT-21258 Fixed Target versions 1.2.30
2017-12-18 16:15:52 +03:00
Ilya Gorbunov
d8cd926a8c Do not leak primitiveness of an array wrapped with asList
A primitive array wrapped in a List with asList had incorrect implementation of toArray method:
while it declares that an object array is returned, it returned a primitive array.
Therefore the methods such as `Collection.toTypedArray()` and its dependents
`ArrayList(collection)`, `Collection + Iterable` might behave incorrectly
having relied on `toTypedArray` returned an object array.

#KT-21828 Fixed
2017-12-18 15:50:15 +03:00
Sergey Igushkin
c55f08a166 Optimize embeddable JARs
Exclude the compiler dummy JAR from the resulting shadow JAR
2017-12-18 15:46:23 +03:00
Alexander Udalov
3a807cb39b Support Void.TYPE as underlying Class object for KClass
#KT-20875 Fixed
2017-12-18 11:57:05 +01:00
Anton Bannykh
46a631a654 Ignore license in the downloaded node_modules and nodejs 2017-12-18 13:46:25 +03:00
Yan Zhulanow
1692d1a087 Kapt: Add missing 'flush()', otherwise the serialized data can be empty 2017-12-18 18:57:38 +09:00
Nikolay Krasko
f67eb90dfb Don't show file root if it's same as the only declaration (KT-21200)
#KT-21200 Fixed
2017-12-18 11:50:50 +03:00
Nikolay Krasko
a3028beca9 Fix smart step into to Kotlin SAM adapter (KT-21538)
#KT-21538 Fixed
2017-12-18 11:50:49 +03:00
Denis Zharkov
adfee2086a Update bootstrap to 1.2.20-dev-814 2017-12-16 18:56:26 +03:00
Yan Zhulanow
d4be55df0e Kapt, Minor: Fix empty option parsing 2017-12-16 02:17:24 +09:00
Simon Ogorodnik
7c5897c1ab Skip deprecated for org.junit package in kotlin.test 2017-12-15 20:09:51 +03:00
Simon Ogorodnik
c2e706db6c Enable generation of docs for deprecated declarations 2017-12-15 20:09:49 +03:00
Simon Ogorodnik
c5c52dbda5 Fix annotations docs for kotlin.test 2017-12-15 20:09:48 +03:00
Simon Ogorodnik
430aad3651 Set LV = 1.2 in Dokka for generating stdlib docs 2017-12-15 20:09:47 +03:00
Simon Ogorodnik
3c78156f0f Suppress kotlin.reflect.jvm.internal 2017-12-15 20:09:46 +03:00
Simon Ogorodnik
fb3cf212ce Suppress docs for org.junit.Test header in kotlin.test 2017-12-15 20:09:45 +03:00
Simon Ogorodnik
99951db7e3 Add module docs for kotlin.test 2017-12-15 20:09:44 +03:00
Simon Ogorodnik
978a7fdfaa Add stdlib to kotlin.test docs classpath 2017-12-15 20:09:43 +03:00
Simon Ogorodnik
773fca5245 Use correct task to build builtins.jar 2017-12-15 20:09:42 +03:00
Simon Ogorodnik
640ce213cf Compile stdlib builtins ant pass it to Dokka
We need builtins to allow linking to type-aliased classes
such as Exception
2017-12-15 20:09:41 +03:00
Simon Ogorodnik
697b358293 Make local dokka run easier 2017-12-15 20:09:40 +03:00
Simon Ogorodnik
9ab48d8374 Suppress whole org.w3c 2017-12-15 20:09:38 +03:00
Simon Ogorodnik
99af2372c3 Suppress undocumented warnings for third-party js packages 2017-12-15 20:09:37 +03:00
Simon Ogorodnik
17106d6546 Use makeurl to create package-list URL in ant 2017-12-15 20:09:36 +03:00
Ilya Gorbunov
cc139856c8 List all source folders instead of project folder 2017-12-15 20:09:34 +03:00
Ilya Gorbunov
9b1867ce64 Docs: run gradle project and wrapper from the root dir
Build docs for kotlin-stdlib-jdk7/8 instead of jre7/8.
2017-12-15 20:09:33 +03:00
Simon Ogorodnik
a19e229a72 Minor: prepare for documentation generation 2017-12-15 20:09:32 +03:00
Ilya Chernikov
775eeb75c9 Treat daemon startup timeout/error exceptions the same way as RMI errors
will result on regular retry cycle on them, hopefully eliminating or
reducing appropriate exception reports
2017-12-15 15:24:38 +01:00
Mikhail Glukhikh
ea5a52f918 Restrict search scope in some inspections to avoid testData search
Affected inspections: can be private, can be parameter, unused symbol.
Related to KT-21756. May fix EA-113712.
2017-12-15 17:07:37 +03:00
Mikhail Glukhikh
2b5bbf0fdd Fix tests for "may be constant" inspection 2017-12-15 17:07:35 +03:00
Sergey Igushkin
3b4f82c9b9 Advance Gradle version -> 4.4
(cherry picked from commit 2fc7628)
2017-12-15 16:59:37 +03:00
Nikolay Krasko
6456f4ed98 Test step into for Java constructor with SAM conversion
Additional test for KT-21538

 #KT-21538 Fixed
2017-12-15 16:14:50 +03:00
Nikolay Krasko
d6cface66f Make isFromJava check work for SAM adapter extension descriptors (KT-21538)
Consider all callable descriptor in JavaClassDescriptor to be from Java.

This is used to check if smart step into should be intercepted by Kotlin
handler or delegated to Java.

 #KT-21538 Fixed
2017-12-15 16:14:50 +03:00
Nikolay Krasko
26413acf33 Refactoring: introduce method for reuse file for single class logic 2017-12-15 16:14:50 +03:00
Nikolay Krasko
5c33e4a32d Minor: remove warnings in KotlinStructureViewFactory 2017-12-15 16:14:49 +03:00
Nikolay Krasko
c79386594d Don't show useless fold icon in structure view (KT-17254, KT-21200)
#KT-21200 In Progress
 #KT-17254 Fixed
2017-12-15 16:14:49 +03:00
Nikolay Krasko
1688f6fdbd Minor: inline method in KotlinStructureViewElement and rewrite with when 2017-12-15 16:14:49 +03:00
Nikolay Krasko
7bf071b69f Precount 'isPublic' property if descriptor available 2017-12-15 16:14:49 +03:00
Nikolay Krasko
c28a7d8f6d Fix structure view auto-update (KT-21733, KT-19519)
- Fixed by subclassing PsiTreeElementBase instead of StructureViewTreeElement
- Warnings cleanup

 #KT-19519 Fixed
 #KT-21733 Fixed
2017-12-15 16:14:48 +03:00
Nikolay Krasko
b133189309 Rename: MyFunctionDescriptor -> SamAdapterExtensionFunctionDescriptorImpl 2017-12-15 16:14:48 +03:00
Toshiaki Kameyama
d719d06020 Don't suggest "convert to array literal" for *arrayOf #KT-21726 Fixed 2017-12-15 15:01:22 +03:00
Anton Bannykh
f68d639c63 Add @Target's to kotlin.test annotations 2017-12-15 14:14:00 +03:00
Toshiaki Kameyama
5680405531 "Redundant spread operator" inspection: support array literal
So #KT-21727 Fixed
2017-12-15 13:50:53 +03:00
Mikhail Glukhikh
df4bf73033 Convert lambda to reference: minor cleanup 2017-12-15 13:37:00 +03:00
Toshiaki Kameyama
0071ca64c7 Convert lambda to reference produces: fix case with qualified this
So #KT-19977 Fixed
2017-12-15 13:36:32 +03:00
Mikhail Glukhikh
50dc9a14a6 May be constant: fix corner case with getter & initializer 2017-12-15 13:31:49 +03:00
Mikhail Glukhikh
7358980cbc Add inspection to detect non-const vals used as Java annotation args
So #KT-20615 Fixed
2017-12-15 13:31:41 +03:00
Mikhail Glukhikh
70b7e5eb68 Introduce inspection to detect vals might be marked as const
So #KT-20644 Fixed
2017-12-15 13:05:50 +03:00
Yan Zhulanow
4ec20ad595 Minor: Fix build, remove inline function usage 2017-12-15 17:39:17 +09:00
Nicolay Mitropolsky
da98b7e07b Uast: type-mapper checks deeper for local classes (KT-21546, EA-100195) 2017-12-15 09:16:46 +03:00
Yan Zhulanow
f9813e3276 Kapt, Minor: Add kapt-runtime to sources for kotlin-annotation-processing-maven 2017-12-15 02:35:17 +09:00
Yan Zhulanow
187182e46f Noarg, Minor: Include IDEA 'testRuntime' dependency as in other compiler plugins 2017-12-15 02:35:16 +09:00
Yan Zhulanow
db4c441573 Kapt, Maven: Fix path for kapt3 compiler plugin sources 2017-12-15 02:35:16 +09:00
Yan Zhulanow
4d067ab9ce Kapt, Maven: Support passing javac/annotation processor options (KT-21565, KT-21566) 2017-12-15 02:35:15 +09:00
Yan Zhulanow
1af93b8342 Kapt: Consider all 'kapt' configuration dependencies as KaptTask dependencies. 2017-12-15 02:35:14 +09:00
Yan Zhulanow
6941065e2c Fix EA-1005833: Try to find a field using also the receiver type (KT-21820) 2017-12-15 02:35:13 +09:00
Yan Zhulanow
d58665b5a8 Kapt: Remove duplicating check, this also removes the senseless warning (KT-21425) 2017-12-15 02:35:12 +09:00
Yan Zhulanow
4c96453a4b Kapt: Annotations on enum constants are not kept on the generated stub (KT-21433) 2017-12-15 02:35:12 +09:00
Yan Zhulanow
c6f922fb64 EA-110813: Resolve the parent directory safely 2017-12-15 02:08:03 +09:00
Yan Zhulanow
e5a2be4f3c EA-96041: Make error message more user-friendly 2017-12-15 02:08:00 +09:00
Denis Zharkov
fa6285d32a Fix NPE in JavaNullabilityChecker when checking equals-calls
This NPE was introduced in ce41b5745a
Prior to the latter change there was a synthetic PSI element for each
equals-related call, thus callOperationNode was not null here.

== are intentionally treated as safe calls, but for nullability checker
it's not relevant, it only should report warnings on real safe-calls
2017-12-14 19:15:41 +03:00
Denis Zharkov
d64e8e3b33 Revert "Update bootstrap to 1.2.20-dev-732"
This reverts commit f7ccc4144c.
2017-12-14 19:15:41 +03:00
Nicolay Mitropolsky
6ac345df51 Caching KtLightClassForSourceDeclaration (KT-21701)
to make their UserData survive for longer, because otherwise a new LightClass with empty UserData comes to Spring every time, but Spring stores a lot of important things in UserData
2017-12-14 18:05:47 +03:00
Anton Bannykh
6bee5699a0 Migrate node_utils.xml to Gradle 2017-12-14 17:41:20 +03:00
Dmitry Jemerov
40184f053e Don't invoke formatter while checking availability of intentions
#KT-21632 Fixed
2017-12-14 12:02:39 +01:00
Dmitry Jemerov
54d626fe7d Change vendor to JetBrains to always enable exception reporting
#KT-17838 Fixed
2017-12-14 12:02:39 +01:00
Dmitry Jemerov
ba21bae653 Get rid of forced index rebuild on version change
#KT-17367 Fixed
2017-12-14 12:02:39 +01:00
Denis Vnukov
52ccd67ec1 Remove duplicate parameter null checks in JvmStatic delegate methods.
Remove unnecessary non-null parameter checks inside static delegate methods
created for @JvmStatic companion object methods. Allows function generation
strategy decide if such checks need to be injected.

 #KT-7188 Fixed
2017-12-14 13:48:50 +03:00
Alexander Udalov
9e82ab38f0 Fix lookup tracker tests after 2be7116b0b
Standard library is no longer automatically added to the classpath when
-Xbuild-file is used. Before 2be7116b0b, these tests worked because no
matter whether -Xbuild-file was used or not, the automatically computed
classpath (which erroneously was used to populate content roots in the
compiler) contained the standard library (see
K2JVMCompiler.configureContentRoots)
2017-12-14 11:37:56 +01:00
Alexander Udalov
46fa5cfae0 Add dependency on compiler dist from jps-tests
Otherwise, because there's no explicit dependency and the JPS plugin
loads the compiler from dist, the compiler jar is not rebuilt between
changes in compiler code and running jps-tests
2017-12-14 11:37:56 +01:00
Yan Zhulanow
5116f598df Kapt: Fix error message when no annotation processors were found (KT-21729)
Error message says "androidProcessor", it should be "annotationProcessor"
2017-12-14 19:28:51 +09:00
Denis Zharkov
f7ccc4144c Update bootstrap to 1.2.20-dev-732 2017-12-14 11:11:23 +03:00
Dmitry Petrov
1aab4e643c Add overflow-related tests for 'reversed' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
65b5cdbb8d Maintain bounds evaluation order in intrinsics for 'reversed'
Makes sense for 'rangeTo', 'downTo', and 'until' with non-const bounds.
2017-12-14 10:41:51 +03:00
Dmitry Petrov
9fa9a8748b Check that qualified const expressions are recognized properly in 'for' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
bf97b332cf Support const-bounded for loop generation for reversed 'until' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
54cceac99b Intrinsics for 'reversed': until 2017-12-14 10:41:51 +03:00
Dmitry Petrov
5f7460a8c7 Support const-bound counter loop generation for 'downTo' 2017-12-14 10:41:51 +03:00
Dmitry Petrov
2f0df832c0 Minor: pull up helper methods for const-bounded for-in-range generation 2017-12-14 10:41:51 +03:00
Dmitry Petrov
a4c29b3587 Support Long and Char in const-bounded counter loop generation
If the loop end value is a compile-time constant (best we can do now),
and it is safe to iterate over a given range using "naive" for loop
(using '<=' or '>=' in loop condition),
generate such loops for Longs and Chars as well Ints (Bytes, Shorts).
2017-12-14 10:41:51 +03:00
Dmitry Petrov
df2b8d01d8 Extract common code in PrimitiveNumberRangeLiteralRangeValue 2017-12-14 10:41:51 +03:00
Dmitry Petrov
455a1c0f53 Intrinsics for 'reversed': downTo
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
64ba811b7f Intrinsics for 'reversed': CharSequence.indices
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
7ba73c1635 Intrinsics for 'reversed': collection.indices
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
5bcbe25469 Intrinsics for 'reversed': array.indices
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
beff4a1b92 Intrinsics for 'reversed': support non-literal range expressions
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
1493805f8e Take into account step sign in pre-condition for simple progression
So far, all non-end-inclusive progressions had step > 0.
With intrinsics for 'reversed' this will change.
2017-12-14 10:41:51 +03:00
Dmitry Petrov
821843e13f Intrinsics for 'reversed': generate in-const-bound ranges as countable
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Dmitry Petrov
1775f294f4 Intrinsics for 'reversed': infrastructure & primitive range support
#KT-21323 In Progress
2017-12-14 10:41:51 +03:00
Mikhail Glukhikh
83ae34bb29 Fix leak in matchAndConvert (loopToCallChain) 2017-12-14 10:38:28 +03:00
Ilya Gorbunov
479f293edc Expose internal getProgressionLastElement to public api
To be used in compiler loop optimizations.
#KT-18869 Fixed
2017-12-14 07:22:08 +03:00
Ilya Chernikov
c453ff01cd Increase daemon socket queue size, make it controllable via system prop
Hopefully fixes #KT-15562
Also some minor refactoring
2017-12-13 17:34:13 +01:00
Ilya Chernikov
8f42aa1eda Improve parallel daemon start test:
- move asserts to the end to collect all diagnostics before it
  - disable compilation by default for better testing the startup logic
  - minor refactorings
2017-12-13 17:34:12 +01:00
Alexander Udalov
c5c4c9cfcc Support "-module-name" argument for common code compiler
#KT-20892 Fixed
2017-12-13 11:49:58 +01:00
Alexander Udalov
3ede503042 Minor, remove empty K2JSCompilerArguments.java 2017-12-13 11:49:58 +01:00
Alexander Udalov
cc9ebb26de Minor, improve "-module-name" argument description 2017-12-13 11:49:58 +01:00
Alexander Udalov
dc23a53116 Enumerate module roots directly in ModuleHighlightUtil2.getModuleDescriptor
This is faster than going through FilenameIndex which would call
GlobalSearchScope.accept for all "module-info.java" files in the
project, and there can be many of those.

Also see https://github.com/JetBrains/intellij-community/pull/670
2017-12-13 11:49:51 +01:00
Alexey Sedunov
38d3362bcb Configuration: Support selection of "Latest stable" version vs specific one
#KT-21229 Fixed
2017-12-12 20:48:26 +03:00
Mikhail Glukhikh
5252cd4da4 Lift return or assignment: use register...WithoutOfflineInformation 2017-12-12 19:47:52 +03:00
Mikhail Glukhikh
a375500a33 Spelling: MemberVisibilityCanPrivate > MemberVisibilityCanBePrivate 2017-12-12 19:47:46 +03:00
Dmitry Jemerov
db8147bd79 Regenerate test 2017-12-12 17:13:35 +01:00
Denis Zharkov
e24e711208 Avoid rebuilds after changes of layouts xml-files
This commit makes IC react more granularly on these changes
Precisely, it marks dirty only kt-files that having lookups into
synthetic package built upon a changed layout-file

 #KT-21622 Fixed
2017-12-12 16:17:58 +03:00
Denis Zharkov
58123f2103 Enable kotlin.incremental.usePreciseJavaTracking in gradle.properties 2017-12-12 16:17:58 +03:00
Denis Zharkov
a079b92ea0 Add property for precise version of Java tracking in Gradle IC
The flag name is kotlin.incremental.usePreciseJavaTracking
By default precise version is disabled

 #KT-17621 Fixed
2017-12-12 16:17:58 +03:00
Denis Zharkov
a978c6be35 Fix precise Java IC for multi-module projects
The problem may happen in case of multi-module projects:
If a Java class was effectively unused in one module (A),
but it's used in kt-files from the dependent module (B) then
we wouldn't track the changes of the class while compiling A
and don't recompile its usages in B.

It happens because now we track only Java classes that were
resolved by out frontend instead of all classes in the module
that would be more correct but it might be rather slow.

The idea is that whenever we see change in an untracked Java file
we start tracking the classes in it and for the first time we mark
all its content as changed.
2017-12-12 16:17:58 +03:00
Denis Zharkov
d9cfdf2f63 Add assertion to JavaClassesTrackerImpl::onCompletedAnalysis 2017-12-12 16:17:58 +03:00
Denis Zharkov
8dd5c2f895 Avoid serlialization for unrelated Java source-based classes
There is no need to track unknown (not being tracked before)
classes content of which we didn't request

 #KT-17621 Fixed
2017-12-12 16:17:58 +03:00
Denis Zharkov
f33255c990 Add jetbrains annotations to javac classpath in IncrementalJvmCompilerRunnerTest
Before this change some of these tests were failing
2017-12-12 16:17:58 +03:00
Denis Zharkov
df533053f9 Record special name lookup when trying use interface as a SAM
It was already working in JPS, because it see our synthetic classes
as subclasses for SAM's, but with non-JPS build we have to manually
tracking places that should be recompiled after SAM members are changed
2017-12-12 16:17:58 +03:00
Denis Zharkov
ae6421476d Refine dirty files computation in case of Java source changes
#KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Denis Zharkov
26393d738f Drop IncrementalCompilerRunner::markDirty and its override 2017-12-12 16:17:58 +03:00
Denis Zharkov
1702775738 Introduce JavaClassesSerializerExtension
It will be used to track java classes changes for incremental compilation

 #KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Denis Zharkov
c86dc0d7af Add protobuf extensions to serialized Java descriptors
#KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Denis Zharkov
34452f4f4a Introduce JavaClassesTracker interface into java resolution components
It's purpose is passing java classes being used during analysis
to incremental compilation to let it track diffs

Potentially it might be done the other way:
incremental compilation could build a separate container to analyze
necessary classes, but it's rather hard to implement now

 #KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Alexey Sedunov
9ed0b49746 Gradle: Compile Gradle models/model builders under JVM 1.6
This prevents imports failure in projects using older versions of Gradle

 #KT-21610 Fixed
2017-12-12 15:38:40 +03:00
Dmitry Petrov
a1a1972a04 Provide DescriptorUtils.isAnonymousFunction (for IR-based BE) 2017-12-12 15:29:45 +03:00
Anton Bannykh
0566366895 Make project wizards produce kotlin-test-js testDependency in all Kotlin/JS projects 2017-12-12 14:25:24 +03:00
Alexander Udalov
3c98274006 Move -Xjsr-305 argument parsing out of K2JVMCompilerArguments
To simplify K2JVMCompilerArguments, which is mostly a data holder
2017-12-11 18:02:37 +01:00
Alexander Udalov
5092758acb Improve help message on -Xjsr305 CLI argument 2017-12-11 18:02:04 +01:00
Dmitry Jemerov
900ec82614 Fix indent of expressions following elvis operator 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
87d2d16cda "Use continuation indent for expression body" for prop initializers 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
eacd010e7e Option to wrap elvis expressions
#KT-21720 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
d1daca2560 No line break before = in property initializer and function expr body 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
ab99bf843a Implement option for wrapping assignment statements
#KT-21718 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
947833cad6 Add wrap option for expression body functions
#KT-21470 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
3394d675e5 Option to use continuation indent in argument lists 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
3038f87105 Move two continuation indent wrapping options to wrapping page 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
dc4e673fb1 Initial support for chained call wrapping options
#KT-21529 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
1a93d10697 Refactoring: use more specific block type in signatures 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
3233d650c1 Refactoring: cleanup access to code style settings 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
ff99b921b7 Refactoring: work with ASTNodes in functional style 2017-12-11 17:58:02 +01:00
Dmitry Jemerov
389729cc50 Option for normal indent in supertype lists
#KT-21527 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
67cd4ed17a Don't indent closing parenthesis in conditions
#KT-21485 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
26d47a034e Don't indent closing parenthesis of a destructuring declaration
#KT-20758 Fixed
2017-12-11 17:58:02 +01:00
Dmitry Jemerov
4068b3d9b9 Add continuation indent for wrapped type aliases
#KT-21078 Fixed

fixup type alias
2017-12-11 17:58:02 +01:00
Nikolay Krasko
1ada284a03 Better folding for mulitline strings (KT-21441)
#KT-21441 Fixed
2017-12-11 18:28:01 +03:00
Nikolay Krasko
ab7ba3ae46 Add exit point highlighting for accessors (KT-21318)
#KT-21318 Fixed
2017-12-11 18:28:00 +03:00
Alexey Andreev
93f8542fc4 JS: serialize location of JsCase/JsDefault
See KT-21699
2017-12-11 17:20:15 +03:00
Alexey Andreev
25e56874c1 JS: readable error when source maps change in IC tests 2017-12-11 17:20:15 +03:00
Alexey Tsvetkov
c13b2a6bbc Test incremental recompilation of enum usage in JS 2017-12-11 17:20:14 +03:00
Andrey Mischenko
e1dbb90fdd KT-21729 Error message says "androidProcessor" should be "annotationProcessor" 2017-12-11 09:29:06 +08:00
Toshiaki Kameyama
4563cf250d "Add type" quick fix incorrectly processes vararg modifier with primitive type array initializer #KT-21544 Fixed 2017-12-08 15:46:45 +01:00
Dmitry Jemerov
846e50dcaa Wording fix 2017-12-08 15:44:18 +01:00
Toshiaki Kameyama
270b41dc66 KT-13378 Provide ability to configure highlighting for !! in expressions and ? in types 2017-12-08 15:44:18 +01:00
Dmitry Jemerov
ab619c5655 Improve wording; mark inspection as cleanup tool 2017-12-08 15:41:22 +01:00
Toshiaki Kameyama
0e2bdf8995 Add inspection to sort modifiers #KT-21560 Fixed 2017-12-08 15:41:22 +01:00
Alexander Udalov
2be7116b0b Deduplicate classpath roots in compiler when -Xbuild-file is used
In kotlin-gradle-plugin, the compiler is invoked with a
K2JVMCompilerArguments instance where both the classpath is set, and the
buildFile is used (containing the same classpath entries in XML).
Previously, the compiler concatenated those two classpaths, which
resulted in duplicated entries, which could slow down compilation. Now,
if buildFile is used, the classpath passed explicitly is ignored
(exactly as, for example, destination ("-d"), which is also stored in
the XML build file).

No test added because there doesn't seem to be any change in
user-visible behavior
2017-12-08 12:07:22 +01:00
Alexander Udalov
d65b999c2c Minor, rename variable for clarity 2017-12-08 12:07:22 +01:00
Ilya Gorbunov
0b9830248d Restore original accessor signature as deprecated
The deprecated function is not operator because it covers cases where it was used in explicit form.

#KT-18789
2017-12-07 20:26:53 +03:00
Ilya Gorbunov
7efaa7cabc Allow delegating val properties to out-projected MutableMap
Change generic signature of MutableMap.getValue, use 'out @Exact V' and `V1: V` types instead of single `in V`.
Fix affected IR generation tests.

#KT-18789 Fixed
2017-12-07 20:26:53 +03:00
Mikhail Glukhikh
e503c1d411 Suspend call detector: fix delegated properties checking 2017-12-07 15:54:47 +03:00
Mikhail Glukhikh
24bd31457c Has suspend calls: fix suspend iterator case 2017-12-07 15:54:47 +03:00
Mikhail Glukhikh
4404439521 Introduce "redundant suspend" inspection #KT-19103 Fixed 2017-12-07 15:54:47 +03:00
Mikhael Bogdanov
edefb45585 Copy sam wrappers during inline
#KT-21671 Fixed
2017-12-07 12:57:43 +01:00
Mikhael Bogdanov
4eb30b6626 Code clean 2017-12-07 12:57:42 +01:00
Mikhail Zarechenskiy
d47130eff8 [NI] Don't check type for constants too early to avoid mismatch 2017-12-07 14:18:20 +03:00
Mikhail Zarechenskiy
6c27a49114 [NI] Use effective variance for equal approximated type
It's totally safe from the point of type system and reduces extra `out` projections that can add problems with subtyping
2017-12-07 14:18:17 +03:00
Dmitry Savvinov
874267b79d Report cyclic scopes properly
This commit introduces proper handling of recursion in scopes, which
could occur when some of companion object supertypes are members of
that companion owner:

```
class Container {
  open class Base
  companion object : Base()
}
```

To resolve `Base`, we have to build member scope for `Container`.
In the member scope of `Container`, we see all classifiers from
companion and his supertypes
So, we have to resolve companion objects supertype, which happens to be
`Base` again - therefore, we encounter recursion here.

Previously, we created `ThrowingLexicalScope` for such recursive calls,
but didn't checked for loop explicitly, which lead to a wide variety of
bugs (see https://jetbrains.quip.com/dc5aABhZoaQY and KT-10532).

To report such cyclic declarations properly, we first change
`ThrowingLexicalScope` to `ErrorLexicalScope` -- the main difference is
that latter doesn't throws ISE when someone tries to resolve type in it,
allowing us to report error instead of crashing with exception.

Then, we add additional fake edge in supertypes graph (from
host-class to companion object) which allows us to piggyback on existing
supertypes loops detection mechanism, and report such cycles for user.
2017-12-07 14:14:08 +03:00
Dmitry Savvinov
33f9576dd1 [NI] Turn off KnownTypeParameterSubstitutor for NI
The main consequence of it is that TYPE_MISMATCH range for control
structures became wider.

Also, for extra safety, don't change behaviour of OI.
2017-12-07 14:05:42 +03:00
Denis Zharkov
4ed6928e6b Avoid building stubs in KtFile::getClasses for compiled files
In Gradle, JavaPsiFacade finds Kotlin compiled files as KtFile instances
and tries to obtain classes from them.

And while it returns an empty array anyway, it starts building
unnecessary stub when calling `isScript`
2017-12-07 12:53:33 +03:00
Denis Zharkov
6007d244f3 Optimize LazyJavaAnnotations::isEmpty 2017-12-07 12:53:33 +03:00
Denis Zharkov
07df29dfbf Optimize LazyJavaScope::getPropertyType
Avoid running hasConstantNotNullInitializer for non-primitive fields
2017-12-07 12:53:33 +03:00
Denis Zharkov
5e334550eb Optimize entry point check in UnusedSymbolInspection
It helps to avoid return types calculation for light-class element
2017-12-07 12:53:33 +03:00
Denis Zharkov
dd3dbda719 Optimize computation of default excluded import in IDE
Prior to this change, it was rather slow since it would lead
to a ModuleDescriptor::packageFragmentProviderForWholeModuleWithDependencies
computation, that would force the computation of libraries'
dependencies, that actually was the major bottleneck here.

The idea is that we do not need to search through dependencies
of dependencies, but only need contents of one of the modules
direct content.

This commit is made under the assumption that if a module has may see
some runtime parts, than runtime jar should be among its direct
depenencies.
2017-12-07 12:53:33 +03:00
Denis Zharkov
4b96311600 Add faster get*Names overrides in LazyClassMemberScope 2017-12-07 12:53:33 +03:00
Denis Zharkov
ac56965a99 Do not force loading all kt-files inside LazyPackageDescriptor constructor
Effectively it leads to all stubs being built for any once used package

The idea is that they only were used for FILE_TO_PACKAGE_FRAGMENT
that is mostly read in backend and rarely in the IDE, so we can replace
its usages with searching through related package-fragments
2017-12-07 12:53:33 +03:00
Denis Zharkov
d655c4075c Introduce index for the set of top-level names by package
It should help with actual loading of all the stubs for all declarations
in the package on every access when it's implemented through
`getDeclarations()`
2017-12-07 12:53:33 +03:00
Denis Zharkov
ce41b5745a Avoid creating synthetic safe-call nodes when resolving == calls
Each of them leads to a separate synthetic file retained in the memory
2017-12-07 12:53:33 +03:00
Denis Zharkov
cc312bcaa2 Avoid creating a separate synthetic file for each default import 2017-12-07 12:53:33 +03:00
Denis Zharkov
2d82cb936e Fix potential memory leak in light-classes
The problem is that they might indirectly retain a reference to an
obsolete ResolverForProject (it becomes outdated after out of block
modification).

The best solution would be to avoid preserving jvm-related diagnostics
(that are only used once to report them when highlighting, and exactly
they retains an obsolete resolve session)

But it seems that this may lead to a deep light-classes refactoring and
the temporary fix is storing diagnostics themselves in a CachedValue
bound to out of block modification tracker. There're no guarantees that
this would help, since CachedValue anyway is based on soft-reference
that is not the first thing GC collects
2017-12-07 12:53:33 +03:00
Denis Zharkov
a67598e0c1 Minor. Apply intention for "?: false" -> "== true" in light classes 2017-12-07 12:53:33 +03:00
Denis Zharkov
f1cbf21f96 Simplify LazyLightClassDataHolder
- Use only stubs instead of full results in LazyLightClassData
- Store only stubs for inexactStub
2017-12-07 12:53:33 +03:00
Dmitry Savvinov
aaee401240 [NI] Minor renaming
Use words 'returnArgument' instead of 'resultArgument' when talking
about values, which can be possibly returned from lambda.

Correct 'addSubsystemForArgument' -> 'addSubsystemFromArgument'
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
30a51af931 [NI] Minor: rename typo KotlinCallDiagnistics.kt -> KotlinCallDiagnostics.kt 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
1ada52968b [NI] Fix KnownTypeParameterSubstitutor for !! 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
15a595749b [NI] Weird testdata change after fixes in ErrorTypes
The issue here is that OI infers correct types for (k, v) destructing
declaration, while NI infers errors for them. That happens because NI
resolves iterator() on nullable 'm', but rightfully reports it as
unsuccessful, while OI somehow manages to resolve it to success (and
thus getting nice expected type, allowing destructing declaration to be
resolved in a proper types).
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
ea72c76a37 [NI] Testdata changes after fixes in error types 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
957bbe291d [NI] Don't approximate error types
Previously, we did approximation of error types to Any?/Nothing in some
contexts (e.g. non-local declarations).

There are several reasons why it is not desired:
- OI doesn't approximate ErrorType
- This behaviour is inconsistent with ourselves (i.e. sometimes we *do*
  infer errortype for top-level declaration)
- It causes different digressions from OI in reported diagnostics

This commit turns off error type approximation. It causes large testdata
shift, which is deliberately split into several parts and commited in a
separate commits.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
70a1beeff6 [NI] Use ErrorType in ParseErrorKotlinCallArgument
Previously, there was receiver of type Nothing, which could case result
of the call to be inferred to Nothing too. This could case bogus
UNREACHABLE_CODE diagnostics in cases like this:

```
fun <T> id(x: T) = x
fun test() {
    id(unresolvedReference) // type of statement is 'Nothing'
    // ... everything here is marked as unreachable ...
}
```

This commit changes type of receiver for such calls form Nothing to
ErrorType.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
eadd1355c2 [NI] Add ErrorType constraint
Previously, constraint wasn't added if bound was ErrorType. That could
cause TypeVariable to be inferred to Any?/Nothing instead of ErrorType,
which could influence other parts of analysis (in particular, inferring
Nothing instead of ErrorType can cause bogus UNREACHABLE_CODE diagnostics)

Because of that fix, intersection type can be added to CS as supertype,
which provokes AssertionError. This commit also relaxes this assertion,
as it seems that it's valid that supertype is an intersection type.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
8e50a58408 [NI] New failing test after changes in applicabilities 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
816d89e393 [NI] Improved testdata after changes in applicabilities
This commits introduces testdata changes, where NI behaviour strictly
improved, after several previous fixes.

For some tests, just WITH_NEW_INFERENCE directive was added. It
indicates, that some of previous commits first introduced error in that
test, and then some other commit fixed it (netting no overall testdata
change). It is preferrably to keep those annotations until we will
migrate to NI completely, to prevent unexpected regressions.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
9f63818bd3 [NI] Introduce INAPPLICABLE_ARGUMENTS_MAPPING_ERROR for some NI diagnostics 2017-12-07 12:49:56 +03:00
Dmitry Savvinov
e2d65adc7e [NI] Fix KotlinResolutionCandidate.isSuccessfull
Check if ConstrainSystem has any contradiction in 'isSuccessful'.
Otherwise we may erroneously think that there are some successful
candidates in 'TowerResolver.SuccessfullResultCollector.pushCandidates()'
and clear other unsuccessful ones (while they actually may have higher
applicability).
2017-12-07 12:49:56 +03:00
Dmitry Savvinov
78a526c937 [NI] Support EffectSystem
- During final phase of resolution (i.e. converting NI-results to
OI-results), make call into EffectSystem to record all necessary
effects-related information.

- To be able to enhance resulting dataFlowInfo for call at that stage,
introduce internal method 'updateResultingDataFlowInfo' in
NewResolvedCallImpl.
2017-12-07 12:49:56 +03:00
Toshiaki Kameyama
b23d62c760 Transfer type to parent property in "Remove redundant getter" inspection
So #KT-21612 Fixed
2017-12-07 12:19:35 +03:00
Mikhail Glukhikh
834c3fe62b Do not inline property setter if it's not required (e.g. ReplaceWith)
So #KT-21237 Fixed
2017-12-07 12:14:29 +03:00
Mikhail Glukhikh
bddaab9d48 Inline properties without setter / with default setter correctly
Related to KT-21237
2017-12-07 12:14:29 +03:00
Nikolay Krasko
fba50a8d15 Disable language injection for SpEL language as it cause to many troubles
It's known that there're several inspections that report warnings when
SpEL language is injected not to Java files if IDEA is before 173.
2017-12-07 12:02:39 +03:00
Michal Bendowski
6f350c032d Recognize injections in annotations (KT-13636)
Recognize patterns from both Java (psiMethod) and Kotlin
(kotlinParameter) that match the annotation argument.
2017-12-07 12:02:37 +03:00
Nikolay Krasko
b7ba45c001 Reparse lambda expression after removing parameter comma (KT-21497)
Without the parameter it can become block.

 #KT-21497 Fixed
2017-12-07 12:02:07 +03:00
Nikolay Krasko
273bd55f01 Refactoring: extract methods 2017-12-07 11:49:19 +03:00
Dmitry Petrov
04ab3e1519 Use ForInSimpleProgressionLoopGenerator for most of the loop intrinsics 2017-12-07 11:36:20 +03:00
Dmitry Petrov
6b6ae2f7d7 Minor: formatting 2017-12-07 11:36:20 +03:00
Dmitry Petrov
75315a4edb Replace BoundedValue objects in 'indices' with SimpleBoundedValue 2017-12-07 11:36:20 +03:00
Nicolay Mitropolsky
209ba89a49 Uast: KotlinSecondaryConstructorWithInitializersUMethod introduced as workaround for KT-21617
to be the only constructor which includes `init` block when there is no primary constructors in the class
2017-12-06 22:19:57 +03:00
Nicolay Mitropolsky
b8069b48c5 Uast: returning back secondary constructors bodies (KT-21575)
but secondary constructors without primary constructor will not contain initializers, it is still an issue
2017-12-06 22:19:57 +03:00
Nikita Skvortsov
962c512882 optimize search for modules nodes 2017-12-06 18:55:09 +01:00
Nikita Skvortsov
cc580ca1dc optimize check of module-per-source-set 2017-12-06 18:55:09 +01:00
AJ Alt
8297fee615 Fix typo in File.copyTo KDoc 2017-12-06 18:11:11 +01:00
Yusuke Hosonuma
949f9b9342 gitignore: remove duplicates 2017-12-06 18:09:43 +01:00
Nikolay Krasko
110a9ff600 Fix project configuration: avoid adding test jar as library dependency
For some reason gradle processes "testJar" task differently and collects
artifacts for it during configuration phase. This helps Idea project
configurator understand that there's no need to attach test jar as separate
binary library dependency.

Having compiled module in dependencies results IDEA finds both compiled and
source version of classes. This may cause bad navigation and reindexing.
2017-12-06 19:14:28 +03:00
Mikhail Zarechenskiy
1d736f59b6 [NI] Refine nullability for CST of types with undefined nullability 2017-12-06 18:36:20 +03:00
Mikhail Zarechenskiy
b9d390449c [NI] Refactor constraints transformations, update comments 2017-12-06 18:36:19 +03:00
Mikhail Zarechenskiy
351c592c83 [NI] Drop hack that was used before DefinitelyNotNull types 2017-12-06 18:36:17 +03:00
Mikhail Zarechenskiy
b2299ed19f [NI] Fix testdata after introducing DefinitelyNotNull types 2017-12-06 18:36:16 +03:00
Mikhail Zarechenskiy
9565b56b2a [NI] Render DefinitelyNotNull types with !! postfix 2017-12-06 18:36:14 +03:00
Mikhail Zarechenskiy
7f0cca52ca [NI] Use definitely not-null types for smartcasts 2017-12-06 18:36:13 +03:00
Mikhail Zarechenskiy
64f0688b71 [NI] Introduce DefinitelyNotNullType as type for T!! or {T & Any} 2017-12-06 18:36:11 +03:00
Mikhail Zarechenskiy
8e0171d475 [NI] Don't loose platform types on simplifying lower constraints 2017-12-06 18:08:52 +03:00
Alexey Sedunov
e2743c8f34 Rename: Do not use KotlinDirectoryAsPackageRenameHandler via dispatch handler
#KT-21604 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
e1ed74008f Rename: Fix exception on attempt to rename KtConstructorDelegationReference
#KT-21536 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
ec85b708c9 Misc: Use delegate with predefined name for fake light methods
#KT-21414 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
89352a295d Maven Import: Support compiler arguments specified directly in <args>
#KT-21592 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov
288560eb37 Misc: Fix project configuration test 2017-12-06 14:17:55 +03:00
Alexey Sedunov
4369c6d26c Minor: Update Maven import test data 2017-12-06 14:17:55 +03:00
Mikhael Bogdanov
5c2f5fee39 Make 'addCommonSourceSetToPlatformSourceSet' open to support native specifics 2017-12-06 10:57:08 +01:00
Mikhael Bogdanov
60b812e3dd Increase android emulator startup await 2017-12-06 10:57:08 +01:00
shiraji
5d44037a2b Support 'it op something' case in "redundant let" #KT-21373 Fixed 2017-12-05 19:23:44 +03:00
Ramon Wirsch
f961f33f9d Fix for KT-19188
Fixes nondeterministic Default Method Order under existance of generic
type parameters.
SubstitutingScope did not respect source code method order by not using
a LinkedHashSet
2017-12-05 18:33:22 +03:00
Mikhail Glukhikh
8257e14055 J2K: perform additional isActiveFor check before applying inspections 2017-12-05 18:21:22 +03:00
Mikhail Glukhikh
7eb62b9ca4 Add kapt as test runtime dependency to J2K 2017-12-05 18:18:48 +03:00
Mikhail Glukhikh
a90e3c2e45 Add "replace map.put with assignment" to J2K
Related to KT-21502
2017-12-05 18:18:25 +03:00
Dereck Bridie
8c305a137f Introduce inspection "replace map.put with assignment" #KT-21502 Fixed 2017-12-05 16:57:36 +03:00
Nikolay Krasko
ab28bdf32f Store in test data failure for quotedName name 2017-12-05 16:07:55 +03:00
Nikolay Krasko
57d62eb74a Document error behaviour of evaluate expression lost sometime 2017-12-05 16:07:54 +03:00
Nikolay Krasko
b21fb1a375 Replace assertTrue with assertEquals in AbstractKotlinEvaluateExpressionTest 2017-12-05 16:07:53 +03:00
Nikolay Krasko
04e6aa76cf Fix lint apiCheck lint 2017-12-05 16:07:53 +03:00
Dmitry Petrov
3d473f608e Add more tests for for-in-array
#KT-21354 Fixed Target versions 1.2.20
 #KT-21321 Fixed Target versions 1.2.20
2017-12-05 15:45:20 +03:00
Dmitry Petrov
e4ecc13e13 Generate for-in-array loops with proper semantics in 1.3+
In Kotlin 1.3+, assignment to the for-in-array loop range variable in
the loop body doesn't affect loop execution (as if it was a loop on an
array iterator, or some other container).

 #KT-21354 In Progress
 #KT-21321 In Progress
2017-12-05 15:45:20 +03:00
Dmitry Petrov
7a6f80606b Warn on for-in-array range variable assignment in loop body
According to KT-21354, this should be a warning in 1.2 and before, and
no warning (with changed semantics) in 1.3 and later.
NB there are some false positives in this check.

 #KT-21354 In Progress
 #KT-21321 In Progress
2017-12-05 15:45:20 +03:00
Mikhail Glukhikh
7118a4bf80 Fix KNPE in "introduce variable", add some name conflict introduce tests
So #KT-21530 Fixed
2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
20b48ab90c Fix suggested names in Spring (do not take same parameter into account) 2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
b09465ca0b Unnecessary variable: do not suggest in case of name duplication
So #KT-20300 Fixed
2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
844dd1c43c Refactoring: Unnecessary variable inspection 2017-12-05 15:29:45 +03:00
Mikhail Glukhikh
52053695fe Fix variable name validator (take parameters into account) 2017-12-05 15:29:44 +03:00
Toshiaki Kameyama
e341ec969f "Join declaration and assignment" should remove 'lateinit' for 'var' #KT-21603 Fixed 2017-12-05 11:19:58 +09:00
Ilya Chernikov
075203ad33 Make embedding javaslang into compiler intransitive, as it was before gradle
fixes KT-21537

(cherry picked from commit cc5c1d5)
2017-12-04 14:47:53 +01:00
Mikhail Glukhikh
ac3542c041 Minor cleanup 2017-12-04 15:58:13 +03:00
Toshiaki Kameyama
74d83997c7 Fix false "function is never used" for functions with '@JvmName'
So #KT-20435 Fixed
2017-12-04 15:58:13 +03:00
Denis Zharkov
84282035b0 Set up projectTest.workingDir for incremental-compilation-impl 2017-12-04 15:21:03 +03:00
Mikhail Glukhikh
fb8dc7b590 Minor cleanup 2017-12-04 15:16:04 +03:00
Toshiaki Kameyama
0eec3ef1f8 Add / preserve semicolon after empty companion object #KT-21179 Fixed 2017-12-04 15:15:49 +03:00
Alexey Andreev
45e5cc190f Update DCE limits in JS tests 2017-12-04 11:25:39 +03:00
Dmitry Petrov
0db6e5c3f3 Fix SAM wrapper generation in secondary constructor calls
Should simply invoke 'checkSamCall' in corresponding visitor method to
check if call arguments should be wrapped.
2017-12-04 10:29:33 +03:00
Dmitry Petrov
3431a1445c Fix enum entry class delegating constructor call generation
When the enum entry requires a specific class, its constructor should
invoke proper supertype constructor (from the corresponding enum class).
Corresponding resolved call should be passed from the front-end in
CONSTRUCTOR_RESOLVED_DELEGATION_CALL slice.
In case of enum entries without explicit supertype initializer, this
information was missing.
2017-12-04 10:29:33 +03:00
Ilmir Usmanov
d8c4d19152 Make suspendCoroutineOrReturn ordinary function 2017-12-01 20:18:04 +03:00
Yan Zhulanow
0b37c9e83c Kapt: Report about of time spent in each annotation processor in verbose mode (KT-21542) 2017-12-01 22:53:22 +09:00
Yan Zhulanow
ef6be206d0 Kapt: Clear URL cache after changing annotation processor JAR 2017-12-01 22:53:22 +09:00
Yan Zhulanow
84a766de24 Kapt: Register AP classpath as an input for "generate stubs" and "kapt" tasks
...so if the annotation processor artifact is changed, annotation processing will be relaunched.
2017-12-01 22:53:22 +09:00
Yan Zhulanow
9e43992094 Minor: Update kapt converter test for imports 2017-12-01 22:53:21 +09:00
Yan Zhulanow
3dc7502b0b Kapt, minor: Remove kaptError with location, it doesn't do anything reasonable now anyway 2017-12-01 22:53:21 +09:00
Yan Zhulanow
a4a7db06d2 Kapt: force resolve import references in partial analysis mode (required for import conversion in correctErrorTypes) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
1a3317ae2b Kapt: Attach generated classes directory as library source (KT-19823)
This may seem like a magic, but actually it's deadly simple.

GradleProjectResolver.mergeLibraryAndModuleDependencyData() tries to find a better substitution for the absolute BINARY paths, but actually makes things worse in our case.
GradleProjectResolver checks if the provided path is in the Gradle project output path list, and if the answer is yes, then it replaces our path to a Gradle Project (or a module in JPS terminology) dependency.
2017-12-01 22:53:21 +09:00
Yan Zhulanow
2e17c0b7f1 Kapt: Filter out non-package all-under imports whenever possible in "correctErrorTypes" (KT-21359) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
00bb38fbb1 Kapt: Support import directive with aliases in "correctErrorTypes" mode (KT-21358) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
c7645bcf03 Kapt: Replace error.NonExistentClass usages to Object (as it does not break class hierarchies) 2017-12-01 22:53:21 +09:00
Yan Zhulanow
e46fe9b255 Kapt: Do not add duplicating library entries in project importing 2017-12-01 22:53:20 +09:00
Yan Zhulanow
3d1ca61f9f Kapt: Remove artificial KaptError exception on errors from annotation processor (KT-21262) 2017-12-01 22:53:20 +09:00
Yan Zhulanow
0a0de8da29 Kapt: Fix correctErrorTypes for getters of properties defined in the primary constructor 2017-12-01 22:53:20 +09:00
Yan Zhulanow
182c2e2eeb Kapt: Launch integration tests also under Java 9 2017-12-01 22:53:20 +09:00
Yan Zhulanow
6ccf361942 Kapt: -Xmaxerrs javac option is not propagated properly (KT-21264) 2017-12-01 22:53:20 +09:00
Yan Zhulanow
2819fc718a Parcelable: Migrate to canonical NEW-DUP-INVOKESPECIAL form (KT-20545) 2017-12-01 22:53:20 +09:00
Yan Zhulanow
37543deefa Kapt: Keep KDoc comments in Java stubs (KT-21205) 2017-12-01 22:53:19 +09:00
Yan Zhulanow
af57ab8119 Kapt: Fix remaining issues with Java 9 compatibility in converter, add Java 9 tests 2017-12-01 22:53:19 +09:00
Yan Zhulanow
dde87ae1f9 Attempt to fix Gradle project importing error on older Gradle versions (KT-20967) 2017-12-01 22:53:19 +09:00
Yan Zhulanow
49db1bfe5d Introduce preliminary check for special annotations (allopen/noarg/samWithReceiver) (KT-21194) 2017-12-01 22:53:19 +09:00
Yan Zhulanow
ecfb045790 Android Extensions: Do not generate synthetic components in Kotlin Bytecode tool window when the Gradle plugin is disabled 2017-12-01 22:53:19 +09:00
Yan Zhulanow
8496ff8611 Minor: Add kotlin-android-extensions-runtime dependency to get rid of error messages in IDE 2017-12-01 22:53:19 +09:00
Yan Zhulanow
037caf3a17 Kapt: Prefer Kotlin diagnostic locations over ones from stubs 2017-12-01 22:53:19 +09:00
Yan Zhulanow
861d778530 Kapt: Fix 'correctErrorTypes' for primary constructor properties 2017-12-01 22:53:18 +09:00
Yan Zhulanow
7136bf7e0a Kapt: Add Kotlin location to diagnostics reported in Kapt stubs 2017-12-01 22:53:18 +09:00
Yan Zhulanow
8fba19f269 Kapt: Do not print empty diagnostic messages 2017-12-01 22:53:18 +09:00
Yan Zhulanow
5efdf111f5 Kapt: Support type aliases in correctErrorTypes mode (KT-19402) 2017-12-01 22:53:18 +09:00
Yan Zhulanow
84e5fa38bb Kapt: Exclude all primitive Java constants from inlining (String is still inlined) (KT-20878) 2017-12-01 22:53:18 +09:00
Yan Zhulanow
6ca5787799 Kapt: Allow to ignore specific methods/fields from being put into kapt stubs
Classes can't be ignored yet as it requires to ignore also all type usages which is a non-trivial operation.
2017-12-01 22:53:18 +09:00
Yan Zhulanow
fd84ecda54 Kapt: Add runtime library, move all modules inside the 'kapt3' directory 2017-12-01 22:53:17 +09:00
Yan Zhulanow
b74ef72af7 Kapt: Forbid illegal Java identifiers in Enum value literals 2017-12-01 22:53:17 +09:00
Yan Zhulanow
f52749741b Minor: Remove unused fileManager property 2017-12-01 22:53:17 +09:00
Yan Zhulanow
bdf77ccb65 Kapt: Refactoring, replace getValidIdentifierName() with more appropriate isValidIdentifier() 2017-12-01 22:53:17 +09:00
Yan Zhulanow
f368414328 SamWithReceiver: Pick the right compiler plugin (KT-20813) 2017-12-01 22:53:17 +09:00
Yan Zhulanow
3d7222485d Android Extensions: Add missing documentation, move the hasCache property to the compiler module 2017-12-01 22:53:16 +09:00
Yan Zhulanow
e4f476c09f Kapt, Maven: Fix running with the non-clean build (KT-20816)
Clean target directories for kapt stubs and generated source files.
Filter out the compile destination directory from the classpath.
2017-12-01 22:53:16 +09:00
Yan Zhulanow
381379fb62 Kapt, Maven: Clean directories for generated sources and stubs before AP 2017-12-01 22:53:16 +09:00
Yan Zhulanow
b074c7e22f Minor: Return back the whole test contents 2017-12-01 22:53:16 +09:00
Yan Zhulanow
1f65f8bc97 Encode all compiler plugin arguments for Android Extensions in kapt
Commas in option values breaks the option parsing in daemon (KT-20235).
2017-12-01 22:53:16 +09:00
Yan Zhulanow
425d104255 Parcelable: Convert I to Z explicitly, older Android Dex has strict checks for it (KT-20928) 2017-12-01 22:53:16 +09:00
Yan Zhulanow
e28cffd0ad Parcelable: newArray() result type should be Object[] (KT-20717) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
26005751d8 Parcelable: Fix compatibility with serialization plugin (KT-20742) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
3d155dd757 Kapt: Support Java 9 in Gradle plugin infrastructure 2017-12-01 22:53:15 +09:00
Yan Zhulanow
c6eab6f72e Kapt: Support Java 9 in compiler plugin 2017-12-01 22:53:15 +09:00
Yan Zhulanow
e97b3ed324 Kapt: Get rid of DatatypeConverter in order to support JDK9 (KT-20749) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
fa54a0c642 AllOpen: Add Validated to the list of annotations supported by kotlin-spring plugin (KT-20751) 2017-12-01 22:53:15 +09:00
Yan Zhulanow
eccc3447f6 Infrastructure: move compiler plugin tests back to their modules 2017-12-01 22:53:14 +09:00
Alexander Udalov
7248f2568a Drop USE_NEW_INFERENCE, configure language version settings in KotlinTestUtils
This will only have effect for tests which do not use their own instance
of LanguageVersionSettings though
2017-12-01 13:35:25 +01:00
Alexey Andreev
9c0e049bbe JS: fix boxed char with latest changes in compiler 2017-12-01 15:20:34 +03:00
Nikolay Krasko
2c79481f37 Add IdeaOpenApiClassFinder and BundledGroovyClassFinder to known finder
Fix testKnownNonClasspathFinder for 173 branch
2017-12-01 00:44:05 +03:00
Nikolay Krasko
e2418ec892 Remove custom runtime configure from AbstractParameterInfoTest 2017-12-01 00:44:05 +03:00
Nikolay Krasko
f460104ace Unconfigure library in AbstractLineMarkersTest 2017-12-01 00:44:04 +03:00
Nikolay Krasko
22b0dd91e4 Fix GradleConfiguratorTest: jre8 is expected for 1.1.2 version 2017-12-01 00:44:04 +03:00
Nikolay Krasko
3dc494ed00 Some qualified names might be null for classes 2017-12-01 00:44:04 +03:00
Nikolay Krasko
32da2ccb81 Don't intercept unexpected exceptions in AbstractQuickFixTest.kt 2017-12-01 00:44:04 +03:00
Nicolay Mitropolsky
f67db64dba *kapt3-idea* added to *ultimate* as testRuntime dependency
because of falling tests. It seems that there is not such issue in 1.2.0 branch
2017-11-30 21:27:56 +03:00
Nicolay Mitropolsky
4db5ca66e3 Uast: constructors calls consistency for KtObjectLiteralExpression (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
1dbce18afc Uast: constructors calls consistency except anonymous object literals (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
77be33d433 Uast: KotlinPrimaryConstructorUMethod renamed to KotlinConstructorUMethod (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
1ce21583ad Uast: secondary constructors delegation support (KT-21409) 2017-11-30 20:08:16 +03:00
Nicolay Mitropolsky
3bfa5c4706 Uast: parsing primary constructors superCalls (KT-21409) 2017-11-30 20:08:16 +03:00
Mikhail Glukhikh
a39f2f8271 Downgrade "use expression body" inspection to INFORMATION default level
(cherry picked from commit b6bc8eb)
2017-11-30 17:19:19 +03:00
Mikhail Glukhikh
0d65df4d3e Recursive equals: case with recursive not equals + extra tests 2017-11-30 16:47:27 +03:00
Mikhail Glukhikh
13e0ba0836 Recursive equals: fix false positive with different argument
Related to KT-13702
2017-11-30 16:44:51 +03:00
Mikhail Glukhikh
917be5d271 Support "recursive equals" for direct equals call (related to KT-13702) 2017-11-30 16:44:50 +03:00
Mikhail Glukhikh
e301506460 Simplify and fix "recursive equals" inspection (related to KT-13702) 2017-11-30 16:44:45 +03:00
Toshiaki Kameyama
b8fcdea673 Add inspection for equals which is called recursively within itself
So #KT-13702 Fixed
2017-11-30 16:44:20 +03:00
Mikhail Glukhikh
bd348911af Add "unused equals" for direct calls without receiver
Related to KT-21192
2017-11-30 16:44:16 +03:00
Mikhail Glukhikh
64159a900a Add "unused equals" warning on direct equals call #KT-21192 Fixed 2017-11-30 16:43:54 +03:00
Mikhail Glukhikh
07ec4ecd7f Add tests for KT-19511 and KT-21192 (with void -> boolean) 2017-11-30 16:43:53 +03:00
Sergey Igushkin
bf2e3decaa Add :kotlin-annotation-processing-gradle:install dependency to Gradle IT 2017-11-30 15:42:42 +03:00
Sergey Igushkin
98e8e73810 Fix kotlin-reflect dependency IDE import after API separation.
(cherry picked from commit 19967a2)
2017-11-30 15:42:42 +03:00
Alexey Andreev
af6adc61ae Update bootstrap to 1.2.20-dev-524 2017-11-30 15:27:41 +03:00
Alexey Andreev
acb058f328 JS: fix bootstrap build error related to updates in source maps 2017-11-30 14:26:05 +03:00
Nikolay Krasko
f46a8e0b16 Restore iml files for jps tests 2017-11-30 13:24:08 +03:00
Nikolay Krasko
cfa70dbe26 Don't ignore iml files in testData 2017-11-30 13:24:07 +03:00
Nikolay Krasko
170b352185 Deprecate 'configureAs' method and stop using it in js decompiled tests
This commit fixes tests in 173 branch, avoid exception:

com.intellij.openapi.util.TraceableDisposable$DisposalException:
Virtual pointer 'jar:///mnt/agent/work/bd0f559856a14a82/dist/kotlinc/lib/kotlin-stdlib-js.jar!/'
hasn't been disposed: --------------Creation trace:
java.lang.Throwable
    at com.intellij.openapi.util.TraceableDisposable.<init>(TraceableDisposable.java:45)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerImpl.<init>(VirtualFilePointerImpl.java:41)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.getOrCreate(VirtualFilePointerManagerImpl.java:266)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:205)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:136)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.create(VirtualFilePointerContainerImpl.java:359)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.add(VirtualFilePointerContainerImpl.java:169)
    at com.intellij.openapi.roots.impl.libraries.LibraryImpl.addRoot(LibraryImpl.java:505)
    at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.exportRoots(NewLibraryEditor.java:247)
    at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.applyTo(NewLibraryEditor.java:218)
    at org.jetbrains.kotlin.idea.test.ConfigLibraryUtil.addLibrary(ConfigLibraryUtil.kt:113)
    at org.jetbrains.kotlin.idea.test.KotlinStdJSProjectDescriptor.configureModule(KotlinStdJSProjectDescriptor.kt:38)
    at org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor.configureModule(KotlinLightProjectDescriptor.java:46)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt:59)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt)
    at com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel(ModuleRootModificationUtil.java:143)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:50)
    at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:69)
    at org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractDecompiledTextFromJsMetadataTest.setUp(AbstractDecompiledTextFromJsMetadataTest.kt:38)
    ...
2017-11-30 13:24:07 +03:00
Nikolay Krasko
a45fa9a33f Configure JdkAndMockLibrary with JS stdlib if jsLib flag is set 2017-11-30 13:24:06 +03:00
Nikolay Krasko
1bc8ad7852 Don't mess up with configuring project descriptors in PullPush tests
This commit fixes tests in 173 branch.
2017-11-30 13:24:05 +03:00
Alexey Sedunov
6a9317fc57 Misc: Drop utilities for checking nullability/mutability annotations
Types annotated by them are already loaded as inflexible
2017-11-30 12:49:25 +03:00
Alexey Sedunov
84c6f9bf45 Create from Usage: Fix choosing superclass for abstract member
This applies to cases when non-existing member is called without
explicit receiver

 #KT-21332 Fixed
2017-11-30 12:49:25 +03:00
Alexey Sedunov
7e3ca4734d Create from Usage: Add val to data class parameter
Also place new parameters on the new line if previous ones have line breaks

 #KT-21162 Fixed
2017-11-30 12:49:25 +03:00
Alexey Sedunov
c54b934383 Configuration: Fix deserialization of immutable freeArgs collection
#KT-21363 Fixed
2017-11-30 12:49:24 +03:00
Alexey Sedunov
998c312ad2 Unifier: Fix matching of callable references with expression receivers
#KT-21334 Fixed
2017-11-30 12:49:24 +03:00
Alexey Sedunov
354a6cbfd9 Change Signature: Keep parameter 'val'/'var' when invoked from Java
#KT-20901 Fixed
 #KT-21159 Fixed
2017-11-30 12:49:24 +03:00
Alexey Sedunov
820ade41ed Create from Usage: Do not add bodies to expect class members
#KT-21122 Fixed
2017-11-30 12:49:24 +03:00
Alexey Andreev
063b4b6c18 Remove unused 'json-org' dependency (fix build) 2017-11-30 11:43:44 +03:00
Alexey Andreev
1d48442a5d Change default output dir in JS DCE Gradle plugin
See KT-21328

Compiler removes all files from its output directory.
Due to this reason (and some other reasons) it't not a good idea
to put DCE output to `classes` dir.
Therefore we changed output dir to `$buildDir/kotlin-js-min`.
Additionally, we now allow to customize output dir.
In particular, this fixes issues with webpack in multi-project build +
continuous Gradle build.
2017-11-29 20:08:30 +03:00
Alexey Andreev
5672e1f56e JS: add DCE devmode. Fix mapping paths in source maps
See KT-20210, KT-21307
2017-11-29 20:08:30 +03:00
Alexey Andreev
ffdebfab45 JS: change the way how DCE resolves input paths 2017-11-29 20:08:29 +03:00
Alexey Andreev
8514a7706f Remove json.org library, use own JSON parser to parse source maps 2017-11-29 20:08:29 +03:00
Alexey Andreev
729715ec62 Add simple JSON parser 2017-11-29 19:43:28 +03:00
Ilya Gorbunov
c6b957f457 Force LF line delimiters for bash scripts and CRLF for .bat scripts in compiler/cli 2017-11-29 19:03:28 +03:00
Alexander Udalov
4f70983735 Update Proguard to 5.3.3 2017-11-29 11:58:38 +01:00
Alexander Udalov
d4b5032810 Add JDK roots to the beginning of the roots list
This behavior was used until 6a1b6d10d8, where the JDK has
unintentionally started to be added to the end of the list, breaking
code which depended on libraries which bundle something from the JDK

 #KT-21299 Fixed
2017-11-29 11:49:48 +01:00
Dmitry Petrov
d976eeabf7 Refactor GenerationState creation 2017-11-29 12:17:06 +03:00
Alexey Sedunov
d6d6cef10d Gradle: Use copyable user data to retain intermediate model
#KT-21418 Fixed
2017-11-29 12:00:25 +03:00
Alexey Sedunov
c8d9f9ac50 Refactoring: Rename copyable property delegates for PsiElement 2017-11-29 12:00:25 +03:00
Alexey Sedunov
b956363d6f Minor: Drop unused class 2017-11-29 12:00:25 +03:00
Alexey Andreev
19438a3a07 JS: fix losing lambda in inline function after incremental compilation
See KT-21493

It's hard to maintain staticRef in cached AST. In fact, we don't need
it in this optimization. We'll get excessive names in used set,
which is ok: non-function names don't matter, they'll be simply ignored.
One possible concern: there's more chance to get name same to
some function's name and it won't be removed. First, it's not fatal,
it won't break the code (but put some excessive code that will likely
be removed by DCE). Second, there's same chance of two functions
having same names, and we manage to avoid this (otherwise we'll get
many problems).
2017-11-29 11:53:35 +03:00
Alexey Andreev
29b494cdac JS: don't optimize when over external enum
See KT-21468
2017-11-29 11:52:36 +03:00
Dmitry Petrov
5b8c0d4c3e Optimize for-in-string loops
For-in-string loop can be generated using specialized 'length' and
'charAt' method calls, and with cached string length.
Note that update of the string variable in loop body doesn't affect
loop execution semantics.

 #KT-21322 Fixed Target versions 1.2.20
2017-11-29 10:15:38 +03:00
Dmitry Petrov
e2fa613b70 Cache array length in for-in-array loop if possible
If the range expression is not a local variable (which can be updated in
the loop body affecting loop behavior, see KT-21354), we can cache the
array length, thus turning a for-in-array loop into a simple optimizable
counter loop.

 #KT-21321 In Progress
2017-11-29 10:15:32 +03:00
Mikhail Zarechenskiy
328c67b9e8 Add separate diagnostic renderer results for tests with NI 2017-11-29 02:54:30 +03:00
Mikhail Zarechenskiy
8757298994 Add diagnostics to test data from NI 2017-11-29 02:54:26 +03:00
Mikhail Zarechenskiy
a71238bf94 Place !WITH_NEW_INFERENCE directive to diagnostics test data 2017-11-29 02:53:49 +03:00
Mikhail Zarechenskiy
81b3fefa58 Improve test framework for diagnostic tests with NI
Mark with `NI;` or `OI;` only diagnostics that are specific for concrete inference
2017-11-29 02:49:31 +03:00
Ilya Gorbunov
bd4d847943 Fix unresolved references in the api docs
These were mostly incorrect parameter names and external api links.
2017-11-28 18:41:17 +03:00
Ilya Gorbunov
3f26fd3f7f Provide summary for kotlin.math package 2017-11-28 18:41:15 +03:00
Ilya Gorbunov
5e85f71e48 Improve cover documentation page of kotlin.test library 2017-11-28 18:41:12 +03:00
Ilya Gorbunov
cf076f3d25 Unify docs wording of 'trim*' functions 2017-11-28 17:59:05 +03:00
Ilya Gorbunov
4f76cdfc34 Use new annotations in mutability tests instead of old ones 2017-11-28 17:45:10 +03:00
Ilya Gorbunov
9995a31c46 Add ReadOnly and Mutable into kotlin.annotations.jvm
Originally provided in org.jetbrains.annotations package as a part of stdlib.
2017-11-28 17:45:10 +03:00
Alexander Udalov
f80c9a4692 Drop TypeMappingConfiguration.innerClassNameFactory, use default implementation
After 57d209f599, non-default behavior is no longer used.

 #KT-21453 Fixed
2017-11-28 14:15:03 +01:00
Alexander Udalov
79e399942d Use "sourcesJar" task builder for kotlin-reflect sources 2017-11-28 12:46:10 +01:00
Alexander Udalov
9f3577dc70 Minor, use firstFromJavaHomeThatExists for JDK for Proguard
Similarly to "proguard" task in prepare/compiler/build.gradle.kts
2017-11-28 12:45:57 +01:00
Alexander Udalov
3d3ece72d2 Do not add task dependency from "sourcesJar" on "classes"
There doesn't seem to be any problem with collecting sources of the
project separately from compiling the project
2017-11-28 12:45:56 +01:00
Alexander Udalov
200c62b574 Use JvmPackageTable from bootstrap compiler in KotlinModuleShadowTransformer
Instead of generating another copy of it into buildSrc. Also move
KotlinModuleShadowTransformer to kotlin-reflect's build script, to its
only usage
2017-11-28 12:45:56 +01:00
Alexander Udalov
a1f895bb1f Rewrite kotlin-reflect build script from Groovy to Kotlin 2017-11-28 12:45:53 +01:00
Alexander Udalov
885ddc49a2 Move libraries/reflect/{build.gradle -> build.gradle.kts}
To preserve Git history after conversion to Kotlin in the next commit
2017-11-28 12:35:50 +01:00
Alexander Udalov
aca74cef0e Replace dependencies on kotlin-reflect with kotlin-reflect-api
See the previous commit for information on the kotlin-reflect vs
kotlin-reflect-api distinction.

Add kotlin-reflect as an explicit runtime dependency of most of the test
configurations because even though they all depend on tests-common, the
runtime dependency on kotlin-reflect is not exported from tests-common
to other modules because the projectTests dependency is not transitive.
2017-11-28 12:35:49 +01:00
Alexander Udalov
329fbd8fa8 Extract kotlin-reflect-api module out of kotlin-reflect
This is needed only for faster compilation of the Kotlin project itself
and has no effect on the public artifact
org.jetbrains.kotlin:kotlin-reflect.

The problem this is solving is the rebuild of the project once anything
has been changed in modules in 'core' (even inside function bodies, i.e.
a non-API change). Previously, changes in 'core' led to the compilation
of kotlin-reflect, which led to the rebuild of all modules depending on
kotlin-reflect directly or indirectly (which is almost all modules in
the project) because kotlin-reflect's artifacts are custom-built and the
changes can not be picked up incrementally. But 99.9% of the time the
initial changes in 'core' could not have any effect on the usages of
kotlin-reflect, because classes from those modules are moved to an
internal package in kotlin-reflect and thus are an internal
implementation detail.

Now, changes in 'core' still lead to the compilation of kotlin-reflect
and to the process of building the custom jar. But if a module depends
on kotlin-reflect-api, not kotlin-reflect, then the incremental
difference checker will detect that the module does not have to be
recompiled if there hasn't been any changes to the API of
kotlin-reflect-api. Which means that the module will not be rebuilt on
every change in 'core'.

This commit only introduces the new module. The dependencies
(kotlin-reflect -> kotlin-reflect-api) are replaced in the next commit.
2017-11-28 12:35:48 +01:00
Alexander Udalov
3e8b39af90 Move kotlin-reflect Gradle project to libraries/reflect/ 2017-11-28 12:33:21 +01:00
Toshiaki Kameyama
7448042b68 Fix callable code factory (parameter with default value case)
Before we can have end of '<Type>' and '=' joined as '>=' breaking PSI
So #KT-15941 Fixed
2017-11-28 14:11:04 +03:00
Mikhael Bogdanov
21bd10da2e Move generator utils 2017-11-28 11:04:40 +01:00
Mikhael Bogdanov
f529069077 Move common test parts to tests-common. Minify test jar dependencies 2017-11-28 11:04:39 +01:00
Alexey Sedunov
acbf53c42e Move: Make applicable to type aliases
#KT-21071 Fixed
2017-11-27 21:19:23 +03:00
Alexey Sedunov
bcdb46653c Line Markers: Detect recursive calls of companion invoke() member
#KT-21076 Fixed
2017-11-27 21:19:23 +03:00
Alexey Sedunov
169a22226f Rename: Support inplace rename of class via primary constructor
#KT-20146 Fixed
 #KT-21371 Fixed
2017-11-27 21:19:22 +03:00
Alexey Sedunov
2792e0c412 Rename: Introduce dispatching handler
The goal is to filter out KotlinMemberInplaceHandler similar to how
RenameHandlerRegistry does with MemberInplaceHandler
2017-11-27 21:19:22 +03:00
Alexey Sedunov
56746380f7 Data Inflow: Support delegated assignments
#KT-19089 Fixed
2017-11-27 21:19:22 +03:00
Alexey Sedunov
9d482bbbb1 Data Inflow: Show composite assignments
#KT-19112 Fixed
2017-11-27 21:19:22 +03:00
Alexey Sedunov
a333eb917b Data Inflow: Show qualified assignments
#KT-19087 Fixed
2017-11-27 21:19:21 +03:00
Vyacheslav Gerasimov
c06f72b73f Remove invalid toast test case, worked previously due to uast bug 2017-11-27 20:20:40 +03:00
Vyacheslav Gerasimov
26dcd1c706 Add kapt3-idea to test runtime of idea-android 2017-11-27 20:20:40 +03:00
Alexander Udalov
386a3fb5ce Fix tests after f4f5359725 2017-11-27 16:03:38 +01:00
Dmitry Petrov
f586bd4a34 Generate proper visibility for companion object instance field in LV1.3+ 2017-11-27 17:15:16 +03:00
Dmitry Petrov
70d3e6592d Unwrap object member imported by name before determining receivers
Existing code for receiver generation accidentally worked in most cases
for object members imported by name. However, it generated strange
bytecode (such as
    GETFIELD AnObject.INSTANCE
    GETFIELD AnObject.INSTANCE
    POP
), and worked incorrectly for augmented assignments.

 #KT-21343 Fixed Target versions 1.2.20
2017-11-27 17:15:16 +03:00
Alexey Andreev
7bee2ceac7 JS: add boxing/unboxing to default accessors of non-simple properties
See KT-21421
2017-11-27 17:01:19 +03:00
Alexey Andreev
be4e2f96c2 JS: throw error from coroutine marker functions 2017-11-27 17:01:18 +03:00
Alexey Andreev
71b1591044 JS: replace suspend inline metadata after inlining
This fixes some issues on coroutine inlining, see tests
2017-11-27 17:01:18 +03:00
Alexey Andreev
f8e7861ce6 JS: add partial tail-call optimization for suspend functions 2017-11-27 17:01:17 +03:00
Alexey Andreev
7c621488ad Remove unnecessary CONTAINS_NON_TAIL_SUSPEND_CALLS slice 2017-11-27 17:01:17 +03:00
Alexey Andreev
26843509c7 JS: disable suspend function tail-call optimization based on FE data
Partially fixes KT-21026
2017-11-27 17:01:16 +03:00
Alexey Andreev
6ab87ad66a Fix failing JS tests 2017-11-27 17:01:15 +03:00
Toshiaki Kameyama
2dd66225f3 Take into account vararg modifier in "Add type" quick fix
So #KT-20894 Fixed
2017-11-27 16:44:42 +03:00
Toshiaki Kameyama
4d93c08bd0 Do not propose to make local lateinit var immutable #KT-21104 Fixed 2017-11-27 16:44:04 +03:00
Alexander Udalov
938fd1a57e Use ResolvedCall for callable reference in KCallableNameProperty intrinsic
Instead of manually inspecting the DOUBLE_COLON_LHS slice, which is a
bit more error-prone. Note that new tests were passing before this
change
2017-11-27 12:46:56 +01:00
Alexander Udalov
f4f5359725 Fix exception on inlining callable reference with implicit this in LHS
Use ResolvedCall to determine the receiver type in the JVM codegen,
instead of manually inspecting the PSI

 #KT-20821 Fixed
2017-11-27 12:46:55 +01:00
Alexey Sedunov
1ceb751061 Data Outflow: Allow for-loop variables
#KT-19018 Fixed
2017-11-27 14:36:09 +03:00
Alexey Sedunov
fc307da383 Data Outflow: Show all reference expressions as separate steps
#KT-19012 Fixed
 #KT-19017 Fixed
 #KT-19036 Fixed
 #KT-19039 Fixed
 #KT-19104 Fixed
 #KT-19106 Fixed
2017-11-27 14:36:09 +03:00
Alexey Sedunov
0fc1c793fe Kotlin Facet: Support compileKotlinCommon tasks in Gradle importer
#KT-21187 Fixed
2017-11-27 14:36:09 +03:00
Alexey Sedunov
3f66d11624 Kotlin Facet: Fix language/API version initialization
#KT-21180 Fixed
2017-11-27 14:36:09 +03:00
Dmitry Jemerov
200d7f0718 Send API version instead of build number for plugin update checks
#KT-21263 Fixed
2017-11-24 19:39:22 +01:00
Alexey Tsvetkov
a1939c093c Use isolated classloader for in-process compilation
#KT-20233 fixed
2017-11-24 16:17:13 +03:00
Alexey Tsvetkov
0077ab59d6 Remove custom cache version checks from Gradle
#KT-21009 fixed

Cache version could be changed only when compiler is changed.

@InputFiles on `AbstractKotlinCompileTool#computedCompilerClasspath`
ensures that non incremental build is performed when compiler is changed.
2017-11-24 16:17:13 +03:00
Nikolay Krasko
602ac3e816 Refactoring: GradleDependencyInspection -> DeprecatedGradleDependencyInspection 2017-11-24 14:29:03 +03:00
Nikolay Krasko
bfb069b0c5 Warning and quick fix for using jre-artifacts in Maven (KT-20947)
#KT-20947 In Progress
2017-11-24 14:29:03 +03:00
Nikolay Krasko
99f7d605a7 Refactoring: move deprecation information to common place 2017-11-24 14:29:02 +03:00
Nikolay Krasko
0f1e169bd7 Introduce a quick fix for deprecated jre artifact in gradle (KT-20947)
#KT-20947 In Progress
2017-11-24 14:29:02 +03:00
Nikolay Krasko
23afa07e55 Inspection for using deprecated jre artifacts in Gradle (KT-20947)
#KT-20947 In Progress
2017-11-24 14:29:02 +03:00
Nikolay Krasko
4281b5e1b0 Refactoring: extract utility methods to separate class 2017-11-24 14:29:02 +03:00
Nikolay Krasko
64bb40869e Compare testData files with KotlinTestUtils.assertEqualsToFile 2017-11-24 14:29:02 +03:00
Nikolay Krasko
30d8875bdf Check file is valid before search in ScriptDependenciesCache
Otherwise search will fail.
2017-11-24 14:29:02 +03:00
Dmitry Jemerov
7625130b49 SOE protection when enumerating dependencies of common modules
#KT-20937 Fixed
2017-11-23 18:04:28 +01:00
Alexey Tsvetkov
2b708f67ee Add tests for explicit language/api version change in Gradle
Modifying language/api version should cause non-incremental build.
Implicit change (e.g. when versions are not specified, but the compiler
is updated 1.1->1.2) is handled by `AbstractKotlinCompileTool#computedCompilerClasspath`.
Explicit change is handled by `AbstractKotlinCompile#serializedCompilerArguments`.
2017-11-23 14:46:23 +03:00
Alexey Tsvetkov
913a997f24 Rebuild when language/api version is changed (JPS)
#KT-20757 fixed
2017-11-23 14:46:23 +03:00
Alexey Tsvetkov
b1f0f87829 Fix default value for api version string in IC meta info file 2017-11-23 14:46:22 +03:00
Dmitry Savvinov
b8447d6d97 Add test on smartcasts with reified types
This test introduces very special (for current implementation) case,
when we have smartcast indirectly, via some reified type parameter.

It covers recursive call inSmartCastManager.checkAndRecordPossibleCast(),
which wasn't previously covered by any test in testbase.
2017-11-23 12:45:10 +03:00
Dmitry Savvinov
440b6d9934 Add -Xeffect-system CLI argument which enables Effect System 2017-11-23 12:35:51 +03:00
Leonid Startsev
44d232a83c Extension point for synthetic function names contributions 2017-11-23 12:21:47 +03:00
Leonid Startsev
d6e5551237 More entry points for compiler plugins
* In Kotlin/JS JPS compilation
* In kotlin-common CLI compiler
* In kotlin-common gradle build
2017-11-23 12:12:01 +03:00
Nicolay Mitropolsky
07601b2ec4 KtLightAnnotationForSourceEntry: varargs handling improved (KT-21335, EA-107118) 2017-11-23 10:37:24 +03:00
Nicolay Mitropolsky
23344783a5 KtLightAnnotationForSourceEntry: made more verbose with errors in arrays in params (KT-21335, EA-107118) 2017-11-23 10:37:24 +03:00
Alexander Udalov
e43bf90b9c Use CompilerDeserializationConfiguration in JS IC package fragment
This is more correct because it'll allow the incremental package
fragment to be deserialized with the same analysis flags as the changed
sources. Currently it doesn't seem possible to add a reasonable test for
this fix because there are no flags relevant for JS except for
skipMetadataVersionCheck, which is experimental and thus doesn't require
a test
2017-11-22 18:33:04 +01:00
Dmitry Jemerov
fd763bde17 Reorder imports to avoid merge conflict
(cherry picked from commit 4286cce)
2017-11-22 18:30:34 +01:00
Dmitry Jemerov
6586228c15 Logging to catch KT-20937 2017-11-22 16:42:01 +01:00
Mikhail Glukhikh
078c27efa3 Add fallback flag for legacy var smart casts after try #KT-21377 Fixed 2017-11-22 18:31:04 +03:00
Mikhail Glukhikh
8b6e63dc18 Add forgotten new inference to JS 2017-11-22 18:31:03 +03:00
Dmitry Jemerov
dfe5eb65f9 Don't pack any kotlin stdlib classes into kotlin-plugin.jar
#KT-21395 Fixed

(cherry picked from commit 3fbc5ab)
2017-11-22 14:44:01 +01:00
Dmitry Jemerov
e00cc5ab3d Don't crash with old versions of Android Gradle plugin
#KT-21383 Fixed
2017-11-22 14:14:26 +01:00
Simon Ogorodnik
236ba1d2f2 Refactor PerModulePackageCacheService to fix various problems
Original issue here - structure of VfsEvents,
when directory gets deleted, we receive only VFileDeleteEvent
for directory, but not it's content, so we should invalidate
all modules in which sources this directory located, and all
modules that located in such directory

Second problem - When VirtualFile was deleted it is impossible to
get ModuleInfo for it using getModuleInfoByVirtualFile

Third problem - stale references in cache, due cycle dependency

 #KT-20987 Fixed
2017-11-22 16:07:34 +03:00
Mikhail Zarechenskiy
bee7ed1431 [NI] Fix mapping of type arguments to parameters for inner classes 2017-11-22 10:22:41 +03:00
Mikhail Zarechenskiy
e526a87d54 [NI] Make model more robust: remove diagnostics from resolution atoms
Currently there are two major phases in NI that report diagnostics: resolution parts and completion. They connected in method `KotlinCallCompleter.runCompletion` and previously diagnostics were collected in several places, from resolution atoms, partly from constraint system and partly from `CallResolutionResult`, some of them were lost.

 To mitigate this problem, now diagnostics are not bind to the intermediate candidate, only to the result resolution candidate (overloaded or usual one). And all diagnostics are now collected in method `runCompletion`
2017-11-22 10:22:39 +03:00
Nikolay Krasko
6e51c4d5db Disable script dependency updater in AddRequireModuleTest 2017-11-21 18:55:42 +03:00
Nikolay Krasko
a530163074 Add sources for 'reflect' and 'test' libs during JPS config (KT-20956)
#KT-20956 Fixed
2017-11-21 18:55:42 +03:00
Alexey Andreev
ec8adfe7c4 JS: fix referencing outer class from secondary constructor
See KT-21041
2017-11-21 12:22:10 +03:00
Alexey Andreev
88441da131 JS: cache PropertyMetadata objects in property delegates
Also, remove unused PropertyMetadata instances

See KT-20737, KT-20738
2017-11-21 12:21:22 +03:00
Alexey Andreev
7ebfba3722 JS: apply boxing when initializing val parameter of type Char
See KT-20854
2017-11-21 12:20:01 +03:00
Alexey Andreev
32a0221474 JS: refactor code that copies default methods in interfaces to classes
Als fixes KT-21245
2017-11-21 12:18:16 +03:00
Alexey Andreev
38e50e964a JS: fix generation of source map for inline lambda with ignored result
See KT-21309
2017-11-21 12:15:25 +03:00
Nikolay Krasko
d2aabe076d Refactoring: extract jar names in PathUtil and use them in artifacts 2017-11-21 01:11:01 +03:00
Nikolay Krasko
3a90f3618a Don't force configure with kotlin-jdk artifacts for early versions (KT-21028)
#KT-21028 Fixed
2017-11-21 01:11:00 +03:00
Nikolay Krasko
679a460c44 Minor: make sdk version comparison compatible with JDK > 9 2017-11-21 01:10:59 +03:00
Ilya Chernikov
0e5c443894 Move kapt3 embeddable to prepare folder 2017-11-20 22:59:40 +01:00
Ilya Chernikov
6f73e9994b Add kotlin-annotation-processing-embeddable, publish base kapt3 as kotlion-annotation-processing
(cherry picked from commit 148d4e4)
2017-11-20 20:06:43 +01:00
Ilya Chernikov
56542286eb Bring back filtering of jna and shading of jline in embeddable compiler
they were lost during the migration to gradle

(cherry picked from commit 126a6a8)
2017-11-20 19:59:40 +01:00
Alexey Andreev
a9548b1224 JS: fix translation of safe calls to suspend unit functions
See KT-21317
2017-11-20 19:19:24 +03:00
Denis Zharkov
91730e1a9e Do not run search for operator-like names in inspections
It might be rather expensive to search componentN's usages in the whole project
2017-11-20 18:33:46 +03:00
Ilmir Usmanov
0fbbe10143 Support suspendCoroutineUninterceptedOrReturn intrinsic
KT-17336: Fixed
2017-11-20 18:12:41 +03:00
Mikhail Glukhikh
4c583c5a61 Catch InvalidModuleException from getModality() in icon provider
Related to KT-20986
2017-11-18 12:38:25 +03:00
Mikhail Glukhikh
dce7377099 Revert check on module descriptor validness in lookup
Related to KT-20986
2017-11-18 12:35:01 +03:00
Mikhail Glukhikh
e53cedbd6b Throw InvalidModuleException in assertValid() instead of standard ISE 2017-11-18 12:34:59 +03:00
Mikhail Glukhikh
539f8afef3 Style: do not highlight single return when as "Use expresison body" 2017-11-18 12:34:58 +03:00
Nikolay Krasko
c0a3344803 Download jflex from bintray 2017-11-17 17:21:59 +03:00
Mikhael Bogdanov
a547019ed0 Switch DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET according to LL 2017-11-17 13:48:44 +01:00
Alexander Udalov
d386712903 Report pre-release errors if release LV is used
#KT-21267 Fixed
2017-11-17 13:42:36 +01:00
Dmitry Jemerov
64a8008a8a Add icon for multiplatform projects, update JS icon
#KT-19824 Fixed
2017-11-17 13:13:04 +01:00
Mikhail Zarechenskiy
20e1caaab1 [NI] Use refined expected type by smartcasts in CS 2017-11-17 15:04:20 +03:00
Mikhail Zarechenskiy
ca035bc8b8 [NI] Report error from expected type constraint position 2017-11-17 15:04:18 +03:00
Igor Chevdar
d4d3f237ee Fix for package level lateinit properties 2017-11-17 13:48:17 +03:00
Alexey Andreev
89db4dfe79 JS: translate when against enum to JsSwitch when possible 2017-11-17 11:07:41 +03:00
Alexey Andreev
c54c4a6ce8 JS: fix support of JsSwitch in coroutines 2017-11-17 11:07:39 +03:00
Alexey Andreev
678b4c67c1 JS: translate when to JsSwitch when possible
See KT-21160
2017-11-17 11:07:38 +03:00
Alexey Andreev
7b403211dd JS: kotlinize WhenTranslator 2017-11-17 11:07:37 +03:00
Alexey Andreev
b93acb07d2 JS: don't remove debugger statement from coroutine
See KT-19826
2017-11-17 11:07:36 +03:00
Alexey Andreev
21de76f88d JS: fix identifier generation in delegate constructor calls
See KT-21093
2017-11-17 11:07:34 +03:00
Ilya Gorbunov
fdeb916111 Correct exclusions of kotlin-stdlib-js 2017-11-16 20:30:51 +03:00
Ilya Gorbunov
c10771092a Add maven subprojects to the project 2017-11-16 20:30:51 +03:00
Nikolay Krasko
17f0d3b9b3 Revert JetRunConfiguration for compatibility (KT-21296)
#KT-21296 Fixed
2017-11-16 20:14:38 +03:00
Mikhail Zarechenskiy
66064345e9 [NI] Support fallback resolution for refined sams priority feature 2017-11-16 18:07:54 +03:00
Mikhail Zarechenskiy
e42f07b031 [NI] Wait for proper constraints to fix type for callable reference
If expected type is a type variable, then we'll wait for proper constraints, but previously we resolved callable reference as it didn't have expected type at all, because type variable isn't a functional type

 Consider the following example:

 fun foo(i: Int) {}
 fun foo(s: String) {}
 fun <T> id(x: T): T = x

 fun test() {
     val x1: (Int) -> Unit = id(id(::foo))
 }

 Here we shouldn't resolve callable reference until we get constraint from expected type of `x1`
2017-11-16 18:07:51 +03:00
Mikhael Bogdanov
cbfcb74b58 Get rid of cli dependencies from ir 2017-11-16 14:46:53 +01:00
Zalim Bashorov
28e34ac39b Minor: fix IDEA warnings in BasicBoxTest.kt 2017-11-16 15:42:08 +03:00
Zalim Bashorov
291e903ae6 Mark js/js/translator/testData/out-min/ as excluded directory in IDEA
It's required to avoid indexing a lot of js files (> 200MB)
after each run of js tests.
2017-11-16 15:41:45 +03:00
Zalim Bashorov
4849bddde1 KJS: write minification's test results to separate directory
It allows excluding this directory from indexing inside IDEA
and probably simplifies the main workflow.
2017-11-16 15:36:20 +03:00
Alexey Tsvetkov
18261838b6 Avoid deserializing .kotlin_module as class proto
#KT-20184 fixed
2017-11-16 14:47:59 +03:00
Alexander Udalov
c55ac55526 Restore and deprecate JvmFileClassesProvider.getFileClassInternalName
#KT-21270 Fixed
2017-11-16 11:24:11 +01:00
Dmitry Petrov
4193fae9fa Fix floating point comparison generation for range literals 2017-11-16 10:54:25 +03:00
Dmitry Petrov
354d54aef6 Don't generate DUPX instructions for in-range-literal expressions
Store argument into a local variable instead.
2017-11-16 10:54:25 +03:00
Vladimir Kasatkin
9b49e9139c Added samples for map filtering operators (KT-20357)
Fix map transformations sample names.
2017-11-15 23:58:51 +03:00
Ilya Gorbunov
dca23e339a Improve iterator samples, add explanatory comments (KT-20357) 2017-11-15 23:58:49 +03:00
kenji tomita
4d13ea89b2 Add samples for iterator-related extensions (KT-20357) 2017-11-15 23:39:07 +03:00
Ilya Gorbunov
94f77c773c Remove unused function, simplify outdated runtime version tests 2017-11-15 17:53:18 +03:00
Ilya Gorbunov
18611343f2 Do not infer artifact version from build.txt #KT-21150 2017-11-15 17:53:18 +03:00
Ilya Gorbunov
9de6dd814b Docs: clarifications on LazyThreadSafetyMode 2017-11-15 17:41:43 +03:00
Nikolay Krasko
0768e7404b Stop overwriting values with defaults in compiler arguments
'verbose' option was always lost.
2017-11-15 16:12:41 +03:00
Nikolay Krasko
0480042ffd Log incremental options before passing them to kotlin daemon 2017-11-15 16:12:40 +03:00
Nikolay Krasko
643f771c24 Report rebuild reason in rebuild function 2017-11-15 16:12:38 +03:00
Nikolay Krasko
97c1e58149 Minor: reformat too long lines 2017-11-15 16:12:37 +03:00
Tudor Luca
129c0e4c9c Updates ReadMe.md to name the Sublime Text Package
Changes the link name for the Sublime Text Package from "TextMate" to Sublime Text
2017-05-18 13:11:57 +03:00
18150 changed files with 1157703 additions and 364571 deletions

6
.bunch Normal file
View File

@@ -0,0 +1,6 @@
181
173
172_173
as31_173
as32
182

3
.gitattributes vendored
View File

@@ -1 +1,4 @@
**/testData/** linguist-vendored
*Generated.java linguist-generated=true
compiler/cli/bin/* eol=lf
compiler/cli/bin/*.bat eol=crlf

14
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,14 @@
Many thanks for your contribution, we genuinely appreciate it.
Make sure that you can say "YES" to each point in this short checklist:
- You do not have merge commits in PR
- You made a few changes
- You provided the link to related issue from YouTrack
- You can describe changes made in PR
- You made changes related to only one issue
- You are ready to defend your changes on code review
- You didn't touch what you don't understand
- You ran the build locally, and verified new functionality
- You ran related tests locally, and it passed
Thank you for your contribution!

12
.gitignore vendored
View File

@@ -4,6 +4,7 @@
/confluence/target
/dependencies
/dist
/local
/gh-pages
/ideaSDK
/clionSDK
@@ -18,15 +19,20 @@ workspace.xml
/ultimate/ideaSDK
/ultimate/out
/ultimate/tmp
/js/js.translator/testData/**/out/
/js/js.translator/testData/out/
/js/js.translator/testData/out-min/
.gradle/
build/
!**/src/**/build
*.iml
!**/test/**/build
.idea/modules.xml
*.iml
!**/testData/**/*.iml
.idea/libraries/Gradle*.xml
.idea/libraries/Maven*.xml
.idea/artifacts
.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/libraries
.idea/modules.xml
.idea/gradle.xml
.idea/compiler.xml

15
.idea/ant.xml generated
View File

@@ -1,23 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/compiler/frontend/buildLexer.xml" />
<buildFile url="file://$PROJECT_DIR$/build.xml">
<antCommandLine value="-J-ea" />
<maximumHeapSize value="1024" />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/update_dependencies.xml" />
<buildFile url="file://$PROJECT_DIR$/TeamCityBuild.xml">
<maximumHeapSize value="512" />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/idea-runner/runner.xml" />
<buildFile url="file://$PROJECT_DIR$/libraries/build-docs.xml">
<maximumHeapSize value="1024" />
<properties>
<property name="dokka.path" value="../../dokka" />
</properties>
</buildFile>
<buildFile url="file://$PROJECT_DIR$/TeamCityRelay.xml" />
<buildFile url="file://$PROJECT_DIR$/node_utils.xml" />
</component>
</project>

View File

@@ -55,6 +55,9 @@
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
@@ -207,6 +210,13 @@
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="PROTO">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Scala">
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
@@ -228,7 +238,6 @@
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
@@ -261,12 +270,8 @@
</indentOptions>
</codeStyleSettings>
<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" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@@ -1,9 +1,7 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright 2010-&amp;#36;today.year JetBrains s.r.o.&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10;http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="JetBrains" />
<option name="allowReplaceRegexp" value="JetBrains" />
<option name="notice" value="Copyright 2010-&amp;#36;today.year JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license &#10;that can be found in the license/LICENSE.txt file." />
<option name="myName" value="apache" />
<option name="myLocal" value="true" />
</copyright>
</component>

View File

@@ -1,7 +1,7 @@
<component name="CopyrightManager">
<settings default="">
<settings>
<module2copyright>
<element module="all except testData" copyright="apache" />
<element module="Apply copyright" copyright="apache" />
</module2copyright>
<LanguageOptions name="Groovy">
<option name="fileTypeOverride" value="1" />

View File

@@ -1,6 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="4u7">
<words>
<w>cidr</w>
<w>foldable</w>
</words>
</dictionary>

View File

@@ -2,6 +2,7 @@
<dictionary name="Nikolay.Krasko">
<words>
<w>accessors</w>
<w>coroutines</w>
<w>crossinline</w>
<w>fqname</w>
<w>goto</w>
@@ -12,6 +13,7 @@
<w>memoize</w>
<w>memoized</w>
<w>multiline</w>
<w>navigatable</w>
<w>preload</w>
<w>preloader</w>
<w>preloading</w>

View File

@@ -2,9 +2,14 @@
<dictionary name="bashor">
<words>
<w>ctor</w>
<w>inlining</w>
<w>interner</w>
<w>intrinsicify</w>
<w>kclass</w>
<w>lookups</w>
<w>minification</w>
<w>minifier</w>
<w>minify</w>
<w>unescape</w>
</words>
</dictionary>

View File

@@ -3,6 +3,8 @@
<words>
<w>checkcast</w>
<w>coroutine</w>
<w>experimentalities</w>
<w>experimentality</w>
<w>insn</w>
<w>liveness</w>
</words>

View File

@@ -5,6 +5,7 @@
<w>impls</w>
<w>kapt</w>
<w>parceler</w>
<w>repl</w>
<w>uast</w>
</words>
</dictionary>

17
.idea/encodings.xml generated
View File

@@ -1,6 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="file://$PROJECT_DIR$/libraries" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/browser-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/browser-example-with-library" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/js-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/kotlin-java-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/kotlin-js-library-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/idl2k" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-annotation-processing-maven" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-allopen" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-noarg" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-plugin" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-plugin-test" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-sam-with-receiver" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-osgi-bundle" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes/kotlin-archetype-js" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes/kotlin-archetype-jvm" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@@ -56,7 +56,7 @@
<option name="ignoreOnVolatileVariables" value="true" />
</inspection_tool>
<inspection_tool class="DuplicateCondition" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreMethodCalls" value="false" />
<option name="ignoreSideEffectConditions" value="true" />
</inspection_tool>
<inspection_tool class="EmptyStatementBody" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_reportEmptyBlocks" value="false" />
@@ -98,6 +98,27 @@
<option name="insideTryAllowed" value="false" />
</inspection_tool>
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="IncompatibleAPI" enabled="true" level="ERROR" enabled_by_default="true">
<option name="problems">
<list>
<Problem reference="org.jetbrains.plugins.gradle.util.GradleConstants#KOTLIN_DSL_SCRIPT_EXTENSION" reason="Absent in 172. Please inline." />
<Problem reference="com.intellij.psi.impl.compiled.ClsClassImpl#getQualifiedName" reason="Nullable in 173, platform in 172. Use qualifiedNameEx instead." />
<Problem reference="com.intellij.internal.statistic.utils.StatisticsUtilKt#getEnumUsage" reason="Absent in 172. Use org.jetbrains.kotlin.idea.util.compat.statistic.StatisticKt.getEnumUsage instead." />
<Problem reference="com.intellij.internal.statistic.utils.StatisticsUtilKt#getBooleanUsage" reason="Absent in 172 Use org.jetbrains.kotlin.idea.util.compat.statistic.StatisticKt.getBooleanUsage instead." />
<Problem reference="com.intellij.internal.statistic.AbstractProjectsUsagesCollector" reason="Absent in 172. Use org.jetbrains.kotlin.idea.util.compat.statistic.AbstractProjectsUsagesCollector instead." />
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Not null starting from 181. Use getProgressIndicatorNullable instead." />
<Problem reference="com.intellij.testFramework.PlatformTestCase#createModuleAt" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.testFramework.PlatformTestCase#doCreateRealModuleIn" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Nullable in 181. Temporary use progressIndicatorNullable instead." />
<Problem reference="com.intellij.testFramework.fixtures.CodeInsightTestFixture#getProjectDisposable" reason="Method was introduced in 173 and absent in 172. Use getProjectDisposableEx instead. (95eaf81e0ea497f8c69263c11fd3202d28a7a1b2)" />
<Problem reference="org.jetbrains.org.objectweb.asm.Opcodes#V9" reason="Absent in 172 branch. Use V1_9 while 172 is supported." />
<Problem reference="com.intellij.psi.codeStyle.CommonCodeStyleSettings#getSoftMargins" reason="Absent in 172." />
<Problem reference="com.intellij.util.xmlb.XmlSerializer#serializeInto(java.lang.Object, org.jdom.Element)" reason="Absent in 172." />
<Problem reference="org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler#addSpace" reason="Method was replaced with outher methods in 182. Use addSpaceEx instead." />
<Problem reference="com.intellij.psi.util.PsiUtil#canBeOverridden" reason="Absent in 172. Use org.jetbrains.kotlin.idea.core.util.compat.psi.canBeOverridden() instead." />
</list>
</option>
</inspection_tool>
<inspection_tool class="InnerClassMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="InstanceofCatchParameter" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="InstanceofIncompatibleInterface" enabled="true" level="WARNING" enabled_by_default="true" />
@@ -275,12 +296,23 @@
<inspection_tool class="PackageDirectoryMismatch" enabled="true" level="WARNING" enabled_by_default="false">
<scope name="all except testData" level="WARNING" enabled="true" />
</inspection_tool>
<inspection_tool class="ProblematicAPIUsage" enabled="true" level="ERROR" enabled_by_default="true">
<option name="problems">
<list>
<Problem reference="com.intellij.testFramework.PlatformTestCase#createModuleAt" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.testFramework.PlatformTestCase#doCreateRealModuleIn" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Nullable in 181. Temporary use progressIndicatorNullable instead." />
<Problem reference="com.intellij.testFramework.fixtures.CodeInsightTestFixture#getProjectDisposable" reason="Method was introduced in 173 and absent in 172. Use getProjectDisposableEx instead. (95eaf81e0ea497f8c69263c11fd3202d28a7a1b2)" />
</list>
</option>
</inspection_tool>
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="ERROR" enabled_by_default="true">
<option name="fromVersion" value="2.4" />
<option name="toVersion" value="3.1" />
</inspection_tool>
<inspection_tool class="Reformat" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreLazyOperators" value="true" />
<option name="ignoreObscureOperators" value="true" />
@@ -402,8 +434,10 @@
<inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="IDEA Test Sources" level="WARNING" enabled="false">
<option name="m_ignoreJavadoc" value="true" />
<option name="ignoreInModuleStatements" value="true" />
</scope>
<option name="m_ignoreJavadoc" value="true" />
<option name="ignoreInModuleStatements" value="true" />
</inspection_tool>
<inspection_tool class="UnnecessaryLabelOnBreakStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" />

2
.idea/kotlinc.xml generated
View File

@@ -13,6 +13,6 @@
</option>
</component>
<component name="KotlinCompilerSettings">
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check" />
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check -Xread-deserialized-contracts" />
</component>
</project>

36
.idea/misc.xml generated
View File

@@ -40,11 +40,42 @@
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/confluence-highlighting/pom.xml" />
<option value="$PROJECT_DIR$/confluence/pom.xml" />
<option value="$PROJECT_DIR$/libraries/pom.xml" />
</list>
</option>
</component>
<component name="NullableNotNullManager">
<option name="myNullables">
<value>
<list size="9">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="9">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="javax.validation.constraints.NotNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
</list>
</value>
</option>
</component>
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
@@ -54,6 +85,7 @@
<component name="SuppressABINotification">
<option name="modulesWithSuppressedNotConfigured">
<set>
<option value="backend.src" />
<option value="kotlin-stdlib-common" />
<option value="kotlin-stdlib-js" />
<option value="kotlin-test-common" />

View File

@@ -4,7 +4,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-x :ultimate:generateTests" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>

View File

@@ -4,7 +4,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="scriptParameters" value="-P intellijUltimateEnabled" />
<option name="taskDescriptions">
<list />
</option>

View File

@@ -10,9 +10,6 @@
</option>
<option name="taskNames">
<list>
<option value=":kotlin-runtime:clean" />
<option value=":kotlin-stdlib:clean" />
<option value=":kotlin-reflect:clean" />
<option value=":tools:binary-compatibility-validator:cleanTest" />
<option value=":tools:binary-compatibility-validator:test" />
</list>

3
.idea/scopes/Apply_copyright.xml generated Normal file
View File

@@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle" />
</component>

4
.idea/vcs.xml generated
View File

@@ -15,6 +15,10 @@
<option name="issueRegexp" value="KEEP\-(\d+)" />
<option name="linkRegexp" value="https://github.com/Kotlin/KEEP/issues/$1" />
</IssueNavigationLink>
<IssueNavigationLink>
<option name="issueRegexp" value="KOTLIN-CR\-\d+" />
<option name="linkRegexp" value="https://upsource.jetbrains.com/kotlin/review/$0" />
</IssueNavigationLink>
</list>
</option>
</component>

File diff suppressed because it is too large Load Diff

View File

@@ -23,22 +23,22 @@ Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
* [Kotlin Eclipse Plugin](https://kotlinlang.org/docs/tutorials/getting-started-eclipse.html)
* [Kotlin TextMate Bundle](https://github.com/vkostyukov/kotlin-sublime-package)
* [Kotlin Sublime Text Package](https://github.com/vkostyukov/kotlin-sublime-package)
## Build environment requirements
In order to build Kotlin distribution you need to have:
- Apache Ant 1.9.4 and higher
- JDK 1.6, 1.7 and 1.8
- JDK 1.6, 1.7, 1.8 and 9
- Setup environment variables as following:
JAVA_HOME="path to JDK 1.8"
JDK_16="path to JDK 1.6"
JDK_17="path to JDK 1.7"
JDK_18="path to JDK 1.8"
JDK_9="path to JDK 9"
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 8 installed, and to point all of the environment variables mentioned above to your JDK 8 installation.
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 1.8 and JDK 9 installed, and to point JDK_16 and JDK_17 environment variables to your JDK 1.8 installation.
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties) to setup JDK_* variables.
@@ -46,24 +46,25 @@ You also can use [Gradle properties](https://docs.gradle.org/current/userguide/b
## Building
To build this project, first time you try to build you need to run this:
The project is built with Gradle. Run Gradle to build the project and to run the tests
using the following command on Unix/macOS:
ant -f update_dependencies.xml
./gradlew <tasks-and-options>
or the following command on Windows:
which will setup the dependencies on
gradlew <tasks-and-options>
On the first project configuration gradle will download and setup the dependencies on
* `intellij-core` is a part of command line compiler and contains only necessary APIs.
* `idea-full` is a full blown IntelliJ IDEA Community Edition to be used in the plugin module.
Then, you may run Gradle to build the project and run tests, using:
./gradlew <tasks-and-options>
These dependencies are quite large, so depending on the quality of your internet connection
you might face timeouts getting them. In this case you can increase timeout by specifying the following
command line parameters on the first run:
command on Unix/macOS, or
gradlew <tasks-and-options>
on Windows.
./gradlew -Dhttp.socketTimeout=60000 -Dhttp.connectionTimeout=60000
## Important gradle tasks
@@ -77,24 +78,39 @@ on Windows.
- `compilerTest` - build and run all compiler tests
- `ideaPluginTest` - build and run all IDEA plugin tests
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately by Maven: go into `libraries` directory after building the compiler and run:
mvn install
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
## Working with the project in IntelliJ IDEA
Working with the Kotlin project requires IntelliJ IDEA 2017.3. You can download an Early Access Preview version of IntelliJ IDEA 2017.3 [here](https://www.jetbrains.com/idea/nextversion/).
### Building for different versions of IntelliJ IDEA and Android Studio
Kotlin plugin is indented to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting non-default platform.
More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
Usually, there's no need to care about multiple platforms as all features are enabled everywhere by default. Additional counterparts should be created if there's an expected difference in behavior or an incompatible API usage is required **and** there's no reasonable workaround to save source compatibility. Kotlin plugin contains a pre-commit check that shows a warning if a file has been updated without its counterparts.
Development for some particular platform is possible after 'switching' that can be done with [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
```sh
cd kotlin-project-dir
# switching to IntelliJ Idea 2018.2
bunch switch . 182
```
## <a name="working-in-idea"></a> Working with the project in IntelliJ IDEA
Working with the Kotlin project requires IntelliJ IDEA 2017.3. You can download IntelliJ IDEA 2017.3 [here](https://www.jetbrains.com/idea/download).
To import the project in Intellij choose project directory in Open project dialog. Then, after project opened, Select
`File` -> `New...` -> `Module from Existing Sources` in the menu, and select `build.gradle.kts` file in the project's root folder.
In the import dialog, select `use default gradle wrapper`.
To be able to run tests from IntelliJ easily, check `Delegate IDE build/run actions to Gradle` in the Gradle runner settings.
To be able to run tests from IntelliJ easily, check `Delegate IDE build/run actions to Gradle` and choose `Gradle Test Runner` in the Gradle runner settings.
At this time, you can use the latest released 1.1.x version of the Kotlin plugin for working with the code. To make sure you have the latest version installed, use Tools | Kotlin | Configure Kotlin Plugin Updates and press "Check for updates now".
At this time, you can use the latest released 1.2.x version of the Kotlin plugin for working with the code. To make sure you have the latest version installed, use Tools | Kotlin | Configure Kotlin Plugin Updates and press "Check for updates now".
### Compiling and running
@@ -104,6 +120,18 @@ From this root project there are Run/Debug Configurations for running IDEA or th
* Run the "IDEA" run configuration in the project
* a child IntelliJ IDEA with the Kotlin plugin will then startup
### Including into composite build
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle`
```
includeBuild('/path/to/kotlin') {
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
}
}
```
# Contributing
We love contributions! There's [lots to do on Kotlin](https://youtrack.jetbrains.com/issues/KT) and on the
@@ -125,7 +153,7 @@ macro to include code from a test function. The benefits of this approach are tw
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.
Some of the code in the standard library is created by generating code from templates. See the [README](libraries/stdlib/ReadMe.md) in the stdlib section for how run the code generator. The existing templates can be used as examples for creating new ones.
Some of the code in the standard library is created by generating code from templates. See the [README](libraries/stdlib/ReadMe.md) in the stdlib section for how to run the code generator. The existing templates can be used as examples for creating new ones.
## Submitting patches

View File

@@ -1,189 +0,0 @@
<project name="Kotlin CI Steps" default="none">
<import file="build.xml" optional="false"/>
<property name="build.number" value="snapshot"/>
<property name="fail.on.plugin.verifier.error" value="true"/>
<property name="version_substitute_dir" value="${basedir}/versions_temp/"/>
<property name="artifact.output.path" value="${basedir}/dist/artifacts"/>
<property name="plugin.xml" value="idea/src/META-INF/plugin.xml"/>
<property name="plugin.xml.bk" value="${version_substitute_dir}/plugin.xml.bk"/>
<property name="plugin.xml.versioned" value="${plugin.xml}.versioned"/>
<property name="plugin.xml.version.number" value="${build.number}"/>
<property name="compiler.version.java" value="core/util.runtime/src/org/jetbrains/kotlin/config/KotlinCompilerVersion.java"/>
<property name="compiler.version.java.bk" value="${version_substitute_dir}/KotlinCompilerVersion.java.bk"/>
<property name="compiler.version.java.versioned" value="${compiler.version.java}.versioned"/>
<property name="compiler.version.number" value="${build.number}"/>
<property name="compiler.ant.fork.jvmargs" value="-Xmx1024m"/>
<property name="plugin.zip" value="${artifact.output.path}/kotlin-plugin-${build.number}.zip"/>
<property name="pluginArtifactDir" value="Kotlin" />
<macrodef name="echoprop">
<attribute name="prop"/>
<sequential>
<echo>@{prop}=${@{prop}}</echo>
</sequential>
</macrodef>
<echoprop prop="os.name"/>
<echoprop prop="os.version"/>
<echoprop prop="os.arch"/>
<echoprop prop="java.home"/>
<echoprop prop="java.vendor"/>
<echoprop prop="java.version"/>
<echoprop prop="user.name"/>
<echoprop prop="user.home"/>
<echoprop prop="user.dir"/>
<target name="cleanupArtifacts">
<delete dir="${artifact.output.path}" includes="*"/>
</target>
<macrodef name="substituteVersionInFile">
<attribute name="target.file"/>
<attribute name="test.string"/>
<attribute name="target.file.bk" default="@{target.file}.bk"/>
<attribute name="target.file.versioned" default="@{target.file}.versioned"/>
<attribute name="token.key" default="snapshot"/>
<attribute name="version" default="${build.number}"/>
<sequential>
<!-- Create backup. Backup will be restored after build end. This will allow to rebuild project without renew
plugin.xml from repository. -->
<copy file="@{target.file}" tofile="@{target.file.bk}"/>
<!-- Check that version has correct pattern for substitution -->
<copy todir="">
<fileset file="@{target.file.bk}">
<contains text="@{test.string}"/>
</fileset>
<filterchain>
<replacetokens>
<token key="@{token.key}" value="@{version}"/>
</replacetokens>
</filterchain>
<mergemapper to="@{target.file.versioned}"/>
</copy>
<!-- If file doesn't exist - there's a problem with original plugin.xml. Probably there's a bad pattern used for version -->
<copy file="@{target.file.versioned}" tofile="@{target.file}" overwrite="true"/>
<delete file="@{target.file.versioned}" quiet="true"/>
</sequential>
</macrodef>
<target name="writeCompilerVersionToTemplateFile">
<!-- empty, version is written in gradle build -->
</target>
<target name="writePluginVersionToTemplateFile">
<mkdir dir="${version_substitute_dir}"/>
<substituteVersionInFile
target.file="${plugin.xml}"
target.file.bk="${plugin.xml.bk}"
target.file.versioned="${plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"
version="${plugin.xml.version.number}"/>
</target>
<target name="revertTemplateFiles">
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
<delete dir="${version_substitute_dir}" quiet="true"/>
</target>
<target name="pre_build" depends="writeCompilerVersionToTemplateFile, writePluginVersionToTemplateFile, cleanupArtifacts"/>
<target name="zipArtifacts">
<macrodef name="zipPlugin">
<attribute name="filename"/>
<attribute name="prefix" />
<attribute name="dir"/>
<sequential>
<zip destfile="@{filename}">
<zipfileset prefix="@{prefix}" dir="@{dir}" excludes="kotlinc/bin/*"/>
<zipfileset prefix="@{prefix}/kotlinc/bin" dir="@{dir}/kotlinc/bin" includes="*.bat"
filemode="644"/>
<zipfileset prefix="@{prefix}/kotlinc/bin" dir="@{dir}/kotlinc/bin" excludes="*.bat"
filemode="755"/>
</zip>
</sequential>
</macrodef>
<zipPlugin filename="${plugin.zip}" prefix="Kotlin" dir="${artifact.output.path}/${pluginArtifactDir}"/>
</target>
<macrodef name="print-statistic">
<attribute name="key"/>
<attribute name="value"/>
<sequential>
<echo message="##teamcity[buildStatisticValue key='@{key}' value='@{value}']"/>
</sequential>
</macrodef>
<macrodef name="print-file-size-statistic">
<attribute name="path"/>
<attribute name="file-name"/>
<sequential>
<local name="file.size"/>
<length file="@{path}/@{file-name}" property="file.size"/>
<print-statistic key="@{file-name} size" value="${file.size}"/>
</sequential>
</macrodef>
<target name="printStatistics">
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-stdlib.jar"/>
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-reflect.jar"/>
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-stdlib-js.jar"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="kotlin.js"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="kotlin-test.js"/>
<print-file-size-statistic path="${basedir}/libraries/stdlib/js/build/classes/main" file-name="kotlin.meta.js"/>
</target>
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>
<target name="none">
<fail message="Either specify pre_build or post_build"/>
</target>
<property name="teamcity.build.branch" value=""/>
<condition property="need.remove.artifacts" value="true">
<and>
<matches pattern="rri?/.*" string="${teamcity.build.branch}"/>
<not>
<matches pattern="rri?/internal/.*" string="${teamcity.build.branch}"/>
</not>
</and>
</condition>
<target name="remove_internal_artifacts"
description="Remove internal artifacts for rri?/* branches, but store them for rri?/internal/*"
if="need.remove.artifacts">
<echo message="Remove internal artifacts" />
<delete failonerror="false" verbose="true">
<fileset dir="dist">
<include name="kotlin-compiler-before-shrink.jar"/>
<include name="kotlin-for-upsource.jar"/>
<include name="kotlin-for-upsource-sources.jar"/>
<include name="kotlin-test-data.zip"/>
</fileset>
<fileset dir="out/artifacts/internal">
<include name="kotlin-ide-common.jar"/>
</fileset>
</delete>
</target>
<target name="dont_remove_internal_artifacts" unless="need.remove.artifacts">
<echo message="Internal artifacts left untouched"/>
</target>
</project>

View File

@@ -1,92 +0,0 @@
<project name="Change plugins version" default="change-version">
<property name="relay.origin.version" value="1.0.0-beta-2423"/>
<property name="relay.substitute.version" value="1.0.0-beta-2423-IJ-141-3"/>
<property name="relay.plugins.dir" value="artifacts"/>
<property name="relay.unpack.directory" value="relay-dir"/>
<macrodef name="substituteRegexpInFile">
<attribute name="src.file"/>
<attribute name="output.dir"/>
<attribute name="origin.version"/>
<attribute name="substituted.version"/>
<sequential>
<copy todir="@{output.dir}">
<fileset file="@{src.file}"/>
<filterchain>
<replaceregex pattern="@{origin.version}" replace="@{substituted.version}" />
</filterchain>
</copy>
</sequential>
</macrodef>
<macrodef name="substitudeVersionInPlugin">
<attribute name="plugin.path"/>
<attribute name="plugin.jar.name"/>
<attribute name="origin.version"/>
<attribute name="substituted.version"/>
<attribute name="plugin.subdir"/>
<attribute name="output-dir" default="@{substituted.version}"/>
<attribute name="output.plugin.file.name" default="@{plugin.jar.name}-@{substituted.version}.zip"/>
<attribute name="temp.origin.dir" default="${relay.unpack.directory}/@{plugin.jar.name}/plugin-origin"/>
<attribute name="temp.substitute.dir" default="${relay.unpack.directory}/@{plugin.jar.name}/substitute"/>
<sequential>
<delete dir="${relay.unpack.directory}/@{plugin.jar.name}"/>
<mkdir dir="${relay.unpack.directory}/@{plugin.jar.name}"/>
<unzip src="@{plugin.path}" dest="@{temp.origin.dir}">
<patternset>
<include name="**/lib/@{plugin.jar.name}.jar" />
</patternset>
<flattenmapper/>
</unzip>
<unzip src="@{temp.origin.dir}/@{plugin.jar.name}.jar" dest="@{temp.origin.dir}">
<patternset>
<include name="**/META-INF/plugin.xml" />
</patternset>
<flattenmapper/>
</unzip>
<substituteRegexpInFile
src.file="@{temp.origin.dir}/plugin.xml" output.dir="@{temp.substitute.dir}"
origin.version="@{origin.version}" substituted.version="@{substituted.version}"/>
<!-- Copy updated file back into jar -->
<copy file="@{temp.origin.dir}/@{plugin.jar.name}.jar" todir="@{temp.substitute.dir}"/>
<jar destfile="@{temp.substitute.dir}/@{plugin.jar.name}.jar" update="true">
<zipfileset file="@{temp.substitute.dir}/plugin.xml" prefix="META-INF"/>
</jar>
<!-- Pack updated plugin.jar back to zip file -->
<copy file="@{plugin.path}" tofile="@{substituted.version}/@{output.plugin.file.name}"/>
<zip destfile="@{substituted.version}/@{output.plugin.file.name}" update="true">
<zipfileset file="@{temp.substitute.dir}/@{plugin.jar.name}.jar" prefix="@{plugin.subdir}/lib"/>
</zip>
</sequential>
</macrodef>
<target name="change-version" description="Repack plugin with other version">
<delete dir="${relay.unpack.directory}"/>
<delete dir="${relay.substitute.version}"/>
<mkdir dir="${relay.unpack.directory}"/>
<mkdir dir="${relay.substitute.version}"/>
<substitudeVersionInPlugin
plugin.jar.name="kotlin-plugin"
plugin.path="${relay.plugins.dir}/kotlin-plugin-${relay.origin.version}.zip"
origin.version="${relay.origin.version}"
plugin.subdir="Kotlin"
substituted.version="${relay.substitute.version}"/>
<substitudeVersionInPlugin
plugin.jar.name="kotlin-android-extensions"
plugin.path="${relay.plugins.dir}/kotlin-android-extensions-plugin-${relay.origin.version}.zip"
origin.version="${relay.origin.version}"
plugin.subdir="KotlinAndroidExtensions"
substituted.version="${relay.substitute.version}"/>
</target>
</project>

View File

@@ -1,7 +1,9 @@
description = "Kotlin Ant Tools"
apply { plugin("kotlin") }
plugins {
kotlin("jvm")
}
dependencies {
compile(commonDep("org.apache.ant", "ant"))

View File

@@ -1,7 +1,10 @@
description = "Kotlin Build Common"
apply { plugin("kotlin") }
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
compileOnly(project(":core:util.runtime"))
@@ -10,15 +13,18 @@ dependencies {
compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":js:js.serializer"))
compileOnly(project(":js:js.frontend"))
compileOnly(ideaSdkDeps("util"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeJars("annotations", "asm-all", "trove4j", "util") }
compileOnly(project(":kotlin-reflect-api"))
testCompileOnly(project(":compiler:cli-common"))
testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit"))
testCompile(protobufFull())
testCompile(projectDist(":kotlin-stdlib"))
testCompile(projectDist(":kotlin-reflect"))
testCompileOnly(ideaSdkDeps("openapi"))
testRuntime(projectDist(":kotlin-compiler"))
testCompileOnly(intellijDep()) { includeJars("openapi") }
testRuntime(projectDist(":kotlin-reflect"))
}
sourceSets {

View File

@@ -0,0 +1,40 @@
/*
* 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.metadata.java;
import "core/metadata/src/metadata.proto";
option java_outer_classname = "JavaClassProtoBuf";
option optimize_for = LITE_RUNTIME;
extend Function {
optional bool is_static_method = 1000;
optional bool is_package_private_method = 1001;
}
extend Property {
optional bool is_static_field = 1000;
optional bool is_package_private_field = 1001;
}
extend Class {
optional bool is_package_private_class = 1000;
}
extend Constructor {
optional bool is_package_private_constructor = 1000;
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.isPreRelease
import kotlin.reflect.KClass
interface BuildMetaInfo {
val isEAP: Boolean
val compilerBuildVersion: String
val languageVersionString: String
val apiVersionString: String
val coroutinesEnable: Boolean
val coroutinesWarn: Boolean
val coroutinesError: Boolean
val multiplatformEnable: Boolean
val metadataVersionMajor: Int
val metadataVersionMinor: Int
val metadataVersionPatch: Int
val ownVersion: Int
val coroutinesVersion: Int
val multiplatformVersion: Int
}
abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass: KClass<T>) {
protected abstract fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int
): T
fun create(args: CommonCompilerArguments): T {
val languageVersion = args.languageVersion?.let((LanguageVersion)::fromVersionString) ?: LanguageVersion.LATEST_STABLE
return create(
isEAP = languageVersion.isPreRelease(),
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
ownVersion = OWN_VERSION,
coroutinesVersion = COROUTINES_VERSION,
multiplatformVersion = MULTIPLATFORM_VERSION
)
}
fun serializeToString(info: T): String =
serializeToPlainText(info, metaInfoClass)
fun deserializeFromString(str: String): T? =
deserializeFromPlainText(str, metaInfoClass)
companion object {
const val OWN_VERSION: Int = 0
const val COROUTINES_VERSION: Int = 0
const val MULTIPLATFORM_VERSION: Int = 0
}
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
import org.jetbrains.kotlin.utils.JsMetadataVersion
/**
* If you want to add a new field, check its type is supported by [serializeToPlainText], [deserializeFromPlainText]
*/
data class CommonBuildMetaInfo(
override val isEAP: Boolean,
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
override val metadataVersionPatch: Int,
override val ownVersion: Int,
override val coroutinesVersion: Int,
override val multiplatformVersion: Int
) : BuildMetaInfo {
companion object : BuildMetaInfoFactory<CommonBuildMetaInfo>(CommonBuildMetaInfo::class) {
override fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int
) = CommonBuildMetaInfo(
isEAP = isEAP,
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = JvmMetadataVersion.INSTANCE.major,
metadataVersionMinor = JvmMetadataVersion.INSTANCE.minor,
metadataVersionPatch = JvmMetadataVersion.INSTANCE.patch,
ownVersion = ownVersion,
coroutinesVersion = coroutinesVersion,
multiplatformVersion = multiplatformVersion
)
}
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.utils.JsMetadataVersion
/**
* If you want to add a new field, check its type is supported by [serializeToPlainText], [deserializeFromPlainText]
*/
data class JsBuildMetaInfo(
override val isEAP: Boolean,
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
override val metadataVersionPatch: Int,
override val ownVersion: Int,
override val coroutinesVersion: Int,
override val multiplatformVersion: Int
) : BuildMetaInfo {
companion object : BuildMetaInfoFactory<JsBuildMetaInfo>(JsBuildMetaInfo::class) {
override fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int
) = JsBuildMetaInfo(
isEAP = isEAP,
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = JsMetadataVersion.INSTANCE.major,
metadataVersionMinor = JsMetadataVersion.INSTANCE.minor,
metadataVersionPatch = JsMetadataVersion.INSTANCE.patch,
ownVersion = ownVersion,
coroutinesVersion = coroutinesVersion,
multiplatformVersion = multiplatformVersion
)
}
}

View File

@@ -16,66 +16,62 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.shouldWritePreReleaseFlag
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**
* If you want to add a new field, check its type is supported by [serializeToPlainText], [deserializeFromPlainText]
*/
data class JvmBuildMetaInfo(
val isEAP: Boolean,
val compilerBuildVersion: String,
val languageVersionString: String,
val apiVersionString: String,
val coroutinesEnable: Boolean,
val coroutinesWarn: Boolean,
val coroutinesError: Boolean,
val multiplatformEnable: Boolean,
val metadataVersionMajor: Int,
val metadataVersionMinor: Int,
val metadataVersionPatch: Int,
val bytecodeVersionMajor: Int,
val bytecodeVersionMinor: Int,
val bytecodeVersionPatch: Int,
val ownVersion: Int = JvmBuildMetaInfo.OWN_VERSION,
val coroutinesVersion: Int = JvmBuildMetaInfo.COROUTINES_VERSION,
val multiplatformVersion: Int = JvmBuildMetaInfo.MULTIPLATFORM_VERSION
) {
companion object {
const val OWN_VERSION: Int = 0
const val COROUTINES_VERSION: Int = 0
const val MULTIPLATFORM_VERSION: Int = 0
fun serializeToString(info: JvmBuildMetaInfo): String =
serializeToPlainText(info)
fun deserializeFromString(str: String): JvmBuildMetaInfo? =
deserializeFromPlainText(str)
}
}
fun JvmBuildMetaInfo(args: CommonCompilerArguments): JvmBuildMetaInfo {
val languageVersion = args.languageVersion?.let((LanguageVersion)::fromVersionString) ?: LanguageVersion.LATEST_STABLE
return JvmBuildMetaInfo(
isEAP = languageVersion.shouldWritePreReleaseFlag(),
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: ApiVersion.LATEST_STABLE.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
override val isEAP: Boolean,
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
override val metadataVersionPatch: Int,
val bytecodeVersionMajor: Int,
val bytecodeVersionMinor: Int,
val bytecodeVersionPatch: Int,
override val ownVersion: Int,
override val coroutinesVersion: Int,
override val multiplatformVersion: Int
) : BuildMetaInfo {
companion object : BuildMetaInfoFactory<JvmBuildMetaInfo>(JvmBuildMetaInfo::class) {
override fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int
) = JvmBuildMetaInfo(
isEAP = isEAP,
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = JvmMetadataVersion.INSTANCE.major,
metadataVersionMinor = JvmMetadataVersion.INSTANCE.minor,
metadataVersionPatch = JvmMetadataVersion.INSTANCE.patch,
bytecodeVersionMajor = JvmBytecodeBinaryVersion.INSTANCE.major,
bytecodeVersionMinor = JvmBytecodeBinaryVersion.INSTANCE.minor,
bytecodeVersionPatch = JvmBytecodeBinaryVersion.INSTANCE.patch
)
bytecodeVersionPatch = JvmBytecodeBinaryVersion.INSTANCE.patch,
ownVersion = ownVersion,
coroutinesVersion = coroutinesVersion,
multiplatformVersion = multiplatformVersion
)
}
}

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
import org.jetbrains.kotlin.utils.sure
import java.io.File

View File

@@ -46,6 +46,7 @@ public class ArgumentUtils {
Class<? extends CommonToolArguments> argumentsClass = arguments.getClass();
convertArgumentsToStringList(arguments, argumentsClass.newInstance(), JvmClassMappingKt.getKotlinClass(argumentsClass), result);
result.addAll(arguments.getFreeArgs());
result.addAll(arguments.getInternalArguments());
return result;
}

View File

@@ -0,0 +1,192 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.deserialization.supertypes
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.io.File
import java.util.*
/**
* Incremental cache common for JVM and JS, ClassName type aware
*/
interface IncrementalCacheCommon {
val thisWithDependentCaches: Iterable<AbstractIncrementalCache<*>>
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName>
fun getSubtypesOf(className: FqName): Sequence<FqName>
fun getSourceFileIfClass(fqName: FqName): File?
fun markDirty(removedAndCompiledSources: Collection<File>)
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
fun clearComplementaryFilesMapping(dirtyFiles: Collection<File>): Collection<File>
fun registerComplementaryFiles(expectActualTracker: ExpectActualTrackerImpl)
fun dump(): String
}
/**
* Incremental cache common for JVM and JS for specifit ClassName type
*/
abstract class AbstractIncrementalCache<ClassName>(workingDir: File) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
companion object {
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
private val COMPLEMENTARY_FILES = "complementary-files"
@JvmStatic protected val SOURCE_TO_CLASSES = "source-to-classes"
@JvmStatic protected val DIRTY_OUTPUT_CLASSES = "dirty-output-classes"
}
private val dependents = arrayListOf<AbstractIncrementalCache<ClassName>>()
fun addDependentCache(cache: AbstractIncrementalCache<ClassName>) {
dependents.add(cache)
}
override val thisWithDependentCaches: Iterable<AbstractIncrementalCache<ClassName>> by lazy {
val result = arrayListOf(this)
result.addAll(dependents)
result
}
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile))
internal abstract val sourceToClassesMap: AbstractSourceToOutputMap<ClassName>
internal abstract val dirtyOutputClassesMap: AbstractDirtyClassesMap<ClassName>
/**
* A file X is a complementary to a file Y if they contain corresponding expect/actual declarations.
* Complementary files should be compiled together during IC so the compiler does not complain
* about missing parts.
* TODO: provide a better solution (maintain an index of expect/actual declarations akin to IncrementalPackagePartProvider)
*/
private val complementaryFilesMap = registerMap(FilesMap(COMPLEMENTARY_FILES.storageFile))
override fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName> =
files.flatMapTo(HashSet()) { sourceToClassesMap.getFqNames(it) }
override fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
override fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
override fun markDirty(removedAndCompiledSources: Collection<File>) {
for (sourceFile in removedAndCompiledSources) {
val classes = sourceToClassesMap[sourceFile]
classes.forEach {
dirtyOutputClassesMap.markDirty(it)
}
sourceToClassesMap.clearOutputsForSource(sourceFile)
}
}
protected fun addToClassStorage(proto: ProtoBuf.Class, nameResolver: NameResolver, srcFile: File) {
val supertypes = proto.supertypes(TypeTable(proto.typeTable))
val parents = supertypes.map { nameResolver.getClassId(it.className).asSingleFqName() }
.filter { it.asString() != "kotlin.Any" }
.toSet()
val child = nameResolver.getClassId(proto.fqName).asSingleFqName()
parents.forEach { subtypesMap.add(it, child) }
val removedSupertypes = supertypesMap[child].filter { it !in parents }
removedSupertypes.forEach { subtypesMap.removeValues(it, setOf(child)) }
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
if (removedClasses.isEmpty()) return
val removedFqNames = removedClasses.toSet()
for (removedClass in removedFqNames) {
for (affectedClass in withSubtypes(removedClass, thisWithDependentCaches)) {
changesCollector.collectSignature(affectedClass, areSubclassesAffected = false)
}
}
for (cache in thisWithDependentCaches) {
val parentsFqNames = hashSetOf<FqName>()
val childrenFqNames = hashSetOf<FqName>()
for (removedFqName in removedFqNames) {
parentsFqNames.addAll(cache.supertypesMap[removedFqName])
childrenFqNames.addAll(cache.subtypesMap[removedFqName])
cache.supertypesMap.remove(removedFqName)
cache.subtypesMap.remove(removedFqName)
}
for (child in childrenFqNames) {
cache.supertypesMap.removeValues(child, removedFqNames)
}
for (parent in parentsFqNames) {
cache.subtypesMap.removeValues(parent, removedFqNames)
}
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
}
protected class ClassFqNameToSourceMap(storageFile: File) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = sourceFile.canonicalPath
}
operator fun get(fqName: FqName): File? =
storage[fqName.asString()]?.let(::File)
fun remove(fqName: FqName) {
storage.remove(fqName.asString())
}
override fun dumpValue(value: String) = value
}
override fun clearComplementaryFilesMapping(dirtyFiles: Collection<File>): Collection<File> {
val complementaryFiles = HashSet<File>()
val filesQueue = ArrayDeque(dirtyFiles)
while (filesQueue.isNotEmpty()) {
val file = filesQueue.pollFirst()
complementaryFilesMap.remove(file).filterTo(filesQueue) { complementaryFiles.add(it) }
}
complementaryFiles.removeAll(dirtyFiles)
return complementaryFiles
}
override fun registerComplementaryFiles(expectActualTracker: ExpectActualTrackerImpl) {
val actualToExpect = hashMapOf<File, MutableSet<File>>()
for ((expect, actuals) in expectActualTracker.expectToActualMap) {
for (actual in actuals) {
actualToExpect.getOrPut(actual) { hashSetOf() }.add(expect)
}
complementaryFilesMap[expect] = actuals
}
for ((actual, expects) in actualToExpect) {
complementaryFilesMap[actual] = expects
}
}
}

View File

@@ -18,13 +18,13 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
import java.io.File
import java.io.IOException
private val NORMAL_VERSION = 8
private val DATA_CONTAINER_VERSION = 2
private val NORMAL_VERSION = 9
private val DATA_CONTAINER_VERSION = 3
private val NORMAL_VERSION_FILE_NAME = "format-version.txt"
private val DATA_CONTAINER_VERSION_FILE_NAME = "data-container-format-version.txt"

View File

@@ -16,11 +16,12 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.deserialization.getClassId
class ChangesCollector {
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()
@@ -72,13 +73,13 @@ class ChangesCollector {
}
}
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?) {
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?, collectAllMembersForNewClass: Boolean = false) {
if (oldData == null && newData == null) {
throw IllegalStateException("Old and new value are null")
}
if (oldData == null) {
newData!!.collectAll(isRemoved = false)
newData!!.collectAll(isRemoved = false, collectAllMembersForNewClass = collectAllMembersForNewClass)
return
}
@@ -120,10 +121,10 @@ class ChangesCollector {
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
private fun ProtoData.collectAll(isRemoved: Boolean) =
private fun ProtoData.collectAll(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) =
when (this) {
is PackagePartProtoData -> collectAllFromPackage(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved, collectAllMembersForNewClass)
}
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
@@ -142,28 +143,36 @@ class ChangesCollector {
}
}
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean) {
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) {
val classFqName = nameResolver.getClassId(proto.fqName).asSingleFqName()
val kind = Flags.CLASS_KIND.get(proto.flags)
if (kind == ProtoBuf.Class.Kind.COMPANION_OBJECT) {
val memberNames =
proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Class::getConstructorList,
ProtoBuf.Class::getFunctionList,
ProtoBuf.Class::getPropertyList
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
val memberNames = getNonPrivateMemberNames()
val collectMember = if (isRemoved) this@ChangesCollector::collectRemovedMember else this@ChangesCollector::collectChangedMember
collectMember(classFqName.parent(), classFqName.shortName().asString())
memberNames.forEach { collectMember(classFqName, it) }
}
else {
if (!isRemoved && collectAllMembersForNewClass) {
val memberNames = getNonPrivateMemberNames()
memberNames.forEach { this@ChangesCollector.collectChangedMember(classFqName, it) }
}
collectSignature(classFqName, areSubclassesAffected = true)
}
}
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {
return proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Class::getConstructorList,
ProtoBuf.Class::getFunctionList,
ProtoBuf.Class::getPropertyList
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
}
fun collectMemberIfValueWasChanged(scope: FqName, name: String, oldValue: Any?, newValue: Any?) {
if (oldValue == null && newValue == null) {
throw IllegalStateException("Old and new value are null for $scope#$name")
@@ -186,4 +195,4 @@ class ChangesCollector {
val prevValue = this.areSubclassesAffected[fqName] ?: false
this.areSubclassesAffected[fqName] = prevValue || areSubclassesAffected
}
}
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
import java.io.File
class ExpectActualTrackerImpl : ExpectActualTracker {
private val expectToActual = hashMapOf<File, MutableSet<File>>()
val expectToActualMap: Map<File, Set<File>>
get() = expectToActual
override fun report(expectedFile: File, actualFile: File) {
expectToActual.getOrPut(expectedFile) { hashSetOf() }.add(actualFile)
}
}

View File

@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
interface ICReporter {
fun report(message: ()->String)
fun report(message: () -> String)
// used in Gradle plugin
@Suppress("unused")

View File

@@ -1,119 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.deserialization.TypeTable
import org.jetbrains.kotlin.serialization.deserialization.supertypes
import java.io.File
/**
* Incremental cache common for JVM and JS
*/
abstract class IncrementalCacheCommon(workingDir: File) : BasicMapsOwner(workingDir) {
companion object {
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
}
private val dependents = arrayListOf<IncrementalCacheCommon>()
fun addDependentCache(cache: IncrementalCacheCommon) {
dependents.add(cache)
}
val thisWithDependentCaches: Iterable<IncrementalCacheCommon> by lazy {
val result = arrayListOf(this)
result.addAll(dependents)
result
}
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile))
fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
abstract fun markDirty(removedAndCompiledSources: List<File>)
protected fun addToClassStorage(proto: ProtoBuf.Class, nameResolver: NameResolver, srcFile: File) {
val supertypes = proto.supertypes(TypeTable(proto.typeTable))
val parents = supertypes.map { nameResolver.getClassId(it.className).asSingleFqName() }
.filter { it.asString() != "kotlin.Any" }
.toSet()
val child = nameResolver.getClassId(proto.fqName).asSingleFqName()
parents.forEach { subtypesMap.add(it, child) }
val removedSupertypes = supertypesMap[child].filter { it !in parents }
removedSupertypes.forEach { subtypesMap.removeValues(it, setOf(child)) }
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>) {
if (removedClasses.isEmpty()) return
val removedFqNames = removedClasses.toSet()
for (cache in thisWithDependentCaches) {
val parentsFqNames = hashSetOf<FqName>()
val childrenFqNames = hashSetOf<FqName>()
for (removedFqName in removedFqNames) {
parentsFqNames.addAll(cache.supertypesMap[removedFqName])
childrenFqNames.addAll(cache.subtypesMap[removedFqName])
cache.supertypesMap.remove(removedFqName)
cache.subtypesMap.remove(removedFqName)
}
for (child in childrenFqNames) {
cache.supertypesMap.removeValues(child, removedFqNames)
}
for (parent in parentsFqNames) {
cache.subtypesMap.removeValues(parent, removedFqNames)
}
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
}
protected class ClassFqNameToSourceMap(storageFile: File) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = sourceFile.canonicalPath
}
operator fun get(fqName: FqName): File? =
storage[fqName.asString()]?.let(::File)
fun remove(fqName: FqName) {
storage.remove(fqName.asString())
}
override fun dumpValue(value: String) = value
}
}

View File

@@ -19,31 +19,39 @@ package org.jetbrains.kotlin.incremental
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl
import org.jetbrains.kotlin.incremental.js.TranslationResultValue
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.incremental.storage.BasicStringMap
import org.jetbrains.kotlin.incremental.storage.DirtyClassesFqNameMap
import org.jetbrains.kotlin.incremental.storage.SourceToFqNameMap
import org.jetbrains.kotlin.incremental.storage.StringToLongMapExternalizer
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull
import org.jetbrains.kotlin.metadata.js.JsProtoBuf
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolverImpl
import org.jetbrains.kotlin.serialization.js.JsProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import java.io.DataInput
import java.io.DataOutput
import java.io.File
open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDir) {
open class IncrementalJsCache(cachesDir: File) : AbstractIncrementalCache<FqName>(cachesDir) {
companion object {
private val TRANSLATION_RESULT_MAP = "translation-result"
private val SOURCES_TO_CLASSES_FQNS = "sources-to-classes"
private val INLINE_FUNCTIONS = "inline-functions"
private val HEADER_FILE_NAME = "header.meta"
fun hasHeaderFile(cachesDir: File) = File(cachesDir, HEADER_FILE_NAME).exists()
}
private val dirtySources = arrayListOf<File>()
override val sourceToClassesMap = registerMap(SourceToFqNameMap(SOURCE_TO_CLASSES.storageFile))
override val dirtyOutputClassesMap = registerMap(DirtyClassesFqNameMap(DIRTY_OUTPUT_CLASSES.storageFile))
private val translationResults = registerMap(TranslationResultMap(TRANSLATION_RESULT_MAP.storageFile))
private val sourcesToClasses = registerMap(SourceToClassesMap(SOURCES_TO_CLASSES_FQNS.storageFile))
private val inlineFunctions = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
private val dirtySources = hashSetOf<File>()
private val headerFile: File
get() = File(cachesDir, HEADER_FILE_NAME)
@@ -54,31 +62,24 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDi
headerFile.writeBytes(value)
}
override fun markDirty(removedAndCompiledSources: List<File>) {
override fun markDirty(removedAndCompiledSources: Collection<File>) {
super.markDirty(removedAndCompiledSources)
dirtySources.addAll(removedAndCompiledSources)
}
fun compareAndUpdate(incrementalResults: IncrementalResultsConsumerImpl, changesCollector: ChangesCollector) {
val translatedFiles = incrementalResults.packageParts
dirtySources.forEach {
if (it !in translatedFiles) {
translationResults.remove(it, changesCollector)
inlineFunctions.remove(it)
}
removeAllFromClassStorage(sourcesToClasses[it])
sourcesToClasses.clearOutputsForSource(it)
}
dirtySources.clear()
for ((srcFile, data) in translatedFiles) {
dirtySources.remove(srcFile)
val (binaryMetadata, binaryAst) = data
val oldProtoMap = translationResults[srcFile]?.metadata?.let { getProtoData(srcFile, it) } ?: emptyMap()
val newProtoMap = getProtoData(srcFile, binaryMetadata)
for (protoData in newProtoMap.values) {
for ((classId, protoData) in newProtoMap) {
registerOutputForFile(srcFile, classId.asSingleFqName())
if (protoData is ClassProtoData) {
addToClassStorage(protoData.proto, protoData.nameResolver, srcFile)
}
@@ -96,6 +97,21 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDi
}
}
private fun registerOutputForFile(srcFile: File, name: FqName) {
sourceToClassesMap.add(srcFile, name)
dirtyOutputClassesMap.notDirty(name)
}
override fun clearCacheForRemovedClasses(changesCollector: ChangesCollector) {
dirtySources.forEach {
translationResults.remove(it, changesCollector)
inlineFunctions.remove(it)
}
removeAllFromClassStorage(dirtyOutputClassesMap.getDirtyOutputClasses(), changesCollector)
dirtySources.clear()
dirtyOutputClassesMap.clean()
}
fun nonDirtyPackageParts(): Map<File, TranslationResultValue> =
hashMapOf<File, TranslationResultValue>().apply {
for (path in translationResults.keys()) {
@@ -107,25 +123,6 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon(cachesDi
}
}
private class SourceToClassesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
fun clearOutputsForSource(sourceFile: File) {
remove(sourceFile.canonicalPath)
}
fun add(sourceFile: File, className: FqName) {
storage.append(sourceFile.canonicalPath, className.asString())
}
operator fun get(sourceFile: File): Collection<FqName> =
storage[sourceFile.canonicalPath].orEmpty().map { FqName(it) }
override fun dumpValue(value: Collection<String>) = value.dumpCollection()
private fun remove(path: String) {
storage.remove(path)
}
}
private object TranslationResultValueExternalizer : DataExternalizer<TranslationResultValue> {
override fun save(output: DataOutput, value: TranslationResultValue) {
output.writeInt(value.metadata.size)
@@ -187,14 +184,11 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
}
proto.`package`.apply {
val packageFqName = if (hasExtension(JsProtoBuf.packageFqName)) {
nameResolver.getPackageFqName(getExtension(JsProtoBuf.packageFqName))
}
else FqName.ROOT
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
return classes
}

View File

@@ -25,14 +25,15 @@ import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.inline.inlineFunctionsJvmNames
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import org.jetbrains.org.objectweb.asm.*
import java.io.File
import java.security.MessageDigest
@@ -43,57 +44,52 @@ val KOTLIN_CACHE_DIRECTORY_NAME = "kotlin"
open class IncrementalJvmCache(
private val targetDataRoot: File,
targetOutputDir: File?
) : IncrementalCacheCommon(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
) : AbstractIncrementalCache<JvmClassName>(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
companion object {
private val PROTO_MAP = "proto"
private val CONSTANTS_MAP = "constants"
private val PACKAGE_PARTS = "package-parts"
private val MULTIFILE_CLASS_FACADES = "multifile-class-facades"
private val MULTIFILE_CLASS_PARTS = "multifile-class-parts"
private val SOURCE_TO_CLASSES = "source-to-classes"
private val DIRTY_OUTPUT_CLASSES = "dirty-output-classes"
private val INLINE_FUNCTIONS = "inline-functions"
private val INTERNAL_NAME_TO_SOURCE = "internal-name-to-source"
private val JAVA_SOURCES_PROTO_MAP = "java-sources-proto-map"
private val MODULE_MAPPING_FILE_NAME = "." + ModuleMapping.MAPPING_FILE_EXT
}
override val sourceToClassesMap = registerMap(SourceToJvmNameMap(SOURCE_TO_CLASSES.storageFile))
override val dirtyOutputClassesMap = registerMap(DirtyClassesJvmNameMap(DIRTY_OUTPUT_CLASSES.storageFile))
private val protoMap = registerMap(ProtoMap(PROTO_MAP.storageFile))
private val constantsMap = registerMap(ConstantsMap(CONSTANTS_MAP.storageFile))
private val packagePartMap = registerMap(PackagePartMap(PACKAGE_PARTS.storageFile))
private val multifileFacadeToParts = registerMap(MultifileClassFacadeMap(MULTIFILE_CLASS_FACADES.storageFile))
private val partToMultifileFacade = registerMap(MultifileClassPartMap(MULTIFILE_CLASS_PARTS.storageFile))
private val sourceToClassesMap = registerMap(SourceToClassesMap(SOURCE_TO_CLASSES.storageFile))
private val dirtyOutputClassesMap = registerMap(DirtyOutputClassesMap(DIRTY_OUTPUT_CLASSES.storageFile))
private val inlineFunctionsMap = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
// todo: try to use internal names only?
private val internalNameToSource = registerMap(InternalNameToSourcesMap(INTERNAL_NAME_TO_SOURCE.storageFile))
private val javaSourcesProtoMap = registerMap(JavaSourcesProtoMap(JAVA_SOURCES_PROTO_MAP.storageFile))
private val outputDir by lazy(LazyThreadSafetyMode.NONE) { requireNotNull(targetOutputDir) { "Target is expected to have output directory" } }
protected open fun debugLog(message: String) {}
override fun markDirty(removedAndCompiledSources: List<File>) {
for (sourceFile in removedAndCompiledSources) {
val classes = sourceToClassesMap[sourceFile]
classes.forEach {
dirtyOutputClassesMap.markDirty(it.internalName)
}
sourceToClassesMap.clearOutputsForSource(sourceFile)
}
}
fun isTrackedFile(file: File) = sourceToClassesMap.contains(file)
// used in gradle
@Suppress("unused")
fun classesBySources(sources: Iterable<File>): Iterable<JvmClassName> =
sources.flatMap { sourceToClassesMap[it] }
fun sourceInCache(file: File): Boolean =
sourceToClassesMap.contains(file)
fun sourcesByInternalName(internalName: String): Collection<File> =
internalNameToSource[internalName]
fun isMultifileFacade(className: JvmClassName): Boolean =
className.internalName in multifileFacadeToParts
className in multifileFacadeToParts
override fun getClassFilePath(internalClassName: String): String {
return toSystemIndependentName(File(outputDir, "$internalClassName.class").canonicalPath)
@@ -102,7 +98,7 @@ open class IncrementalJvmCache(
fun saveModuleMappingToCache(sourceFiles: Collection<File>, file: File) {
val jvmClassName = JvmClassName.byInternalName(MODULE_MAPPING_FILE_NAME)
protoMap.storeModuleMapping(jvmClassName, file.readBytes())
dirtyOutputClassesMap.notDirty(MODULE_MAPPING_FILE_NAME)
dirtyOutputClassesMap.notDirty(jvmClassName)
sourceFiles.forEach { sourceToClassesMap.add(it, jvmClassName) }
}
@@ -111,7 +107,7 @@ open class IncrementalJvmCache(
val kotlinClass: LocalFileKotlinClass = generatedClass.outputClass
val className = kotlinClass.className
dirtyOutputClassesMap.notDirty(className.internalName)
dirtyOutputClassesMap.notDirty(className)
sourceFiles.forEach {
sourceToClassesMap.add(it, className)
}
@@ -169,22 +165,46 @@ open class IncrementalJvmCache(
}
}
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector) {
val dirtyClasses = dirtyOutputClassesMap
.getDirtyOutputClasses()
.map(JvmClassName::byInternalName)
.toList()
fun saveJavaClassProto(source: File, serializedJavaClass: SerializedJavaClass, collector: ChangesCollector) {
val jvmClassName = JvmClassName.byClassId(serializedJavaClass.classId)
javaSourcesProtoMap.process(jvmClassName, serializedJavaClass, collector)
sourceToClassesMap.add(source, jvmClassName)
val (proto, nameResolver) = serializedJavaClass.toProtoData()
addToClassStorage(proto, nameResolver, source)
dirtyOutputClassesMap.notDirty(jvmClassName)
}
fun getObsoleteJavaClasses(): Collection<ClassId> =
dirtyOutputClassesMap.getDirtyOutputClasses()
.mapNotNull {
javaSourcesProtoMap[it]?.classId
}
fun isJavaClassToTrack(classId: ClassId): Boolean {
val jvmClassName = JvmClassName.byClassId(classId)
return dirtyOutputClassesMap.isDirty(jvmClassName) ||
jvmClassName !in javaSourcesProtoMap
}
fun isJavaClassAlreadyInCache(classId: ClassId): Boolean {
val jvmClassName = JvmClassName.byClassId(classId)
return jvmClassName in javaSourcesProtoMap
}
override fun clearCacheForRemovedClasses(changesCollector: ChangesCollector) {
val dirtyClasses = dirtyOutputClassesMap.getDirtyOutputClasses()
val facadesWithRemovedParts = hashMapOf<JvmClassName, MutableSet<String>>()
for (dirtyClass in dirtyClasses) {
val facade = partToMultifileFacade.get(dirtyClass.internalName) ?: continue
val facade = partToMultifileFacade.get(dirtyClass) ?: continue
val facadeClassName = JvmClassName.byInternalName(facade)
val removedParts = facadesWithRemovedParts.getOrPut(facadeClassName) { hashSetOf() }
removedParts.add(dirtyClass.internalName)
}
for ((facade, removedParts) in facadesWithRemovedParts.entries) {
val allParts = multifileFacadeToParts[facade.internalName] ?: continue
val allParts = multifileFacadeToParts[facade] ?: continue
val notRemovedParts = allParts.filter { it !in removedParts }
if (notRemovedParts.isEmpty()) {
@@ -203,18 +223,17 @@ open class IncrementalJvmCache(
constantsMap.remove(it)
inlineFunctionsMap.remove(it)
internalNameToSource.remove(it.internalName)
javaSourcesProtoMap.remove(it, changesCollector)
}
removeAllFromClassStorage(dirtyClasses.map { it.fqNameForClassNameWithoutDollars })
removeAllFromClassStorage(dirtyClasses.map { it.fqNameForClassNameWithoutDollars }, changesCollector)
dirtyOutputClassesMap.clean()
}
override fun getObsoletePackageParts(): Collection<String> {
val obsoletePackageParts =
dirtyOutputClassesMap.getDirtyOutputClasses().filter { packagePartMap.isPackagePart(JvmClassName.byInternalName(it)) }
val obsoletePackageParts = dirtyOutputClassesMap.getDirtyOutputClasses().filter(packagePartMap::isPackagePart)
debugLog("Obsolete package parts: $obsoletePackageParts")
return obsoletePackageParts
return obsoletePackageParts.map { it.internalName }
}
override fun getPackagePartData(partInternalName: String): JvmPackagePartProto? {
@@ -234,8 +253,9 @@ open class IncrementalJvmCache(
}
override fun getStableMultifileFacadeParts(facadeInternalName: String): Collection<String>? {
val partNames = multifileFacadeToParts.get(facadeInternalName) ?: return null
return partNames.filter { !dirtyOutputClassesMap.isDirty(it) }
val jvmClassName = JvmClassName.byInternalName(facadeInternalName)
val partNames = multifileFacadeToParts[jvmClassName] ?: return null
return partNames.filter { !dirtyOutputClassesMap.isDirty(JvmClassName.byInternalName(it)) }
}
override fun getModuleMappingData(): ByteArray? {
@@ -287,7 +307,9 @@ open class IncrementalJvmCache(
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
changesCollector.collectProtoChanges(oldData = oldValue.toProtoData(className.packageFqName), newData = null)
if (key != MODULE_MAPPING_FILE_NAME) {
changesCollector.collectProtoChanges(oldData = oldValue.toProtoData(className.packageFqName), newData = null)
}
storage.remove(key)
}
@@ -296,6 +318,36 @@ open class IncrementalJvmCache(
}
}
private inner class JavaSourcesProtoMap(storageFile: File) : BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
storage[key] = newData
changesCollector.collectProtoChanges(
oldData?.toProtoData(), newData.toProtoData(),
collectAllMembersForNewClass = true
)
}
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
storage.remove(key)
changesCollector.collectProtoChanges(oldValue.toProtoData(), newData = null)
}
operator fun get(className: JvmClassName): SerializedJavaClass? =
storage[className.internalName]
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
override fun dumpValue(value: SerializedJavaClass): String =
java.lang.Long.toHexString(value.proto.toByteArray().md5())
}
// todo: reuse code with InlineFunctionsMap?
private inner class ConstantsMap(storageFile: File) : BasicStringMap<Map<String, Any>>(storageFile, ConstantsMapExternalizer) {
private fun getConstantsMap(bytes: ByteArray): Map<String, Any> {
@@ -358,13 +410,15 @@ open class IncrementalJvmCache(
}
private inner class MultifileClassFacadeMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
operator fun set(facadeName: JvmClassName, partNames: Collection<String>) {
storage[facadeName.internalName] = partNames
operator fun set(className: JvmClassName, partNames: Collection<String>) {
storage[className.internalName] = partNames
}
operator fun get(internalName: String): Collection<String>? = storage[internalName]
operator fun get(className: JvmClassName): Collection<String>? =
storage[className.internalName]
operator fun contains(internalName: String): Boolean = internalName in storage
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
@@ -378,9 +432,8 @@ open class IncrementalJvmCache(
storage[partName] = facadeName
}
fun get(partName: String): String? {
return storage.get(partName)
}
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
@@ -389,25 +442,6 @@ open class IncrementalJvmCache(
override fun dumpValue(value: String): String = value
}
inner class SourceToClassesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
fun clearOutputsForSource(sourceFile: File) {
remove(sourceFile.absolutePath)
}
fun add(sourceFile: File, className: JvmClassName) {
storage.append(sourceFile.absolutePath, className.internalName)
}
operator fun get(sourceFile: File): Collection<JvmClassName> =
storage[sourceFile.absolutePath].orEmpty().map { JvmClassName.byInternalName(it) }
override fun dumpValue(value: Collection<String>) = value.dumpCollection()
private fun remove(path: String) {
storage.remove(path)
}
}
inner class InternalNameToSourcesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, EnumeratorStringDescriptor(), PathCollectionExternalizer) {
operator fun set(internalName: String, sourceFiles: Iterable<File>) {
storage[internalName] = sourceFiles.map { it.canonicalPath }
@@ -429,24 +463,6 @@ open class IncrementalJvmCache(
addToClassStorage(proto, nameResolver, srcFile)
}
private inner class DirtyOutputClassesMap(storageFile: File) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: String) {
storage[className] = true
}
fun notDirty(className: String) {
storage.remove(className)
}
fun getDirtyOutputClasses(): Collection<String> =
storage.keys
fun isDirty(className: String): Boolean =
storage.contains(className)
override fun dumpValue(value: Boolean) = ""
}
private inner class InlineFunctionsMap(storageFile: File) : BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
private fun getInlineFunctionsMap(header: KotlinClassHeader, bytes: ByteArray): Map<String, Long> {
val inlineFunctions = inlineFunctionsJvmNames(header)

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.builtins.BuiltInSerializerProtocol
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.java.JavaVisibilities
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase
// It uses BuiltInSerializerProtocol for annotations serialization
class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSerializerProtocol) {
override fun serializeClass(descriptor: ClassDescriptor, proto: ProtoBuf.Class.Builder) {
super.serializeClass(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateClass, true)
}
}
override fun serializeConstructor(descriptor: ConstructorDescriptor, proto: ProtoBuf.Constructor.Builder) {
super.serializeConstructor(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateConstructor, true)
}
}
override fun serializeFunction(descriptor: FunctionDescriptor, proto: ProtoBuf.Function.Builder) {
super.serializeFunction(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateMethod, true)
}
if (descriptor.dispatchReceiverParameter == null) {
proto.setExtension(JavaClassProtoBuf.isStaticMethod, true)
}
}
override fun serializeProperty(descriptor: PropertyDescriptor, proto: ProtoBuf.Property.Builder) {
super.serializeProperty(descriptor, proto)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateField, true)
}
if (descriptor.dispatchReceiverParameter == null) {
proto.setExtension(JavaClassProtoBuf.isStaticField, true)
}
}
override fun shouldUseNormalizedVisibility() = true
override val customClassMembersProducer =
object : ClassMembersProducer {
override fun getCallableMembers(classDescriptor: ClassDescriptor) =
arrayListOf<CallableMemberDescriptor>().apply {
addAll(classDescriptor.unsubstitutedMemberScope.getSortedCallableDescriptors())
addAll(classDescriptor.staticScope.getSortedCallableDescriptors())
}
}
private fun MemberScope.getSortedCallableDescriptors(): Collection<CallableMemberDescriptor> =
DescriptorUtils.getAllDescriptors(this).filterIsInstance<CallableMemberDescriptor>()
.let { DescriptorSerializer.sort(it) }
}

View File

@@ -0,0 +1,161 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import com.intellij.psi.PsiJavaFile
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
import org.jetbrains.kotlin.load.java.JavaClassesTracker
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.util.PerformanceCounter
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.kotlin.utils.sure
import java.io.DataInput
import java.io.DataOutput
import java.io.File
val CONVERTING_JAVA_CLASSES_TO_PROTO = PerformanceCounter.create("Converting Java sources to proto")
class JavaClassesTrackerImpl(
private val cache: IncrementalJvmCache,
private val untrackedJavaClasses: Set<ClassId>
) : JavaClassesTracker {
private val classToSourceSerialized: MutableMap<ClassId, SerializedJavaClassWithSource> = hashMapOf()
val javaClassesUpdates: Collection<SerializedJavaClassWithSource>
get() = classToSourceSerialized.values
private val classDescriptors: MutableList<JavaClassDescriptor> = mutableListOf()
override fun reportClass(classDescriptor: JavaClassDescriptor) {
val classId = classDescriptor.classId!!
if (!cache.isJavaClassToTrack(classId) || classDescriptor.javaSourceFile == null) return
classDescriptors.add(classDescriptor)
}
override fun onCompletedAnalysis(module: ModuleDescriptor) {
for (classId in cache.getObsoleteJavaClasses() + untrackedJavaClasses) {
// Just force the loading obsolete classes
// We assume here that whenever an LazyJavaClassDescriptor instances is created
// it's being passed to JavaClassesTracker::reportClass
module.findClassAcrossModuleDependencies(classId)
}
for (classDescriptor in classDescriptors.toList()) {
val classId = classDescriptor.classId!!
if (cache.isJavaClassAlreadyInCache(classId) || classId in untrackedJavaClasses || classDescriptor.wasContentRequested()) {
assert(classId !in classToSourceSerialized) {
"Duplicated JavaClassDescriptor $classId reported to IC"
}
classToSourceSerialized[classId] = CONVERTING_JAVA_CLASSES_TO_PROTO.time {
classDescriptor.convertToProto()
}
}
}
}
private fun JavaClassDescriptor.wasContentRequested() =
this.safeAs<LazyJavaClassDescriptor>()?.wasScopeContentRequested() != false
}
private val JavaClassDescriptor.javaSourceFile: File?
get() = source.safeAs<PsiSourceElement>()
?.psi?.containingFile?.takeIf { it is PsiJavaFile }
?.virtualFile?.path?.let(::File)
fun JavaClassDescriptor.convertToProto(): SerializedJavaClassWithSource {
val file = javaSourceFile.sure { "convertToProto should only be called for source based classes" }
val extension = JavaClassesSerializerExtension()
val classProto = try {
DescriptorSerializer.create(this, extension).classProto(this).build()
} catch (e: Exception) {
throw IllegalStateException(
"Error during writing proto for descriptor: ${DescriptorRenderer.DEBUG_TEXT.render(this)}\n" +
"Source file: $file",
e
)
}
val (stringTable, qualifiedNameTable) = extension.stringTable.buildProto()
return SerializedJavaClassWithSource(file, SerializedJavaClass(classProto, stringTable, qualifiedNameTable))
}
class SerializedJavaClass(
val proto: ProtoBuf.Class,
val stringTable: ProtoBuf.StringTable,
val qualifiedNameTable: ProtoBuf.QualifiedNameTable
) {
val classId: ClassId
get() = NameResolverImpl(stringTable, qualifiedNameTable).getClassId(proto.fqName)
}
data class SerializedJavaClassWithSource(
val source: File,
val proto: SerializedJavaClass
)
fun SerializedJavaClass.toProtoData() = ClassProtoData(proto, NameResolverImpl(stringTable, qualifiedNameTable))
val JAVA_CLASS_PROTOBUF_REGISTRY =
ExtensionRegistryLite.newInstance()
.also(JavaClassProtoBuf::registerAllExtensions)
// Built-ins extensions are used for annotations' serialization
.also(BuiltInsProtoBuf::registerAllExtensions)
object JavaClassProtoMapValueExternalizer : DataExternalizer<SerializedJavaClass> {
override fun save(output: DataOutput, value: SerializedJavaClass) {
output.writeBytesWithSize(value.proto.toByteArray())
output.writeBytesWithSize(value.stringTable.toByteArray())
output.writeBytesWithSize(value.qualifiedNameTable.toByteArray())
}
private fun DataOutput.writeBytesWithSize(bytes: ByteArray) {
writeInt(bytes.size)
write(bytes)
}
private fun DataInput.readBytesWithSize(): ByteArray {
val bytesLength = readInt()
return ByteArray(bytesLength).also {
readFully(it, 0, bytesLength)
}
}
override fun read(input: DataInput): SerializedJavaClass {
val proto = ProtoBuf.Class.parseFrom(input.readBytesWithSize(), JAVA_CLASS_PROTOBUF_REGISTRY)
val stringTable = ProtoBuf.StringTable.parseFrom(input.readBytesWithSize(), JAVA_CLASS_PROTOBUF_REGISTRY)
val qualifiedNameTable = ProtoBuf.QualifiedNameTable.parseFrom(input.readBytesWithSize(), JAVA_CLASS_PROTOBUF_REGISTRY)
return SerializedJavaClass(proto, stringTable, qualifiedNameTable)
}
}

View File

@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
import java.io.IOException
import java.util.*
@@ -47,11 +48,16 @@ open class LookupStorage(targetDataDir: File) : BasicMapsOwner(targetDataDir) {
private var deletedCount: Int = 0
init {
if (countersFile.exists()) {
val lines = countersFile.readLines()
size = lines[0].toInt()
deletedCount = lines[1].toInt()
try {
if (countersFile.exists()) {
val lines = countersFile.readLines()
size = lines[0].toInt()
deletedCount = lines[1].toInt()
}
} catch (e: Exception) {
throw IOException("Could not read $countersFile", e)
}
}
@Synchronized

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
* Copyright 2010-2018 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,12 +16,15 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.metadata.js.JsProtoBuf
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
import org.jetbrains.kotlin.metadata.serialization.Interner
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
import org.jetbrains.kotlin.serialization.js.JsProtoBuf
import org.jetbrains.kotlin.utils.Interner
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
/** This file is generated by org.jetbrains.kotlin.generators.protobuf.GenerateProtoBufCompare. DO NOT MODIFY MANUALLY */
@@ -71,6 +74,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.packageFqName) != new.getExtension(JsProtoBuf.packageFqName)) return false
}
if (old.hasExtension(BuiltInsProtoBuf.packageFqName) != new.hasExtension(BuiltInsProtoBuf.packageFqName)) return false
if (old.hasExtension(BuiltInsProtoBuf.packageFqName)) {
if (old.getExtension(BuiltInsProtoBuf.packageFqName) != new.getExtension(BuiltInsProtoBuf.packageFqName)) return false
}
return true
}
enum class ProtoBufPackageKind {
@@ -81,7 +89,8 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
VERSION_REQUIREMENT_TABLE,
JVM_EXT_PACKAGE_MODULE_NAME,
JVM_EXT_PACKAGE_LOCAL_VARIABLE_LIST,
JS_EXT_PACKAGE_FQ_NAME
JS_EXT_PACKAGE_FQ_NAME,
BUILT_INS_EXT_PACKAGE_FQ_NAME
}
fun difference(old: ProtoBuf.Package, new: ProtoBuf.Package): EnumSet<ProtoBufPackageKind> {
@@ -122,6 +131,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.packageFqName) != new.getExtension(JsProtoBuf.packageFqName)) result.add(ProtoBufPackageKind.JS_EXT_PACKAGE_FQ_NAME)
}
if (old.hasExtension(BuiltInsProtoBuf.packageFqName) != new.hasExtension(BuiltInsProtoBuf.packageFqName)) result.add(ProtoBufPackageKind.BUILT_INS_EXT_PACKAGE_FQ_NAME)
if (old.hasExtension(BuiltInsProtoBuf.packageFqName)) {
if (old.getExtension(BuiltInsProtoBuf.packageFqName) != new.getExtension(BuiltInsProtoBuf.packageFqName)) result.add(ProtoBufPackageKind.BUILT_INS_EXT_PACKAGE_FQ_NAME)
}
return result
}
@@ -187,6 +201,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName) != new.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) return false
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) {
if (!checkStringEquals(old.getExtension(JvmProtoBuf.anonymousObjectOriginName), new.getExtension(JvmProtoBuf.anonymousObjectOriginName))) return false
}
if (old.getExtensionCount(JsProtoBuf.classAnnotation) != new.getExtensionCount(JsProtoBuf.classAnnotation)) {
return false
}
@@ -201,6 +220,20 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.classContainingFileId) != new.getExtension(JsProtoBuf.classContainingFileId)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.getExtension(JavaClassProtoBuf.isPackagePrivateClass)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.classAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.classAnnotation, i), new.getExtension(BuiltInsProtoBuf.classAnnotation, i))) return false
}
}
return true
}
enum class ProtoBufClassKind {
@@ -222,8 +255,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
VERSION_REQUIREMENT_TABLE,
JVM_EXT_CLASS_MODULE_NAME,
JVM_EXT_CLASS_LOCAL_VARIABLE_LIST,
JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME,
JS_EXT_CLASS_ANNOTATION_LIST,
JS_EXT_CLASS_CONTAINING_FILE_ID
JS_EXT_CLASS_CONTAINING_FILE_ID,
JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS,
BUILT_INS_EXT_CLASS_ANNOTATION_LIST
}
fun difference(old: ProtoBuf.Class, new: ProtoBuf.Class): EnumSet<ProtoBufClassKind> {
@@ -290,6 +326,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName) != new.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) result.add(ProtoBufClassKind.JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME)
if (old.hasExtension(JvmProtoBuf.anonymousObjectOriginName)) {
if (!checkStringEquals(old.getExtension(JvmProtoBuf.anonymousObjectOriginName), new.getExtension(JvmProtoBuf.anonymousObjectOriginName))) result.add(ProtoBufClassKind.JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME)
}
if (old.getExtensionCount(JsProtoBuf.classAnnotation) != new.getExtensionCount(JsProtoBuf.classAnnotation)) {
result.add(ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST)
}
@@ -304,6 +345,20 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.classContainingFileId) != new.getExtension(JsProtoBuf.classContainingFileId)) result.add(ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID)
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) result.add(ProtoBufClassKind.JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS)
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateClass) != new.getExtension(JavaClassProtoBuf.isPackagePrivateClass)) result.add(ProtoBufClassKind.JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS)
}
if (old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.classAnnotation)) {
result.add(ProtoBufClassKind.BUILT_INS_EXT_CLASS_ANNOTATION_LIST)
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.classAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.classAnnotation, i), new.getExtension(BuiltInsProtoBuf.classAnnotation, i))) result.add(ProtoBufClassKind.BUILT_INS_EXT_CLASS_ANNOTATION_LIST)
}
}
return result
}
@@ -364,6 +419,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEquals(old.getExtension(JvmProtoBuf.methodSignature), new.getExtension(JvmProtoBuf.methodSignature))) return false
}
if (old.hasExtension(JvmProtoBuf.lambdaClassOriginName) != new.hasExtension(JvmProtoBuf.lambdaClassOriginName)) return false
if (old.hasExtension(JvmProtoBuf.lambdaClassOriginName)) {
if (!checkStringEquals(old.getExtension(JvmProtoBuf.lambdaClassOriginName), new.getExtension(JvmProtoBuf.lambdaClassOriginName))) return false
}
if (old.getExtensionCount(JsProtoBuf.functionAnnotation) != new.getExtensionCount(JsProtoBuf.functionAnnotation)) {
return false
}
@@ -378,6 +438,25 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.functionContainingFileId) != new.getExtension(JsProtoBuf.functionContainingFileId)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isStaticMethod) != new.hasExtension(JavaClassProtoBuf.isStaticMethod)) return false
if (old.hasExtension(JavaClassProtoBuf.isStaticMethod)) {
if (old.getExtension(JavaClassProtoBuf.isStaticMethod) != new.getExtension(JavaClassProtoBuf.isStaticMethod)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateMethod) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateMethod)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateMethod)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateMethod) != new.getExtension(JavaClassProtoBuf.isPackagePrivateMethod)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.functionAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.functionAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.functionAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.functionAnnotation, i), new.getExtension(BuiltInsProtoBuf.functionAnnotation, i))) return false
}
}
return true
}
@@ -460,6 +539,30 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.getExtension(JsProtoBuf.propertyContainingFileId) != new.getExtension(JsProtoBuf.propertyContainingFileId)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isStaticField) != new.hasExtension(JavaClassProtoBuf.isStaticField)) return false
if (old.hasExtension(JavaClassProtoBuf.isStaticField)) {
if (old.getExtension(JavaClassProtoBuf.isStaticField) != new.getExtension(JavaClassProtoBuf.isStaticField)) return false
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateField) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateField)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateField)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateField) != new.getExtension(JavaClassProtoBuf.isPackagePrivateField)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.propertyAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.propertyAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.propertyAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.propertyAnnotation, i), new.getExtension(BuiltInsProtoBuf.propertyAnnotation, i))) return false
}
}
if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue) != new.hasExtension(BuiltInsProtoBuf.compileTimeValue)) return false
if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue)) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.compileTimeValue), new.getExtension(BuiltInsProtoBuf.compileTimeValue))) return false
}
return true
}
@@ -557,6 +660,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i), new.getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i))) return false
}
}
return true
}
@@ -651,6 +763,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.typeAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.typeAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.typeAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.typeAnnotation, i), new.getExtension(BuiltInsProtoBuf.typeAnnotation, i))) return false
}
}
return true
}
@@ -681,6 +802,20 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor) != new.hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) return false
if (old.hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) {
if (old.getExtension(JavaClassProtoBuf.isPackagePrivateConstructor) != new.getExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) return false
}
if (old.getExtensionCount(BuiltInsProtoBuf.constructorAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.constructorAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.constructorAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.constructorAnnotation, i), new.getExtension(BuiltInsProtoBuf.constructorAnnotation, i))) return false
}
}
return true
}
@@ -699,6 +834,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i), new.getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i))) return false
}
}
return true
}
@@ -747,6 +891,15 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.parameterAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.parameterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.parameterAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.parameterAnnotation, i), new.getExtension(BuiltInsProtoBuf.parameterAnnotation, i))) return false
}
}
return true
}
@@ -1335,6 +1488,10 @@ fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JsProtoBuf.packageFqName)
}
if (hasExtension(BuiltInsProtoBuf.packageFqName)) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.packageFqName)
}
return hashCode
}
@@ -1411,6 +1568,10 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.classLocalVariable, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JvmProtoBuf.anonymousObjectOriginName)) {
hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.anonymousObjectOriginName))
}
for(i in 0..getExtensionCount(JsProtoBuf.classAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
@@ -1419,6 +1580,14 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + getExtension(JsProtoBuf.classContainingFileId)
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateClass)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateClass).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.classAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1475,6 +1644,10 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.methodSignature).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JvmProtoBuf.lambdaClassOriginName)) {
hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.lambdaClassOriginName))
}
for(i in 0..getExtensionCount(JsProtoBuf.functionAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
@@ -1483,6 +1656,18 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JsProtoBuf.functionContainingFileId)
}
if (hasExtension(JavaClassProtoBuf.isStaticMethod)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isStaticMethod).hashCode()
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateMethod)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateMethod).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.functionAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1551,6 +1736,22 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyContainingFileId)
}
if (hasExtension(JavaClassProtoBuf.isStaticField)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isStaticField).hashCode()
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateField)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateField).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.propertyAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(BuiltInsProtoBuf.compileTimeValue)) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1649,6 +1850,10 @@ fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes:
hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1723,6 +1928,10 @@ fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.typeAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1749,6 +1958,14 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
hashCode = 31 * hashCode + getExtension(JsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) {
hashCode = 31 * hashCode + getExtension(JavaClassProtoBuf.isPackagePrivateConstructor).hashCode()
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.constructorAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1763,6 +1980,10 @@ fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
hashCode = 31 * hashCode + getExtension(JsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}
@@ -1807,6 +2028,10 @@ fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes:
hashCode = 31 * hashCode + getExtension(JsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.parameterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
return hashCode
}

View File

@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.modules.KotlinModuleXmlBuilder
import org.jetbrains.kotlin.modules.TargetId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
import org.jetbrains.kotlin.synthetic.SAM_LOOKUP_NAME
import java.io.File
import java.util.*
@@ -46,7 +47,10 @@ fun makeModuleFile(
builder.addModule(
name,
outputDir.absolutePath,
sourcesToCompile,
// important to transform file to absolute paths,
// otherwise compiler will use module file's parent as base path (a temporary file; see below)
// (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths)
sourcesToCompile.map { it.absoluteFile },
javaSourceRoots,
classpath,
null,
@@ -77,9 +81,10 @@ fun makeCompileServices(
}
fun updateIncrementalCache(
generatedFiles: Iterable<GeneratedFile>,
cache: IncrementalJvmCache,
changesCollector: ChangesCollector
generatedFiles: Iterable<GeneratedFile>,
cache: IncrementalJvmCache,
changesCollector: ChangesCollector,
javaChangesTracker: JavaClassesTrackerImpl?
) {
for (generatedFile in generatedFiles) {
when {
@@ -88,6 +93,11 @@ fun updateIncrementalCache(
}
}
javaChangesTracker?.javaClassesUpdates?.forEach {
(source, serializedJavaClass) ->
cache.saveJavaClassProto(source, serializedJavaClass, changesCollector)
}
cache.clearCacheForRemovedClasses(changesCollector)
}
@@ -109,8 +119,8 @@ data class DirtyData(
)
fun ChangesCollector.getDirtyData(
caches: Iterable<IncrementalCacheCommon>,
reporter: ICReporter
caches: Iterable<IncrementalCacheCommon>,
reporter: ICReporter
): DirtyData {
val dirtyLookupSymbols = HashSet<LookupSymbol>()
val dirtyClassesFqNames = HashSet<FqName>()
@@ -135,10 +145,10 @@ fun ChangesCollector.getDirtyData(
dirtyClassesFqNames.addAll(fqNames)
for (name in change.names) {
for (fqName in fqNames) {
dirtyLookupSymbols.add(LookupSymbol(name, fqName.asString()))
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(name, it.asString()) }
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(SAM_LOOKUP_NAME.asString(), it.asString()) }
}
}
@@ -163,17 +173,17 @@ fun mapLookupSymbolsToFiles(
}
fun mapClassesFqNamesToFiles(
caches: Iterable<IncrementalCacheCommon>,
classesFqNames: Iterable<FqName>,
reporter: ICReporter,
excludes: Set<File> = emptySet()
caches: Iterable<IncrementalCacheCommon>,
classesFqNames: Iterable<FqName>,
reporter: ICReporter,
excludes: Set<File> = emptySet()
): Set<File> {
val dirtyFiles = HashSet<File>()
for (cache in caches) {
for (dirtyClassFqName in classesFqNames) {
val srcFile = cache.getSourceFileIfClass(dirtyClassFqName)
if (srcFile == null || srcFile in excludes) continue
if (srcFile == null || srcFile in excludes || srcFile.isJavaFile()) continue
reporter.report { ("Class $dirtyClassFqName caused recompilation of: ${reporter.pathsAsString(srcFile)}") }
dirtyFiles.add(srcFile)

View File

@@ -0,0 +1,17 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.js
import org.jetbrains.kotlin.incremental.IncrementalJsCache
import java.io.File
class IncrementalDataProviderFromCache(private val cache: IncrementalJsCache) : IncrementalDataProvider {
override val headerMetadata: ByteArray
get() = cache.header
override val compiledPackageParts: Map<File, TranslationResultValue>
get() = cache.nonDirtyPackageParts()
}

View File

@@ -20,13 +20,13 @@ import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.Deserialization
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import java.util.*
data class Difference(
@@ -41,16 +41,15 @@ data class PackagePartProtoData(val proto: ProtoBuf.Package, val nameResolver: N
fun ProtoMapValue.toProtoData(packageFqName: FqName): ProtoData =
if (isPackageFacade) {
val packageData = JvmProtoBufUtil.readPackageDataFrom(bytes, strings)
PackagePartProtoData(packageData.packageProto, packageData.nameResolver, packageFqName)
}
else {
val classData = JvmProtoBufUtil.readClassDataFrom(bytes, strings)
ClassProtoData(classData.classProto, classData.nameResolver)
val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(bytes, strings)
PackagePartProtoData(packageProto, nameResolver, packageFqName)
} else {
val (nameResolver, classProto) = JvmProtoBufUtil.readClassDataFrom(bytes, strings)
ClassProtoData(classProto, nameResolver)
}
internal val MessageLite.isPrivate: Boolean
get() = Visibilities.isPrivate(Deserialization.visibility(
get() = Visibilities.isPrivate(ProtoEnumFlags.visibility(
when (this) {
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
@@ -244,6 +243,16 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.JVM_EXT_CLASS_LOCAL_VARIABLE_LIST -> {
// Not affected, local variables are not accessible outside of a file
}
ProtoBufClassKind.JAVA_EXT_IS_PACKAGE_PRIVATE_CLASS -> {
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.BUILT_INS_EXT_CLASS_ANNOTATION_LIST -> {
isClassAffected = true
}
ProtoCompareGenerated.ProtoBufClassKind.JVM_EXT_ANONYMOUS_OBJECT_ORIGIN_NAME -> {
// Not affected, this extension is not used in the compiler
}
}
}
@@ -289,6 +298,9 @@ class DifferenceCalculatorForPackageFacade(
ProtoBufPackageKind.JVM_EXT_PACKAGE_LOCAL_VARIABLE_LIST -> {
// Not affected, local variables are not accessible outside of a file
}
ProtoBufPackageKind.BUILT_INS_EXT_PACKAGE_FQ_NAME -> {
// Not affected
}
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.BooleanDataDescriptor
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
internal class DirtyClassesJvmNameMap(storageFile: File) : AbstractDirtyClassesMap<JvmClassName>(JvmClassNameTransformer, storageFile)
internal class DirtyClassesFqNameMap(storageFile: File) : AbstractDirtyClassesMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractDirtyClassesMap<Name>(
private val nameTransformer: NameTransformer<Name>,
storageFile: File
) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: Name) {
storage[nameTransformer.asString(className)] = true
}
fun notDirty(className: Name) {
storage.remove(nameTransformer.asString(className))
}
fun getDirtyOutputClasses(): Collection<Name> =
storage.keys.map { nameTransformer.asName(it) }
fun isDirty(className: Name): Boolean =
storage.contains(nameTransformer.asString(className))
override fun dumpValue(value: Boolean) = ""
}

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescriptor, IntExternalizer) {
@@ -34,5 +33,12 @@ internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescri
storage.remove(file)
}
fun toMap(): Map<File, Int> = storage.keys.keysToMap { storage[it]!! }
fun toMap(): Map<File, Int> {
val result = HashMap<File, Int>()
for (key in storage.keys) {
val value = storage[key] ?: continue
result[key] = value
}
return result
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.incremental.dumpCollection
import java.io.File
class FilesMap(storageFile: File)
: BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
operator fun set(sourceFile: File, outputFiles: Collection<File>) {
storage[sourceFile.absolutePath] = outputFiles.map { it.absolutePath }
}
operator fun get(sourceFile: File): Collection<File> =
storage[sourceFile.absolutePath].orEmpty().map(::File)
override fun dumpValue(value: Collection<String>) =
value.dumpCollection()
fun remove(file: File): Collection<File> =
get(file).also { storage.remove(file.absolutePath) }
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
internal interface NameTransformer<Name> {
fun asString(name: Name): String
fun asName(string: String): Name
fun asFqName(string: String): FqName
}
internal object FqNameTransformer : NameTransformer<FqName> {
override fun asString(name: FqName): String =
name.asString()
override fun asName(string: String): FqName =
FqName(string)
override fun asFqName(string: String): FqName =
asName(string)
}
internal object JvmClassNameTransformer : NameTransformer<JvmClassName> {
override fun asString(name: JvmClassName): String =
name.internalName
override fun asName(string: String): JvmClassName =
JvmClassName.byInternalName(string)
override fun asFqName(string: String): FqName =
asName(string).fqNameForClassNameWithoutDollars
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
internal class SourceToJvmNameMap(storageFile: File) : AbstractSourceToOutputMap<JvmClassName>(JvmClassNameTransformer, storageFile)
internal class SourceToFqNameMap(storageFile: File) : AbstractSourceToOutputMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractSourceToOutputMap<Name>(
private val nameTransformer: NameTransformer<Name>,
storageFile: File
) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
fun clearOutputsForSource(sourceFile: File) {
remove(sourceFile.absolutePath)
}
fun add(sourceFile: File, className: Name) {
storage.append(sourceFile.absolutePath, nameTransformer.asString(className))
}
fun contains(sourceFile: File): Boolean =
sourceFile.absolutePath in storage
operator fun get(sourceFile: File): Collection<Name> =
storage[sourceFile.absolutePath].orEmpty().map(nameTransformer::asName)
fun getFqNames(sourceFile: File): Collection<FqName> =
storage[sourceFile.absolutePath].orEmpty().map(nameTransformer::asFqName)
override fun dumpValue(value: Collection<String>) =
value.dumpCollection()
private fun remove(path: String) {
storage.remove(path)
}
}

View File

@@ -0,0 +1,118 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.proto
package org.jetbrains.kotlin.metadata.java;
public final class JavaClassProtoBuf {
private JavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite registry) {
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Class.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Constructor.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
static {
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
class BuildMetaInfoTest : TestCase() {
@Test
fun testJvmSerialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val actual = JvmBuildMetaInfo.serializeToString(info)
val expectedKeys = listOf(
"apiVersionString",
"bytecodeVersionMajor",
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
"metadataVersionMinor",
"metadataVersionPatch",
"multiplatformEnable",
"multiplatformVersion",
"ownVersion"
)
assertEquals(expectedKeys, actual.split("\r\n", "\n").map { line -> line.split("=").first() })
}
@Test
fun testJvmSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testJsSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testJvmEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo.create(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo.create(args2)
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
}
}

View File

@@ -1,75 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
class JvmBuildMetaInfoTest : TestCase() {
@Test
fun testSerialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo(args)
val actual = JvmBuildMetaInfo.serializeToString(info)
val expectedKeys = listOf(
"apiVersionString",
"bytecodeVersionMajor",
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
"metadataVersionMinor",
"metadataVersionPatch",
"multiplatformEnable",
"multiplatformVersion",
"ownVersion"
)
assertEquals(expectedKeys, actual.split("\r\n", "\n").map { line -> line.split("=").first() })
}
@Test
fun testSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo(args2)
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
}
}

View File

@@ -28,6 +28,9 @@ data class BuildLogFinder(
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
private const val SIMPLE_LOG = "build.log"
fun isJpsLogFile(file: File): Boolean =
file.name.let { it == SIMPLE_LOG || it == DATA_CONTAINER_LOG }
}
fun findBuildLog(dir: File): File? {

View File

@@ -17,24 +17,30 @@
package org.jetbrains.kotlin.incremental.testingUtils
import com.intellij.openapi.util.io.FileUtil
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
import org.jetbrains.kotlin.js.parser.sourcemaps.SourceMapError
import org.jetbrains.kotlin.js.parser.sourcemaps.SourceMapParser
import org.jetbrains.kotlin.js.parser.sourcemaps.SourceMapSuccess
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.metadata.DebugProtoBuf
import org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf
import org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding
import org.jetbrains.kotlin.protobuf.ExtensionRegistry
import org.jetbrains.kotlin.serialization.DebugProtoBuf
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.serialization.js.KotlinJavascriptSerializationUtil
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadata
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.util.TraceClassVisitor
import org.junit.Assert
import org.junit.Assert.assertNotNull
import java.io.ByteArrayInputStream
import java.io.File
import java.io.PrintWriter
import java.io.StringWriter
import java.io.*
import java.util.*
import java.util.zip.CRC32
import kotlin.comparisons.compareBy
import java.util.zip.GZIPInputStream
// Set this to true if you want to dump all bytecode (test will fail in this case)
private val DUMP_ALL = System.getProperty("comparison.dump.all") == "true"
@@ -163,6 +169,57 @@ private fun classFileToString(classFile: File): String {
return out.toString()
}
private fun metaJsToString(metaJsFile: File): String {
val out = StringWriter()
val metadataList = arrayListOf<KotlinJavascriptMetadata>()
KotlinJavascriptMetadataUtils.parseMetadata(metaJsFile.readText(), metadataList)
for (metadata in metadataList) {
val (header, content) = GZIPInputStream(ByteArrayInputStream(metadata.body)).use { stream ->
DebugJsProtoBuf.Header.parseDelimitedFrom(stream, JsSerializerProtocol.extensionRegistry) to
DebugJsProtoBuf.Library.parseFrom(stream, JsSerializerProtocol.extensionRegistry)
}
out.write("\n------ header -----\n$header")
out.write("\n------ library -----\n$content")
}
return out.toString()
}
private fun kjsmToString(kjsmFile: File): String {
val out = StringWriter()
val stream = DataInputStream(kjsmFile.inputStream())
// Read and skip the metadata version
repeat(stream.readInt()) { stream.readInt() }
val (header, content) =
DebugJsProtoBuf.Header.parseDelimitedFrom(stream, JsSerializerProtocol.extensionRegistry) to
DebugJsProtoBuf.Library.parseFrom(stream, JsSerializerProtocol.extensionRegistry)
out.write("\n------ header -----\n$header")
out.write("\n------ library -----\n$content")
return out.toString()
}
private fun sourceMapFileToString(sourceMapFile: File, generatedJsFile: File): String {
val sourceMapParseResult = SourceMapParser.parse(StringReader(sourceMapFile.readText()))
return when (sourceMapParseResult) {
is SourceMapSuccess -> {
val bytesOut = ByteArrayOutputStream()
PrintStream(bytesOut).use { printStream ->
sourceMapParseResult.value.debugVerbose(printStream, generatedJsFile)
}
bytesOut.toString()
}
is SourceMapError -> {
sourceMapParseResult.message
}
}
}
private fun getExtensionRegistry(): ExtensionRegistry {
val registry = ExtensionRegistry.newInstance()!!
DebugJvmProtoBuf.registerAllExtensions(registry)
@@ -174,6 +231,16 @@ private fun fileToStringRepresentation(file: File): String {
file.name.endsWith(".class") -> {
classFileToString(file)
}
file.name.endsWith(KotlinJavascriptMetadataUtils.META_JS_SUFFIX) -> {
metaJsToString(file)
}
file.name.endsWith(KotlinJavascriptSerializationUtil.CLASS_METADATA_FILE_EXTENSION) -> {
kjsmToString(file)
}
file.name.endsWith(".js.map") -> {
val generatedJsPath = file.canonicalPath.removeSuffix(".map")
sourceMapFileToString(file, File(generatedJsPath))
}
else -> {
file.readText()
}

View File

@@ -39,14 +39,14 @@ fun copyTestSources(testDataDir: File, sourceDestinationDir: File, filePrefix: S
if (!file.isFile) continue
val renamedFile =
if (filePrefix.isEmpty()) {
file
}
else {
File(sourceDestinationDir, file.name.removePrefix(filePrefix)).apply {
file.renameTo(this)
}
if (filePrefix.isEmpty()) {
file
}
else {
File(sourceDestinationDir, file.name.removePrefix(filePrefix)).apply {
file.renameTo(this)
}
}
mapping[renamedFile] = File(testDataDir, file.name)
}
@@ -55,10 +55,10 @@ fun copyTestSources(testDataDir: File, sourceDestinationDir: File, filePrefix: S
}
fun getModificationsToPerform(
testDataDir: File,
moduleNames: Collection<String>?,
allowNoFilesWithSuffixInTestData: Boolean,
touchPolicy: TouchPolicy
testDataDir: File,
moduleNames: Collection<String>?,
allowNoFilesWithSuffixInTestData: Boolean,
touchPolicy: TouchPolicy
): List<List<Modification>> {
fun getModificationsForIteration(newSuffix: String, touchSuffix: String, deleteSuffix: String): List<Modification> {
@@ -80,9 +80,9 @@ fun getModificationsToPerform(
}
val rules = mapOf<String, (String, File) -> Modification>(
newSuffix to { path, file -> ModifyContent(path, file) },
touchSuffix to { path, _ -> TouchFile(path, touchPolicy) },
deleteSuffix to { path, _ -> DeleteFile(path) }
newSuffix to { path, file -> ModifyContent(path, file) },
touchSuffix to { path, _ -> TouchFile(path, touchPolicy) },
deleteSuffix to { path, _ -> DeleteFile(path) }
)
val modifications = ArrayList<Modification>()
@@ -122,8 +122,8 @@ fun getModificationsToPerform(
}
else {
return (1..10)
.map { getModificationsForIteration(".new.$it", ".touch.$it", ".delete.$it") }
.filter { it.isNotEmpty() }
.map { getModificationsForIteration(".new.$it", ".touch.$it", ".delete.$it") }
.filter { it.isNotEmpty() }
}
}

View File

@@ -1,16 +1,16 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/deserialization/src/ext_options.debug.proto
// source: core/metadata/src/ext_options.debug.proto
package org.jetbrains.kotlin.serialization;
package org.jetbrains.kotlin.metadata;
public final class DebugExtOptionsProtoBuf {
private DebugExtOptionsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.stringIdInTable);
}
public static final int SKIP_IN_COMPARISON_FIELD_NUMBER = 50000;
/**
@@ -65,16 +65,16 @@ public final class DebugExtOptionsProtoBuf {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n0core/deserialization/src/ext_options.d" +
"ebug.proto\022\"org.jetbrains.kotlin.seriali" +
"zation\032 google/protobuf/descriptor.proto" +
":;\n\022skip_in_comparison\022\035.google.protobuf" +
".FieldOptions\030\320\206\003 \001(\010:9\n\020name_id_in_tabl" +
"e\022\035.google.protobuf.FieldOptions\030\321\206\003 \001(\010" +
":<\n\023fq_name_id_in_table\022\035.google.protobu" +
"f.FieldOptions\030\322\206\003 \001(\010:;\n\022string_id_in_t" +
"able\022\035.google.protobuf.FieldOptions\030\323\206\003 " +
"\001(\010B\031B\027DebugExtOptionsProtoBuf"
"\n)core/metadata/src/ext_options.debug.pr" +
"oto\022\035org.jetbrains.kotlin.metadata\032 goog" +
"le/protobuf/descriptor.proto:;\n\022skip_in_" +
"comparison\022\035.google.protobuf.FieldOption" +
"s\030\320\206\003 \001(\010:9\n\020name_id_in_table\022\035.google.p" +
"rotobuf.FieldOptions\030\321\206\003 \001(\010:<\n\023fq_name_" +
"id_in_table\022\035.google.protobuf.FieldOptio" +
"ns\030\322\206\003 \001(\010:;\n\022string_id_in_table\022\035.googl" +
"e.protobuf.FieldOptions\030\323\206\003 \001(\010B\031B\027Debug" +
"ExtOptionsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,200 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/metadata/src/builtins.debug.proto
package org.jetbrains.kotlin.metadata.builtins;
public final class DebugBuiltInsProtoBuf {
private DebugBuiltInsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.typeAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.typeParameterAnnotation);
}
public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Package { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Package,
java.lang.Integer> packageFqName = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> classAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> constructorAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int FUNCTION_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> functionAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertyAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value> compileTimeValue = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
public static final int ENUM_ENTRY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.EnumEntry { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.EnumEntry,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> enumEntryAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.ValueParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.ValueParameter,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> parameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Type { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> typeAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.TypeParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeParameter,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> typeParameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n&core/metadata/src/builtins.debug.proto" +
"\022&org.jetbrains.kotlin.metadata.builtins" +
"\032&core/metadata/src/metadata.debug.proto" +
":@\n\017package_fq_name\022&.org.jetbrains.kotl" +
"in.metadata.Package\030\227\001 \001(\005:j\n\020class_anno" +
"tation\022$.org.jetbrains.kotlin.metadata.C" +
"lass\030\226\001 \003(\0132).org.jetbrains.kotlin.metad" +
"ata.Annotation:v\n\026constructor_annotation" +
"\022*.org.jetbrains.kotlin.metadata.Constru" +
"ctor\030\226\001 \003(\0132).org.jetbrains.kotlin.metad",
"ata.Annotation:p\n\023function_annotation\022\'." +
"org.jetbrains.kotlin.metadata.Function\030\226" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:p\n\023property_annotation\022\'.org.je" +
"tbrains.kotlin.metadata.Property\030\226\001 \003(\0132" +
").org.jetbrains.kotlin.metadata.Annotati" +
"on:~\n\022compile_time_value\022\'.org.jetbrains" +
".kotlin.metadata.Property\030\227\001 \001(\01328.org.j" +
"etbrains.kotlin.metadata.Annotation.Argu" +
"ment.Value:s\n\025enum_entry_annotation\022(.or",
"g.jetbrains.kotlin.metadata.EnumEntry\030\226\001" +
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
"otation:w\n\024parameter_annotation\022-.org.je" +
"tbrains.kotlin.metadata.ValueParameter\030\226" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:h\n\017type_annotation\022#.org.jetbra" +
"ins.kotlin.metadata.Type\030\226\001 \003(\0132).org.je" +
"tbrains.kotlin.metadata.Annotation:{\n\031ty" +
"pe_parameter_annotation\022,.org.jetbrains." +
"kotlin.metadata.TypeParameter\030\226\001 \003(\0132).o",
"rg.jetbrains.kotlin.metadata.AnnotationB" +
"\027B\025DebugBuiltInsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(),
}, assigner);
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
functionAnnotation.internalInit(descriptor.getExtensions().get(3));
propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(6));
parameterAnnotation.internalInit(descriptor.getExtensions().get(7));
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(9));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,131 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.debug.proto
package org.jetbrains.kotlin.metadata.java;
public final class DebugJavaClassProtoBuf {
private DebugJavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n-build-common/src/java_descriptors.debu" +
"g.proto\022\"org.jetbrains.kotlin.metadata.j" +
"ava\032&core/metadata/src/metadata.debug.pr" +
"oto:B\n\020is_static_method\022\'.org.jetbrains." +
"kotlin.metadata.Function\030\350\007 \001(\010:K\n\031is_pa" +
"ckage_private_method\022\'.org.jetbrains.kot" +
"lin.metadata.Function\030\351\007 \001(\010:A\n\017is_stati" +
"c_field\022\'.org.jetbrains.kotlin.metadata." +
"Property\030\350\007 \001(\010:J\n\030is_package_private_fi" +
"eld\022\'.org.jetbrains.kotlin.metadata.Prop",
"erty\030\351\007 \001(\010:G\n\030is_package_private_class\022" +
"$.org.jetbrains.kotlin.metadata.Class\030\350\007" +
" \001(\010:S\n\036is_package_private_constructor\022*" +
".org.jetbrains.kotlin.metadata.Construct" +
"or\030\350\007 \001(\010B\030B\026DebugJavaClassProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(),
}, assigner);
isStaticMethod.internalInit(descriptor.getExtensions().get(0));
isPackagePrivateMethod.internalInit(descriptor.getExtensions().get(1));
isStaticField.internalInit(descriptor.getExtensions().get(2));
isPackagePrivateField.internalInit(descriptor.getExtensions().get(3));
isPackagePrivateClass.internalInit(descriptor.getExtensions().get(4));
isPackagePrivateConstructor.internalInit(descriptor.getExtensions().get(5));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,203 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/deserialization/src/builtins.debug.proto
package org.jetbrains.kotlin.serialization.builtins;
public final class DebugBuiltInsProtoBuf {
private DebugBuiltInsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeParameterAnnotation);
}
public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Package { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Package,
java.lang.Integer> packageFqName = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Class,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> classAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Constructor,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> constructorAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int FUNCTION_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Function,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> functionAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> propertyAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value> compileTimeValue = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
public static final int ENUM_ENTRY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.EnumEntry { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.EnumEntry,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> enumEntryAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.ValueParameter,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> parameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeParameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n-core/deserialization/src/builtins.debu" +
"g.proto\022+org.jetbrains.kotlin.serializat" +
"ion.builtins\0320core/deserialization/src/d" +
"escriptors.debug.proto:E\n\017package_fq_nam" +
"e\022+.org.jetbrains.kotlin.serialization.P" +
"ackage\030\227\001 \001(\005:t\n\020class_annotation\022).org." +
"jetbrains.kotlin.serialization.Class\030\226\001 " +
"\003(\0132..org.jetbrains.kotlin.serialization" +
".Annotation:\200\001\n\026constructor_annotation\022/" +
".org.jetbrains.kotlin.serialization.Cons",
"tructor\030\226\001 \003(\0132..org.jetbrains.kotlin.se" +
"rialization.Annotation:z\n\023function_annot" +
"ation\022,.org.jetbrains.kotlin.serializati" +
"on.Function\030\226\001 \003(\0132..org.jetbrains.kotli" +
"n.serialization.Annotation:z\n\023property_a" +
"nnotation\022,.org.jetbrains.kotlin.seriali" +
"zation.Property\030\226\001 \003(\0132..org.jetbrains.k" +
"otlin.serialization.Annotation:\210\001\n\022compi" +
"le_time_value\022,.org.jetbrains.kotlin.ser" +
"ialization.Property\030\227\001 \001(\0132=.org.jetbrai",
"ns.kotlin.serialization.Annotation.Argum" +
"ent.Value:}\n\025enum_entry_annotation\022-.org" +
".jetbrains.kotlin.serialization.EnumEntr" +
"y\030\226\001 \003(\0132..org.jetbrains.kotlin.serializ" +
"ation.Annotation:\201\001\n\024parameter_annotatio" +
"n\0222.org.jetbrains.kotlin.serialization.V" +
"alueParameter\030\226\001 \003(\0132..org.jetbrains.kot" +
"lin.serialization.Annotation:r\n\017type_ann" +
"otation\022(.org.jetbrains.kotlin.serializa" +
"tion.Type\030\226\001 \003(\0132..org.jetbrains.kotlin.",
"serialization.Annotation:\205\001\n\031type_parame" +
"ter_annotation\0221.org.jetbrains.kotlin.se" +
"rialization.TypeParameter\030\226\001 \003(\0132..org.j" +
"etbrains.kotlin.serialization.Annotation" +
"B\027B\025DebugBuiltInsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor(),
}, assigner);
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
functionAnnotation.internalInit(descriptor.getExtensions().get(3));
propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(6));
parameterAnnotation.internalInit(descriptor.getExtensions().get(7));
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(9));
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -227,6 +227,10 @@ public final class DebugJsAstProtoBuf {
* <code>COROUTINE_RECEIVER = 8;</code>
*/
COROUTINE_RECEIVER(7, 8),
/**
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
SET_COROUTINE_RESULT(8, 9),
;
/**
@@ -261,6 +265,10 @@ public final class DebugJsAstProtoBuf {
* <code>COROUTINE_RECEIVER = 8;</code>
*/
public static final int COROUTINE_RECEIVER_VALUE = 8;
/**
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
public static final int SET_COROUTINE_RESULT_VALUE = 9;
public final int getNumber() { return value; }
@@ -275,6 +283,7 @@ public final class DebugJsAstProtoBuf {
case 6: return COROUTINE_RESULT;
case 7: return COROUTINE_CONTROLLER;
case 8: return COROUTINE_RECEIVER;
case 9: return SET_COROUTINE_RESULT;
default: return null;
}
}
@@ -32573,6 +32582,28 @@ public final class DebugJsAstProtoBuf {
*/
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getStatementOrBuilder(
int index);
/**
* <code>optional int32 fileId = 3;</code>
*/
boolean hasFileId();
/**
* <code>optional int32 fileId = 3;</code>
*/
int getFileId();
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
boolean hasLocation();
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location getLocation();
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder getLocationOrBuilder();
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.js.ast.SwitchEntry}
@@ -32647,6 +32678,24 @@ public final class DebugJsAstProtoBuf {
statement_.add(input.readMessage(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.PARSER, extensionRegistry));
break;
}
case 24: {
bitField0_ |= 0x00000002;
fileId_ = input.readInt32();
break;
}
case 34: {
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
subBuilder = location_.toBuilder();
}
location_ = input.readMessage(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(location_);
location_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000004;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -32746,9 +32795,47 @@ public final class DebugJsAstProtoBuf {
return statement_.get(index);
}
public static final int FILEID_FIELD_NUMBER = 3;
private int fileId_;
/**
* <code>optional int32 fileId = 3;</code>
*/
public boolean hasFileId() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public int getFileId() {
return fileId_;
}
public static final int LOCATION_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location location_;
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public boolean hasLocation() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location getLocation() {
return location_;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder getLocationOrBuilder() {
return location_;
}
private void initFields() {
label_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Expression.getDefaultInstance();
statement_ = java.util.Collections.emptyList();
fileId_ = 0;
location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -32768,6 +32855,12 @@ public final class DebugJsAstProtoBuf {
return false;
}
}
if (hasLocation()) {
if (!getLocation().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -32781,6 +32874,12 @@ public final class DebugJsAstProtoBuf {
for (int i = 0; i < statement_.size(); i++) {
output.writeMessage(2, statement_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(3, fileId_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(4, location_);
}
getUnknownFields().writeTo(output);
}
@@ -32798,6 +32897,14 @@ public final class DebugJsAstProtoBuf {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, statement_.get(i));
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(3, fileId_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, location_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -32909,6 +33016,7 @@ public final class DebugJsAstProtoBuf {
if (org.jetbrains.kotlin.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getLabelFieldBuilder();
getStatementFieldBuilder();
getLocationFieldBuilder();
}
}
private static Builder create() {
@@ -32929,6 +33037,14 @@ public final class DebugJsAstProtoBuf {
} else {
statementBuilder_.clear();
}
fileId_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
if (locationBuilder_ == null) {
location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
} else {
locationBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -32974,6 +33090,18 @@ public final class DebugJsAstProtoBuf {
} else {
result.statement_ = statementBuilder_.build();
}
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000002;
}
result.fileId_ = fileId_;
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000004;
}
if (locationBuilder_ == null) {
result.location_ = location_;
} else {
result.location_ = locationBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -33019,6 +33147,12 @@ public final class DebugJsAstProtoBuf {
}
}
}
if (other.hasFileId()) {
setFileId(other.getFileId());
}
if (other.hasLocation()) {
mergeLocation(other.getLocation());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -33036,6 +33170,12 @@ public final class DebugJsAstProtoBuf {
return false;
}
}
if (hasLocation()) {
if (!getLocation().isInitialized()) {
return false;
}
}
return true;
}
@@ -33414,6 +33554,154 @@ public final class DebugJsAstProtoBuf {
return statementBuilder_;
}
private int fileId_ ;
/**
* <code>optional int32 fileId = 3;</code>
*/
public boolean hasFileId() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public int getFileId() {
return fileId_;
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public Builder setFileId(int value) {
bitField0_ |= 0x00000004;
fileId_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 fileId = 3;</code>
*/
public Builder clearFileId() {
bitField0_ = (bitField0_ & ~0x00000004);
fileId_ = 0;
onChanged();
return this;
}
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder> locationBuilder_;
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public boolean hasLocation() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location getLocation() {
if (locationBuilder_ == null) {
return location_;
} else {
return locationBuilder_.getMessage();
}
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder setLocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location value) {
if (locationBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
location_ = value;
onChanged();
} else {
locationBuilder_.setMessage(value);
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder setLocation(
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder builderForValue) {
if (locationBuilder_ == null) {
location_ = builderForValue.build();
onChanged();
} else {
locationBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder mergeLocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location value) {
if (locationBuilder_ == null) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
location_ != org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance()) {
location_ =
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.newBuilder(location_).mergeFrom(value).buildPartial();
} else {
location_ = value;
}
onChanged();
} else {
locationBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public Builder clearLocation() {
if (locationBuilder_ == null) {
location_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.getDefaultInstance();
onChanged();
} else {
locationBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder getLocationBuilder() {
bitField0_ |= 0x00000008;
onChanged();
return getLocationFieldBuilder().getBuilder();
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder getLocationOrBuilder() {
if (locationBuilder_ != null) {
return locationBuilder_.getMessageOrBuilder();
} else {
return location_;
}
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Location location = 4;</code>
*/
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder>
getLocationFieldBuilder() {
if (locationBuilder_ == null) {
locationBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Location.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.LocationOrBuilder>(
getLocation(),
getParentForChildren(),
isClean());
location_ = null;
}
return locationBuilder_;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.ast.SwitchEntry)
}
@@ -49465,100 +49753,103 @@ public final class DebugJsAstProtoBuf {
"tch\022I\n\nexpression\030\001 \002(\01325.org.jetbrains." +
"kotlin.serialization.js.ast.Expression\022E" +
"\n\005entry\030\002 \003(\01326.org.jetbrains.kotlin.ser" +
"ialization.js.ast.SwitchEntry\"\234\001\n\013Switch" +
"ialization.js.ast.SwitchEntry\"\363\001\n\013Switch" +
"Entry\022D\n\005label\030\001 \001(\01325.org.jetbrains.kot" +
"lin.serialization.js.ast.Expression\022G\n\ts",
"tatement\030\002 \003(\01324.org.jetbrains.kotlin.se" +
"rialization.js.ast.Statement\"\225\001\n\005While\022H" +
"\n\tcondition\030\001 \002(\01325.org.jetbrains.kotlin" +
".serialization.js.ast.Expression\022B\n\004body" +
"\030\002 \002(\01324.org.jetbrains.kotlin.serializat" +
"ion.js.ast.Statement\"\227\001\n\007DoWhile\022H\n\tcond" +
"ition\030\001 \002(\01325.org.jetbrains.kotlin.seria" +
"lization.js.ast.Expression\022B\n\004body\030\002 \002(\013" +
"24.org.jetbrains.kotlin.serialization.js" +
".ast.Statement\"\304\003\n\003For\022I\n\tvariables\030\001 \001(",
"\01324.org.jetbrains.kotlin.serialization.j" +
"s.ast.StatementH\000\022K\n\nexpression\030\002 \001(\01325." +
"org.jetbrains.kotlin.serialization.js.as" +
"t.ExpressionH\000\022E\n\005empty\030\003 \001(\01324.org.jetb" +
"rains.kotlin.serialization.js.ast.EmptyI" +
"nitH\000\022H\n\tcondition\030\004 \001(\01325.org.jetbrains" +
"rialization.js.ast.Statement\022\016\n\006fileId\030\003" +
" \001(\005\022E\n\010location\030\004 \001(\01323.org.jetbrains.k" +
"otlin.serialization.js.ast.Location\"\225\001\n\005" +
"While\022H\n\tcondition\030\001 \002(\01325.org.jetbrains" +
".kotlin.serialization.js.ast.Expression\022" +
"H\n\tincrement\030\005 \001(\01325.org.jetbrains.kotli" +
"n.serialization.js.ast.Expression\022B\n\004bod" +
"y\030\006 \002(\01324.org.jetbrains.kotlin.serializa",
"tion.js.ast.StatementB\006\n\004init\"\013\n\tEmptyIn" +
"it\"\374\001\n\005ForIn\022\020\n\006nameId\030\001 \001(\005H\000\022K\n\nexpres" +
"sion\030\002 \001(\01325.org.jetbrains.kotlin.serial" +
"ization.js.ast.ExpressionH\000\022G\n\010iterable\030" +
"\003 \002(\01325.org.jetbrains.kotlin.serializati" +
"on.js.ast.Expression\022B\n\004body\030\004 \002(\01324.org" +
".jetbrains.kotlin.serialization.js.ast.S" +
"tatementB\007\n\005value\"\337\001\n\003Try\022F\n\010tryBlock\030\001 " +
"\002(\01324.org.jetbrains.kotlin.serialization" +
".js.ast.Statement\022D\n\ncatchBlock\030\002 \001(\01320.",
"org.jetbrains.kotlin.serialization.js.as" +
"t.Catch\022J\n\014finallyBlock\030\003 \001(\01324.org.jetb" +
"rains.kotlin.serialization.js.ast.Statem" +
"ent\"\224\001\n\005Catch\022G\n\tparameter\030\001 \002(\01324.org.j" +
"etbrains.kotlin.serialization.js.ast.Par" +
"ameter\022B\n\004body\030\002 \002(\01324.org.jetbrains.kot" +
"lin.serialization.js.ast.Statement\"\007\n\005Em" +
"pty\"\327\005\n\010Fragment\022R\n\017imported_module\030\001 \003(" +
"\01329.org.jetbrains.kotlin.serialization.j" +
"s.ast.ImportedModule\022G\n\014import_entry\030\002 \003",
"(\01321.org.jetbrains.kotlin.serialization." +
"js.ast.Import\022Q\n\021declaration_block\030\003 \001(\013" +
"26.org.jetbrains.kotlin.serialization.js" +
".ast.GlobalBlock\022L\n\014export_block\030\004 \001(\01326" +
".org.jetbrains.kotlin.serialization.js.a" +
"st.GlobalBlock\022Q\n\021initializer_block\030\005 \001(" +
"\01326.org.jetbrains.kotlin.serialization.j" +
"s.ast.GlobalBlock\022L\n\014name_binding\030\006 \003(\0132" +
"6.org.jetbrains.kotlin.serialization.js." +
"ast.NameBinding\022J\n\013class_model\030\007 \003(\01325.o",
"B\n\004body\030\002 \002(\01324.org.jetbrains.kotlin.ser" +
"ialization.js.ast.Statement\"\227\001\n\007DoWhile\022" +
"H\n\tcondition\030\001 \002(\01325.org.jetbrains.kotli" +
"n.serialization.js.ast.Expression\022B\n\004bod",
"y\030\002 \002(\01324.org.jetbrains.kotlin.serializa" +
"tion.js.ast.Statement\"\304\003\n\003For\022I\n\tvariabl" +
"es\030\001 \001(\01324.org.jetbrains.kotlin.serializ" +
"ation.js.ast.StatementH\000\022K\n\nexpression\030\002" +
" \001(\01325.org.jetbrains.kotlin.serializatio" +
"n.js.ast.ExpressionH\000\022E\n\005empty\030\003 \001(\01324.o" +
"rg.jetbrains.kotlin.serialization.js.ast" +
".ClassModel\022P\n\021module_expression\030\010 \003(\01325" +
".org.jetbrains.kotlin.serialization.js.a" +
"st.Expression\022N\n\rinline_module\030\t \003(\01327.o" +
".EmptyInitH\000\022H\n\tcondition\030\004 \001(\01325.org.je" +
"tbrains.kotlin.serialization.js.ast.Expr" +
"ession\022H\n\tincrement\030\005 \001(\01325.org.jetbrain",
"s.kotlin.serialization.js.ast.Expression" +
"\022B\n\004body\030\006 \002(\01324.org.jetbrains.kotlin.se" +
"rialization.js.ast.StatementB\006\n\004init\"\013\n\t" +
"EmptyInit\"\374\001\n\005ForIn\022\020\n\006nameId\030\001 \001(\005H\000\022K\n" +
"\nexpression\030\002 \001(\01325.org.jetbrains.kotlin" +
".serialization.js.ast.ExpressionH\000\022G\n\010it" +
"erable\030\003 \002(\01325.org.jetbrains.kotlin.seri" +
"alization.js.ast.Expression\022B\n\004body\030\004 \002(" +
"\01324.org.jetbrains.kotlin.serialization.j" +
"s.ast.StatementB\007\n\005value\"\337\001\n\003Try\022F\n\010tryB",
"lock\030\001 \002(\01324.org.jetbrains.kotlin.serial" +
"ization.js.ast.Statement\022D\n\ncatchBlock\030\002" +
" \001(\01320.org.jetbrains.kotlin.serializatio" +
"n.js.ast.Catch\022J\n\014finallyBlock\030\003 \001(\01324.o" +
"rg.jetbrains.kotlin.serialization.js.ast" +
".InlineModule\"\224\001\n\016ImportedModule\022\030\n\020exte" +
"rnal_name_id\030\001 \002(\005\022\030\n\020internal_name_id\030\002" +
" \002(\005\022N\n\017plain_reference\030\003 \001(\01325.org.jetb" +
"rains.kotlin.serialization.js.ast.Expres" +
"sion\"i\n\006Import\022\024\n\014signature_id\030\001 \002(\005\022I\n\n",
"expression\030\002 \002(\01325.org.jetbrains.kotlin." +
"serialization.js.ast.Expression\"3\n\013NameB" +
"inding\022\024\n\014signature_id\030\001 \002(\005\022\016\n\006nameId\030\002" +
" \002(\005\"\247\001\n\nClassModel\022\017\n\007name_id\030\001 \002(\005\022\025\n\r" +
"super_name_id\030\002 \001(\005\022\031\n\021interface_name_id" +
"\030\004 \003(\005\022V\n\026post_declaration_block\030\003 \001(\01326" +
".org.jetbrains.kotlin.serialization.js.a" +
"st.GlobalBlock\";\n\014InlineModule\022\024\n\014signat" +
"ure_id\030\001 \002(\005\022\025\n\rexpression_id\030\002 \002(\005\"\034\n\013S" +
"tringTable\022\r\n\005entry\030\001 \003(\t\"K\n\tNameTable\022>",
"\n\005entry\030\001 \003(\0132/.org.jetbrains.kotlin.ser" +
"ialization.js.ast.Name\"\263\001\n\004Name\022\021\n\ttempo" +
"rary\030\001 \002(\010\022\022\n\nidentifier\030\002 \001(\005\022\025\n\rlocal_" +
"name_id\030\003 \001(\005\022\027\n\010imported\030\004 \001(\010:\005false\022T" +
"\n\020special_function\030\005 \001(\0162:.org.jetbrains" +
".kotlin.serialization.js.ast.SpecialFunc" +
"tion\"\346\001\n\005Chunk\022L\n\014string_table\030\001 \002(\01326.o" +
".Statement\"\224\001\n\005Catch\022G\n\tparameter\030\001 \002(\0132" +
"4.org.jetbrains.kotlin.serialization.js." +
"ast.Parameter\022B\n\004body\030\002 \002(\01324.org.jetbra" +
"ins.kotlin.serialization.js.ast.Statemen" +
"t\"\007\n\005Empty\"\327\005\n\010Fragment\022R\n\017imported_modu",
"le\030\001 \003(\01329.org.jetbrains.kotlin.serializ" +
"ation.js.ast.ImportedModule\022G\n\014import_en" +
"try\030\002 \003(\01321.org.jetbrains.kotlin.seriali" +
"zation.js.ast.Import\022Q\n\021declaration_bloc" +
"k\030\003 \001(\01326.org.jetbrains.kotlin.serializa" +
"tion.js.ast.GlobalBlock\022L\n\014export_block\030" +
"\004 \001(\01326.org.jetbrains.kotlin.serializati" +
"on.js.ast.GlobalBlock\022Q\n\021initializer_blo" +
"ck\030\005 \001(\01326.org.jetbrains.kotlin.serializ" +
"ation.js.ast.GlobalBlock\022L\n\014name_binding",
"\030\006 \003(\01326.org.jetbrains.kotlin.serializat" +
"ion.js.ast.NameBinding\022J\n\013class_model\030\007 " +
"\003(\01325.org.jetbrains.kotlin.serialization" +
".js.ast.ClassModel\022P\n\021module_expression\030" +
"\010 \003(\01325.org.jetbrains.kotlin.serializati" +
"on.js.ast.Expression\022N\n\rinline_module\030\t " +
"\003(\01327.org.jetbrains.kotlin.serialization" +
".js.ast.InlineModule\"\224\001\n\016ImportedModule\022" +
"\030\n\020external_name_id\030\001 \002(\005\022\030\n\020internal_na" +
"me_id\030\002 \002(\005\022N\n\017plain_reference\030\003 \001(\01325.o",
"rg.jetbrains.kotlin.serialization.js.ast" +
".StringTable\022H\n\nname_table\030\002 \002(\01324.org.j" +
"etbrains.kotlin.serialization.js.ast.Nam",
"eTable\022E\n\010fragment\030\003 \002(\01323.org.jetbrains" +
".kotlin.serialization.js.ast.Fragment*@\n" +
"\013SideEffects\022\021\n\rAFFECTS_STATE\020\001\022\024\n\020DEPEN" +
"DS_ON_STATE\020\002\022\010\n\004PURE\020\003*?\n\016InlineStrateg" +
"y\022\017\n\013AS_FUNCTION\020\000\022\014\n\010IN_PLACE\020\001\022\016\n\nNOT_" +
"INLINE\020\002*\275\001\n\017SpecialFunction\022\032\n\026DEFINE_I" +
"NLINE_FUNCTION\020\001\022\021\n\rWRAP_FUNCTION\020\002\022\021\n\rT" +
"O_BOXED_CHAR\020\003\022\016\n\nUNBOX_CHAR\020\004\022\020\n\014SUSPEN" +
"D_CALL\020\005\022\024\n\020COROUTINE_RESULT\020\006\022\030\n\024COROUT" +
"INE_CONTROLLER\020\007\022\026\n\022COROUTINE_RECEIVER\020\010",
"B\024B\022DebugJsAstProtoBuf"
".Expression\"i\n\006Import\022\024\n\014signature_id\030\001 " +
"\002(\005\022I\n\nexpression\030\002 \002(\01325.org.jetbrains." +
"kotlin.serialization.js.ast.Expression\"3" +
"\n\013NameBinding\022\024\n\014signature_id\030\001 \002(\005\022\016\n\006n" +
"ameId\030\002 \002(\005\"\247\001\n\nClassModel\022\017\n\007name_id\030\001 " +
"\002(\005\022\025\n\rsuper_name_id\030\002 \001(\005\022\031\n\021interface_" +
"name_id\030\004 \003(\005\022V\n\026post_declaration_block\030" +
"\003 \001(\01326.org.jetbrains.kotlin.serializati" +
"on.js.ast.GlobalBlock\";\n\014InlineModule\022\024\n",
"\014signature_id\030\001 \002(\005\022\025\n\rexpression_id\030\002 \002" +
"(\005\"\034\n\013StringTable\022\r\n\005entry\030\001 \003(\t\"K\n\tName" +
"Table\022>\n\005entry\030\001 \003(\0132/.org.jetbrains.kot" +
"lin.serialization.js.ast.Name\"\263\001\n\004Name\022\021" +
"\n\ttemporary\030\001 \002(\010\022\022\n\nidentifier\030\002 \001(\005\022\025\n" +
"\rlocal_name_id\030\003 \001(\005\022\027\n\010imported\030\004 \001(\010:\005" +
"false\022T\n\020special_function\030\005 \001(\0162:.org.je" +
"tbrains.kotlin.serialization.js.ast.Spec" +
"ialFunction\"\346\001\n\005Chunk\022L\n\014string_table\030\001 " +
"\002(\01326.org.jetbrains.kotlin.serialization",
".js.ast.StringTable\022H\n\nname_table\030\002 \002(\0132" +
"4.org.jetbrains.kotlin.serialization.js." +
"ast.NameTable\022E\n\010fragment\030\003 \002(\01323.org.je" +
"tbrains.kotlin.serialization.js.ast.Frag" +
"ment*@\n\013SideEffects\022\021\n\rAFFECTS_STATE\020\001\022\024" +
"\n\020DEPENDS_ON_STATE\020\002\022\010\n\004PURE\020\003*?\n\016Inline" +
"Strategy\022\017\n\013AS_FUNCTION\020\000\022\014\n\010IN_PLACE\020\001\022" +
"\016\n\nNOT_INLINE\020\002*\327\001\n\017SpecialFunction\022\032\n\026D" +
"EFINE_INLINE_FUNCTION\020\001\022\021\n\rWRAP_FUNCTION" +
"\020\002\022\021\n\rTO_BOXED_CHAR\020\003\022\016\n\nUNBOX_CHAR\020\004\022\020\n",
"\014SUSPEND_CALL\020\005\022\024\n\020COROUTINE_RESULT\020\006\022\030\n" +
"\024COROUTINE_CONTROLLER\020\007\022\026\n\022COROUTINE_REC" +
"EIVER\020\010\022\030\n\024SET_COROUTINE_RESULT\020\tB\024B\022Deb" +
"ugJsAstProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -49793,7 +50084,7 @@ public final class DebugJsAstProtoBuf {
internal_static_org_jetbrains_kotlin_serialization_js_ast_SwitchEntry_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_js_ast_SwitchEntry_descriptor,
new java.lang.String[] { "Label", "Statement", });
new java.lang.String[] { "Label", "Statement", "FileId", "Location", });
internal_static_org_jetbrains_kotlin_serialization_js_ast_While_descriptor =
getDescriptor().getMessageTypes().get(37);
internal_static_org_jetbrains_kotlin_serialization_js_ast_While_fieldAccessorTable = new

View File

@@ -1,46 +1,73 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import java.util.*
import java.io.File
import org.gradle.api.tasks.bundling.Jar
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
import proguard.gradle.ProGuardTask
buildscript {
extra["defaultSnapshotVersion"] = "1.2-SNAPSHOT"
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.0-dev-439", onlySuccessBootstrap = false))
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.70-dev-23", onlySuccessBootstrap = false))
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
val repos = listOfNotNull(
mirrorRepo,
bootstrapKotlinRepo,
"https://jcenter.bintray.com/",
"https://plugins.gradle.org/m2",
"http://repository.jetbrains.com/utils/")
"http://dl.bintray.com/kotlin/kotlinx",
"https://repo.gradle.org/gradle/ext-releases-local", // for native-platform
"https://jetbrains.bintray.com/intellij-third-party-dependencies", // for jflex
"https://dl.bintray.com/jetbrains/markdown" // for org.jetbrains:markdown
)
extra["repos"] = repos
extra["versions.shadow"] = "2.0.1"
repositories {
for (repo in repos) {
maven(url = repo)
}
}
// a workaround for kotlin compiler classpath in kotlin project: sometimes gradle substitutes
// kotlin-stdlib external dependency with local project :kotlin-stdlib in kotlinCompilerClasspath configuration.
// see also configureCompilerClasspath@
val bootstrapCompilerClasspath by configurations.creating
dependencies {
bootstrapCompilerClasspath(kotlinDep("compiler-embeddable", bootstrapKotlinVersion))
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
classpath(kotlinDep("gradle-plugin", bootstrapKotlinVersion))
classpath("net.sf.proguard:proguard-gradle:5.3.3")
}
}
plugins {
`build-scan`
idea
id("jps-compatible")
}
pill {
excludedDirs(
"out",
"buildSrc/build",
"buildSrc/prepare-deps/android-dx/build",
"buildSrc/prepare-deps/intellij-sdk/build"
)
}
buildScan {
setLicenseAgreementUrl("https://gradle.com/terms-of-service")
setLicenseAgree("yes")
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
setTermsOfServiceAgree("yes")
}
val configuredJdks: List<JdkId> =
@@ -71,38 +98,46 @@ repositories {
}
}
val cidrKotlinPlugin by configurations.creating
dependencies {
bootstrapCompileCfg(kotlinDep("compiler-embeddable", bootstrapKotlinVersion))
cidrKotlinPlugin(project(":prepare:cidr-plugin", "runtimeJar"))
}
val commonBuildDir = File(rootDir, "build")
val distDir = "$rootDir/dist"
val distKotlinHomeDir = "$distDir/kotlinc"
val distDir by extra("$rootDir/dist")
val distKotlinHomeDir by extra("$distDir/kotlinc")
val distLibDir = "$distKotlinHomeDir/lib"
val ideaPluginDir = "$distDir/artifacts/Kotlin"
val ideaUltimatePluginDir = "$distDir/artifacts/KotlinUltimate"
val commonLocalDataDir = "$rootDir/local"
val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin"
val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin"
val cidrPluginDir = "$distDir/artifacts/cidrPlugin/Kotlin"
extra["distDir"] = distDir
extra["distKotlinHomeDir"] = distKotlinHomeDir
// TODO: use "by extra()" syntax where possible
extra["distLibDir"] = project.file(distLibDir)
extra["libsDir"] = project.file(distLibDir)
extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
extra["ideaPluginDir"] = project.file(ideaPluginDir)
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
extra["cidrPluginDir"] = project.file(cidrPluginDir)
extra["isSonatypeRelease"] = false
Properties().apply {
load(File(rootDir, "resources", "kotlinManifest.properties").reader())
forEach {
val key = it.key
if (key != null && key is String)
extra[key] = it.value
}
}
extra["JDK_16"] = jdkPath("1.6")
extra["JDK_17"] = jdkPath("1.7")
extra["JDK_18"] = jdkPath("1.8")
extra["JDK_9"] = jdkPathIfFound("9")
extra["JDK_9"] = jdkPath("9")
extra["JDK_10"] = jdkPathIfFound("10")
rootProject.apply {
from(rootProject.file("versions.gradle.kts"))
from(rootProject.file("report.gradle.kts"))
}
extra["versions.protobuf-java"] = "2.6.1"
extra["versions.javax.inject"] = "1"
@@ -113,16 +148,56 @@ extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.android"] = "2.3.1"
extra["versions.kotlinx-coroutines-core"] = "0.20"
extra["versions.kotlinx-coroutines-jdk8"] = "0.20"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
extra["versions.robolectric"] = "3.1"
extra["versions.org.springframework"] = "4.2.0.RELEASE"
extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["ideaCoreSdkJars"] = arrayOf("annotations", "asm-all", "guava", "intellij-core", "jdom", "jna", "log4j", "picocontainer",
"snappy-in-java", "streamex", "trove4j", "xpp3-1.1.4-min", "xstream")
val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
val intellijUltimateEnabled = project.getBooleanProperty("intellijUltimateEnabled") ?: isTeamcityBuild
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
extra["intellijUltimateEnabled"] = intellijUltimateEnabled
extra["intellijSeparateSdks"] = intellijSeparateSdks
extra["IntellijCoreDependencies"] =
listOf("annotations",
"asm-all",
"guava",
"jdom",
"jna",
"log4j",
"picocontainer",
"snappy-in-java",
"streamex",
"trove4j")
extra["nativePlatformVariants"] =
listOf("windows-amd64",
"windows-i386",
"osx-amd64",
"osx-i386",
"linux-amd64",
"linux-i386",
"freebsd-amd64-libcpp",
"freebsd-amd64-libstdcpp",
"freebsd-i386-libcpp",
"freebsd-i386-libstdcpp")
extra["compilerModules"] = arrayOf(
":compiler:util",
":compiler:container",
":compiler:conditional-preprocessor",
":compiler:resolution",
":compiler:serialization",
":compiler:psi",
":compiler:frontend",
":compiler:frontend.java",
":compiler:frontend.script",
@@ -131,6 +206,8 @@ extra["compilerModules"] = arrayOf(
":compiler:daemon",
":compiler:ir.tree",
":compiler:ir.psi2ir",
":compiler:ir.backend.common",
":compiler:backend.js",
":compiler:backend-common",
":compiler:backend",
":compiler:plugin-api",
@@ -145,6 +222,8 @@ extra["compilerModules"] = arrayOf(
":js:js.dce",
":compiler",
":kotlin-build-common",
":core:metadata",
":core:metadata.jvm",
":core:descriptors",
":core:descriptors.jvm",
":core:deserialization",
@@ -162,6 +241,8 @@ val coreLibProjects = listOf(
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
":kotlin-test:kotlin-test-junit",
":kotlin-test:kotlin-test-junit5",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js",
":kotlin-reflect"
)
@@ -191,29 +272,11 @@ apply {
}
}
val importedAntTasksPrefix = "imported-ant-update-"
// TODO: check the reasons of import conflict with xerces
//ant.importBuild("$rootDir/update_dependencies.xml") { antTaskName -> importedAntTasksPrefix + antTaskName }
tasks.matching { task ->
task.name.startsWith(importedAntTasksPrefix)
}.forEach {
it.group = "Imported ant"
}
//task("update-dependencies") {
// dependsOn(tasks.getByName(importedAntTasksPrefix + "update"))
//}
fun Project.allprojectsRecursive(body: Project.() -> Unit) {
this.body()
this.subprojects { allprojectsRecursive(body) }
}
fun Task.listConfigurationContents(configName: String) {
doFirst {
println("$configName configuration files:\n${project.configurations[configName].allArtifacts.files.files.joinToString("\n ", " ")}")
project.configurations.findByName(configName)?.let {
println("$configName configuration files:\n${it.allArtifacts.files.files.joinToString("\n ", " ")}")
}
}
}
@@ -230,17 +293,22 @@ allprojects {
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
// - idea seems unable to exclude common builddir from indexing
// therefore it is disabled by default
// buildDir = File(commonBuildDir, project.name)
// buildDir = File(commonBuildDir, project.name)
val repos = rootProject.extra["repos"] as List<String>
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
intellijSdkRepo(project)
androidDxJarRepo(project)
for (repo in repos) {
maven(repo)
}
}
configureJvmProject(javaHome!!, jvmTarget!!)
val commonCompilerArgs = listOf("-Xallow-kotlin-package")
val commonCompilerArgs = listOfNotNull("-Xallow-kotlin-package", "-Xread-deserialized-contracts", "-Xprogressive".takeIf { hasProperty("test.progressive.mode") })
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
languageVersion = kotlinLanguageVersion
@@ -282,26 +350,63 @@ allprojects {
if (javaHome != defaultJavaHome || jvmTarget != defaultJvmTarget) {
configureJvmProject(javaHome!!, jvmTarget!!)
}
fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path
fun FileCollection.printClassPath(role: String) =
println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() } }")
try { javaPluginConvention() } catch (_: UnknownDomainObjectException) { null }?.let { javaConvention ->
task("printCompileClasspath") { doFirst { javaConvention.sourceSets["main"].compileClasspath.printClassPath("compile") } }
task("printRuntimeClasspath") { doFirst { javaConvention.sourceSets["main"].runtimeClasspath.printClassPath("runtime") } }
task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } }
task("printTestRuntimeClasspath") { doFirst { javaConvention.sourceSets["test"].runtimeClasspath.printClassPath("test runtime") } }
}
run configureCompilerClasspath@ {
val bootstrapCompilerClasspath by rootProject.buildscript.configurations
configurations.findByName("kotlinCompilerClasspath")?.let {
dependencies.add(it.name, files(bootstrapCompilerClasspath))
}
}
}
}
task<Copy>("dist") {
if (!isTeamcityBuild) {
gradle.taskGraph.whenReady {
for (project in allprojects) {
for (task in project.tasks) {
when (task) {
is AbstractKotlinCompile<*> -> task.incremental = true
is JavaCompile -> task.options.isIncremental = true
is org.gradle.jvm.tasks.Jar -> task.entryCompression = ZipEntryCompression.STORED
}
}
}
logger.warn("Local build profile is active (IC is on, proguard is off). Use -Pteamcity=true to reproduce TC build")
}
}
val dist by task<Copy> {
val childDistTasks = getTasksByName("dist", true) - this@task
dependsOn(childDistTasks)
into(distDir)
from(files("compiler/cli/bin")) { into("kotlinc/bin") }
from(files("license")) { into("kotlinc/license") }
}
val compilerCopyTask = task<Copy>("idea-plugin-copy-compiler") {
dependsOnTaskIfExistsRec("dist")
val copyCompilerToIdeaPlugin by task<Copy> {
dependsOn(dist)
into(ideaPluginDir)
from(distDir) { include("kotlinc/**") }
}
task<Copy>("ideaPlugin") {
dependsOn(compilerCopyTask)
dependsOnTaskIfExistsRec("idea-plugin")
shouldRunAfter(":prepare:idea-plugin:idea-plugin")
into("$ideaPluginDir/lib")
val ideaPlugin by task<Task> {
dependsOn(copyCompilerToIdeaPlugin)
val childIdeaPluginTasks = getTasksByName("ideaPlugin", true) - this@task
dependsOn(childIdeaPluginTasks)
}
tasks {
@@ -312,11 +417,19 @@ tasks {
}
}
"cleanupArtifacts" {
doLast {
delete(ideaPluginDir)
delete(ideaUltimatePluginDir)
delete(cidrPluginDir)
}
}
"coreLibsTest" {
(coreLibProjects + listOf(
":kotlin-stdlib:samples",
":kotlin-test:kotlin-test-js:kotlin-test-js-it",
":kotlinx-metadata-jvm",
":tools:binary-compatibility-validator"
)).forEach {
dependsOn(it + ":check")
@@ -342,6 +455,7 @@ tasks {
"jsCompilerTest" {
dependsOn(":js:js.tests:test")
dependsOn(":js:js.tests:runMocha")
}
"scriptingTest" {
@@ -355,6 +469,11 @@ tasks {
dependsOn("scriptingTest")
dependsOn(":kotlin-build-common:test")
dependsOn(":compiler:incremental-compilation-impl:test")
}
"toolsTest" {
dependsOn(":tools:kotlinp:test")
}
"examplesTest" {
@@ -366,6 +485,7 @@ tasks {
"distTest" {
dependsOn("compilerTest")
dependsOn("toolsTest")
dependsOn("gradlePluginTest")
dependsOn("examplesTest")
}
@@ -407,9 +527,11 @@ tasks {
"plugins-tests" {
dependsOn("dist")
dependsOn(":plugins:plugins-tests:test",
":kotlin-annotation-processing:test",
dependsOn(":kotlin-annotation-processing:test",
":kotlin-source-sections-compiler-plugin:test",
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
":plugins:uast-kotlin:test",
":kotlin-annotation-processing-gradle:test")
}
@@ -434,19 +556,105 @@ tasks {
"check" { dependsOn("test") }
}
fun CopySpec.setExecutablePermissions() {
filesMatching("**/bin/*") { mode = 0b111101101 }
filesMatching("**/bin/*.bat") { mode = 0b110100100 }
}
val zipCompiler by task<Zip> {
dependsOn(dist)
destinationDir = file(distDir)
archiveName = "kotlin-compiler-$kotlinVersion.zip"
from(distKotlinHomeDir)
into("kotlinc")
setExecutablePermissions()
doLast {
logger.lifecycle("Compiler artifacts packed to $archivePath")
}
}
val zipTestData by task<Zip> {
destinationDir = file(distDir)
archiveName = "kotlin-test-data.zip"
from("compiler/testData") { into("compiler") }
from("idea/testData") { into("ide") }
from("idea/idea-completion/testData") { into("ide/completion") }
doLast {
logger.lifecycle("Test data packed to $archivePath")
}
}
val zipPlugin by task<Zip> {
val src = when (project.findProperty("pluginArtifactDir") as String?) {
"Kotlin" -> ideaPluginDir
"KotlinUltimate" -> ideaUltimatePluginDir
null -> if (project.hasProperty("ultimate")) ideaUltimatePluginDir else ideaPluginDir
else -> error("Unsupported plugin artifact dir")
}
val destPath = project.findProperty("pluginZipPath") as String?
val dest = File(destPath ?: "$buildDir/kotlin-plugin.zip")
destinationDir = dest.parentFile
archiveName = dest.name
doFirst {
if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property")
}
from(src)
into("Kotlin")
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to $archivePath")
}
}
val cidrPlugin by task<Copy> {
dependsOn(ideaPlugin)
into(cidrPluginDir)
from(ideaPluginDir) {
exclude("lib/kotlin-plugin.jar")
exclude("lib/android-lint.jar")
exclude("lib/android-ide.jar")
exclude("lib/android-output-parser-ide.jar")
exclude("lib/android-extensions-ide.jar")
exclude("lib/android-extensions-compiler.jar")
exclude("lib/kapt3-idea.jar")
exclude("lib/jps-ide.jar")
exclude("lib/jps/**")
exclude("kotlinc/**")
exclude("lib/maven-ide.jar")
}
from(cidrKotlinPlugin) { into("lib") }
}
val zipCidrPlugin by task<Zip> {
val destPath = project.findProperty("pluginZipPath") as String?
?: "$distDir/artifacts/kotlin-plugin-$kotlinVersion-CIDR.zip"
val destFile = File(destPath)
destinationDir = destFile.parentFile
archiveName = destFile.name
from(cidrPlugin)
into("Kotlin")
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to $archivePath")
}
}
configure<IdeaModel> {
module {
excludeDirs = files(
project.buildDir,
commonLocalDataDir,
".gradle",
"dependencies",
"dist",
"ideaSDK/bin",
"ideaSDK/androidSDK",
"ideaSDK/config",
"ideaSDK/config-idea",
"ideaSDK/system",
"ideaSDK/system-idea"
"dist"
).toSet()
}
}
@@ -462,10 +670,12 @@ fun jdkPath(version: String): String = jdkPathIfFound(version)
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
tasks.withType<JavaCompile> {
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
if (name != "compileJava9Java") {
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
}
}
tasks.withType<KotlinCompile> {
@@ -477,3 +687,41 @@ fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
executable = File(javaHome, "bin/java").canonicalPath
}
}
tasks.create("findShadowJarsInClasspath").doLast {
fun Collection<File>.printSorted(indent: String = " ") {
sortedBy { it.path }.forEach { println(indent + it.relativeTo(rootProject.projectDir)) }
}
val shadowJars = hashSetOf<File>()
for (project in rootProject.allprojects) {
for (task in project.tasks) {
when (task) {
is ShadowJar -> {
shadowJars.add(fileFrom(task.archivePath))
}
is ProGuardTask -> {
shadowJars.addAll(task.outputs.files.toList())
}
}
}
}
println("Shadow jars:")
shadowJars.printSorted()
fun Project.checkConfig(configName: String) {
val config = configurations.findByName(configName) ?: return
val shadowJarsInConfig = config.resolvedConfiguration.files.filter { it in shadowJars }
if (shadowJarsInConfig.isNotEmpty()) {
println()
println("Project $project contains shadow jars in configuration '$configName':")
shadowJarsInConfig.printSorted()
}
}
for (project in rootProject.allprojects) {
project.checkConfig("compileClasspath")
project.checkConfig("testCompileClasspath")
}
}

1050
build.xml

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,8 @@
buildscript {
val buildSrcKotlinVersion: String by extra(findProperty("buildSrc.kotlin.version")?.toString() ?: embeddedKotlinVersion)
val buildSrcKotlinRepo: String? by extra(findProperty("buildSrc.kotlin.repo") as String?)
extra["versions.shadow"] = "2.0.1"
extra["versions.shadow"] = "2.0.2"
extra["versions.native-platform"] = "0.14"
repositories {
buildSrcKotlinRepo?.let {
@@ -27,23 +28,58 @@ apply {
plugins {
`kotlin-dsl`
`java-gradle-plugin`
}
gradlePlugin {
(plugins) {
"pill-configurable" {
id = "pill-configurable"
implementationClass = "org.jetbrains.kotlin.pill.PillConfigurablePlugin"
}
"jps-compatible" {
id = "jps-compatible"
implementationClass = "org.jetbrains.kotlin.pill.JpsCompatiblePlugin"
}
}
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {
val v = it.toString()
if (v.isBlank()) true
else v.toBoolean()
}
rootProject.apply {
from(rootProject.file("../versions.gradle.kts"))
}
val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
val intellijUltimateEnabled by extra(project.getBooleanProperty("intellijUltimateEnabled") ?: isTeamcityBuild)
val intellijSeparateSdks by extra(project.getBooleanProperty("intellijSeparateSdks") ?: false)
extra["intellijRepo"] = "https://www.jetbrains.com/intellij-repository"
extra["intellijReleaseType"] = "releases" // or "snapshots"
extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build.custom.deps"
repositories {
extra["buildSrcKotlinRepo"]?.let {
maven(url = it)
}
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev") // for dex-method-list
// maven { setUrl("https://repo.gradle.org/gradle/libs-releases-local") }
maven(url = "https://repo.gradle.org/gradle/ext-releases-local") // for native-platform
jcenter()
}
dependencies {
compile(files("../dependencies/native-platform-uberjar.jar"))
compile("com.jakewharton.dex:dex-method-list:2.0.0-alpha")
// compile("net.rubygrapefruit:native-platform:0.14")
compile("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
compile("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
compile("net.rubygrapefruit:native-platform-windows-i386:${property("versions.native-platform")}")
compile("com.jakewharton.dex:dex-method-list:3.0.0")
// TODO: adding the dep to the plugin breaks the build unexpectedly, resolve and uncomment
// compile("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["bootstrap_kotlin_version"]}")
// Shadow plugin is used in many projects of the main build. Once it's no longer used in buildSrc, please move this dependency to the root project
compile("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
compile("org.ow2.asm:asm-all:6.0_BETA")
}
@@ -54,3 +90,5 @@ samWithReceiver {
fun Project.`samWithReceiver`(configure: org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverExtension.() -> Unit): Unit =
extensions.configure("samWithReceiver", configure)
tasks["build"].dependsOn(":prepare-deps:android-dx:build", ":prepare-deps:intellij-sdk:build")

View File

@@ -1,7 +1,7 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Xmx1200m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50

View File

@@ -0,0 +1,9 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50
intellijUltimateEnabled=false

View File

@@ -0,0 +1,9 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50
intellijUltimateEnabled=false

View File

@@ -0,0 +1,109 @@
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyConfiguration
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity
import org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator
import java.io.File
import org.gradle.internal.os.OperatingSystem
import org.gradle.jvm.tasks.Jar
val toolsOs by lazy {
when {
OperatingSystem.current().isWindows -> "windows"
OperatingSystem.current().isMacOsX -> "macosx"
OperatingSystem.current().isLinux -> "linux"
else -> {
logger.error("Unknown operating system for android tools: ${OperatingSystem.current().name}")
""
}
}
}
val buildToolsVersion = rootProject.extra["versions.androidBuildTools"] as String
val dxSourcesVersion = rootProject.extra["versions.androidDxSources"] as String
repositories {
ivy {
artifactPattern("https://dl-ssl.google.com/android/repository/[artifact]_[revision](-[classifier]).[ext]")
artifactPattern("https://android.googlesource.com/platform/dalvik/+archive/android-$dxSourcesVersion/[artifact].[ext]")
metadataSources {
artifact()
}
}
}
val customDepsRepoDir = File(buildDir, "repo")
val customDepsOrg: String by rootProject.extra
val dxModuleName = "android-dx"
val dxRevision = buildToolsVersion
val dxRepoModuleDir = File(customDepsRepoDir, "$customDepsOrg/$dxModuleName/$dxRevision")
val buildToolsZip by configurations.creating
val dxSourcesTar by configurations.creating
dependencies {
buildToolsZip("google:build-tools:$buildToolsVersion:$toolsOs@zip")
dxSourcesTar("google:dx:0@tar.gz")
}
val unzipDxJar by tasks.creating {
dependsOn(buildToolsZip)
inputs.files(buildToolsZip)
outputs.files(File(dxRepoModuleDir, "dx.jar"))
doFirst {
project.copy {
from(zipTree(buildToolsZip.singleFile).files)
include("**/dx.jar")
into(dxRepoModuleDir)
}
}
}
val dxSourcesTargetDir = File(buildDir, "dx_src")
val untarDxSources by tasks.creating {
dependsOn(dxSourcesTar)
inputs.files(dxSourcesTar)
outputs.dir(dxSourcesTargetDir)
doFirst {
project.copy {
from(tarTree(dxSourcesTar.singleFile))
include("src/**")
includeEmptyDirs = false
into(dxSourcesTargetDir)
}
}
}
val prepareDxSourcesJar by tasks.creating(Jar::class) {
dependsOn(untarDxSources)
from("$dxSourcesTargetDir/src")
destinationDir = dxRepoModuleDir
baseName = "dx"
classifier = "sources"
}
val prepareIvyXml by tasks.creating {
dependsOn(unzipDxJar, prepareDxSourcesJar)
inputs.files(unzipDxJar, prepareDxSourcesJar)
val ivyFile = File(dxRepoModuleDir, "$dxModuleName.ivy.xml")
outputs.file(ivyFile)
doLast {
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, dxModuleName, dxRevision))) {
addConfiguration(DefaultIvyConfiguration("default"))
addConfiguration(DefaultIvyConfiguration("sources"))
addArtifact(DefaultIvyArtifact(File(dxRepoModuleDir, "dx.jar"), "dx", "jar", "jar", null).also { it.conf = "default" })
addArtifact(DefaultIvyArtifact(File(dxRepoModuleDir, "dx-sources.jar"), "dx", "jar", "sources", "sources").also { it.conf = "sources" })
writeTo(ivyFile)
}
}
}
val build by tasks.creating {
dependsOn(unzipDxJar, prepareDxSourcesJar, prepareIvyXml)
}
val clean by tasks.creating(Delete::class) {
delete(dxRepoModuleDir)
delete(buildDir)
}

View File

@@ -0,0 +1,287 @@
@file:Suppress("PropertyName")
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyConfiguration
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity
import org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator
import java.io.File
import org.gradle.internal.os.OperatingSystem
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
}
}
val intellijUltimateEnabled: Boolean by rootProject.extra
val intellijRepo: String by rootProject.extra
val intellijReleaseType: String by rootProject.extra
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
val androidStudioRelease = rootProject.findProperty("versions.androidStudioRelease") as String?
val androidStudioBuild = rootProject.findProperty("versions.androidStudioBuild") as String?
val intellijSeparateSdks: Boolean by rootProject.extra
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
val installIntellijUltimate = intellijUltimateEnabled
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
if (intellijVersionDelimiterIndex == -1) {
error("Invalid IDEA version $intellijVersion")
}
val platformBaseVersion = intellijVersion.substring(0, intellijVersionDelimiterIndex)
logger.info("intellijUltimateEnabled: $intellijUltimateEnabled")
logger.info("intellijVersion: $intellijVersion")
logger.info("androidStudioRelease: $androidStudioRelease")
logger.info("androidStudioBuild: $androidStudioBuild")
logger.info("intellijSeparateSdks: $intellijSeparateSdks")
logger.info("installIntellijCommunity: $installIntellijCommunity")
logger.info("installIntellijUltimate: $installIntellijUltimate")
val studioOs by lazy {
when {
OperatingSystem.current().isWindows -> "windows"
OperatingSystem.current().isMacOsX -> "mac"
OperatingSystem.current().isLinux -> "linux"
else -> {
logger.error("Unknown operating system for android tools: ${OperatingSystem.current().name}")
""
}
}
}
repositories {
if (androidStudioRelease != null) {
ivy {
artifactPattern("https://dl.google.com/dl/android/studio/ide-zips/$androidStudioRelease/[artifact]-[revision]-$studioOs.zip")
metadataSources {
artifact()
}
}
}
maven { setUrl("$intellijRepo/$intellijReleaseType") }
maven { setUrl("https://plugins.jetbrains.com/maven") }
ivy {
artifactPattern("https://raw.github.com/JetBrains/intellij-community/[revision]/lib/src/[artifact].zip")
metadataSources {
artifact()
}
}
}
val intellij by configurations.creating
val intellijUltimate by configurations.creating
val sources by configurations.creating
val `asm-shaded-sources` by configurations.creating
val `jps-standalone` by configurations.creating
val `jps-build-test` by configurations.creating
val `intellij-core` by configurations.creating
val `plugins-NodeJS` by configurations.creating
val customDepsRepoDir = File(buildDir, "repo")
val customDepsOrg: String by rootProject.extra
val customDepsRevision = intellijVersion
val customDepsRepoModulesDir = File(customDepsRepoDir, "$customDepsOrg/$customDepsRevision")
val repoDir = customDepsRepoModulesDir
dependencies {
if (androidStudioRelease != null) {
intellij("google:android-studio-ide:$androidStudioBuild")
} else {
if (installIntellijCommunity) {
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
}
if (installIntellijUltimate) {
intellijUltimate("com.jetbrains.intellij.idea:ideaIU:$intellijVersion")
}
}
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
if (platformBaseVersion == "182") {
// There is no asm sources for 182 yet
`asm-shaded-sources`("asmsources:asm-src:181@zip")
} else {
`asm-shaded-sources`("asmsources:asm-src:$platformBaseVersion@zip")
}
`jps-standalone`("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
`jps-build-test`("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion")
`intellij-core`("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
if (intellijUltimateEnabled) {
`plugins-NodeJS`("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
}
}
fun Task.configureExtractFromConfigurationTask(sourceConfig: Configuration,
pathRemap: (String) -> String = { it },
extractor: (Configuration) -> Any) {
dependsOn(sourceConfig)
inputs.files(sourceConfig)
val targetDir = File(repoDir, sourceConfig.name)
outputs.dirs(targetDir)
doFirst {
project.copy {
from(extractor(sourceConfig))
into(targetDir)
eachFile {
path = pathRemap(path)
}
}
}
}
fun removePathPrefix(path: String): String {
if (androidStudioRelease == null) return path
val slashes = if (studioOs == "mac") 2 else 1
var result = path
repeat(slashes) {
result = result.substringAfter('/')
}
return result
}
val unzipIntellijSdk by tasks.creating {
configureExtractFromConfigurationTask(intellij, pathRemap = { removePathPrefix(it) }) {
zipTree(it.singleFile).matching {
exclude("**/plugins/Kotlin/**")
}
}
}
val unzipIntellijUltimateSdk by tasks.creating {
configureExtractFromConfigurationTask(intellijUltimate) {
zipTree(it.singleFile).matching {
exclude("plugins/Kotlin/**")
}
}
}
val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(`intellij-core`) { zipTree(it.singleFile) } }
val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(it.singleFile) } }
val copyAsmShadedSources by tasks.creating(Copy::class.java) {
from(`asm-shaded-sources`)
rename(".zip", ".jar")
destinationDir = File(repoDir, `asm-shaded-sources`.name)
}
val copyIntellijSdkSources by tasks.creating(ShadowJar::class.java) {
from(copyAsmShadedSources)
from(sources)
baseName = "ideaIC"
version = intellijVersion
classifier = "sources"
destinationDir = File(repoDir, sources.name)
}
val copyJpsBuildTest by tasks.creating { configureExtractFromConfigurationTask(`jps-build-test`) { it.singleFile } }
val unzipNodeJSPlugin by tasks.creating { configureExtractFromConfigurationTask(`plugins-NodeJS`) { zipTree(it.singleFile) } }
fun writeIvyXml(moduleName: String, fileName: String, jarFiles: FileCollection, baseDir: File, sourcesJar: File?) {
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, moduleName, intellijVersion))) {
addConfiguration(DefaultIvyConfiguration("default"))
addConfiguration(DefaultIvyConfiguration("sources"))
jarFiles.asFileTree.files.forEach {
if (it.isFile && it.extension == "jar") {
val relativeName = it.toRelativeString(baseDir).removeSuffix(".jar")
addArtifact(DefaultIvyArtifact(it, relativeName, "jar", "jar", null).also { it.conf = "default" })
}
}
if (sourcesJar != null) {
val sourcesArtifactName = sourcesJar.name.removeSuffix(".jar").substringBefore("-")
addArtifact(DefaultIvyArtifact(sourcesJar, sourcesArtifactName, "jar", "sources", "sources").also { it.conf = "sources" })
}
writeTo(File(customDepsRepoModulesDir, "$fileName.ivy.xml"))
}
}
val prepareIvyXmls by tasks.creating {
dependsOn(unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest, copyAsmShadedSources)
val intellijSdkDir = File(repoDir, intellij.name)
val intellijUltimateSdkDir = File(repoDir, intellijUltimate.name)
if (installIntellijCommunity) {
dependsOn(unzipIntellijSdk)
inputs.dir(intellijSdkDir)
outputs.file(File(repoDir, "${intellij.name}.ivy.xml"))
}
if (installIntellijUltimate) {
dependsOn(unzipIntellijUltimateSdk)
inputs.dir(intellijUltimateSdkDir)
outputs.file(File(repoDir, "${intellijUltimate.name}.ivy.xml"))
}
val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`, `asm-shaded-sources`)
flatDeps.forEach {
inputs.dir(File(repoDir, it.name))
outputs.file(File(repoDir, "${it.name}.ivy.xml"))
}
inputs.dir(File(repoDir, sources.name))
if (intellijUltimateEnabled) {
dependsOn(unzipNodeJSPlugin)
inputs.dir(File(repoDir, `plugins-NodeJS`.name))
outputs.file(File(repoDir, "${`plugins-NodeJS`.name}.ivy.xml"))
}
doFirst {
val sourcesFile = if (sources.isEmpty) null else File(repoDir, "${sources.name}/${sources.singleFile.name}")
if (installIntellijCommunity) {
val libDir = File(intellijSdkDir, "lib")
writeIvyXml(intellij.name,
intellij.name,
fileTree(libDir).filter {
it.parentFile == libDir && !it.name.startsWith("kotlin-")
},
libDir,
sourcesFile)
File(intellijSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
writeIvyXml(it.name, "intellij.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
}
}
if (installIntellijUltimate) {
val libDir = File(intellijUltimateSdkDir, "lib")
writeIvyXml(intellij.name, // important! the module name should be "intellij"
intellijUltimate.name,
fileTree(libDir).filter {
it.parentFile == libDir && !it.name.startsWith("kotlin-")
},
libDir,
sourcesFile)
File(intellijUltimateSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
writeIvyXml(it.name, "intellijUltimate.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
}
}
flatDeps.forEach {
writeIvyXml(it.name, it.name, files("$repoDir/${it.name}"), File(repoDir, it.name), sourcesFile)
}
if (intellijUltimateEnabled) {
val nodeJsBaseDir = "${`plugins-NodeJS`.name}/NodeJS/lib"
writeIvyXml("NodeJS", `plugins-NodeJS`.name, files("$repoDir/$nodeJsBaseDir"), File(repoDir, nodeJsBaseDir), sourcesFile)
}
}
}
val build by tasks.creating {
dependsOn(prepareIvyXmls)
}
val clean by tasks.creating(Delete::class) {
delete(customDepsRepoModulesDir)
delete(buildDir)
}

3
buildSrc/settings.gradle Normal file
View File

@@ -0,0 +1,3 @@
include "prepare-deps:android-dx",
"prepare-deps:intellij-sdk"

View File

@@ -0,0 +1,15 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.kotlin.dsl.extra
import java.io.File
fun RepositoryHandler.androidDxJarRepo(project: Project): IvyArtifactRepository = ivy {
val baseDir = File("${project.rootDir}/buildSrc/prepare-deps/android-dx/build/repo")
ivyPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/[module].ivy.xml")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[module]/[revision]/[artifact](-[classifier]).jar")
}
fun Project.androidDxJar() = "kotlin.build.custom.deps:android-dx:${rootProject.extra["versions.androidBuildTools"]}"

View File

@@ -1,38 +1,28 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
// usages in build scripts are not tracked properly
@file:Suppress("unused")
import org.gradle.api.*
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.*
import org.gradle.api.plugins.JavaPluginConvention
import groovy.lang.Closure
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.file.CopySourceSpec
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.AbstractTask
import org.gradle.jvm.tasks.Jar
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.SourceSetOutput
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.the
import java.io.File
import java.util.concurrent.Callable
inline fun <reified T : Task> Project.task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)
fun AbstractTask.dependsOnTaskIfExists(task: String, project: Project?, parentProject: Project?) {
val thisTask = this
val p = project ?: this.project
p.afterEvaluate {
p.tasks.firstOrNull { it.name == task }?.also {
if (parentProject != null) {
parentProject.evaluationDependsOn(p.path)
}
thisTask.dependsOn(it)
}
}
fun Project.callGroovy(name: String, vararg args: Any?): Any? {
return (property(name) as Closure<*>).call(*args)
}
fun AbstractTask.dependsOnTaskIfExistsRec(task: String, project: Project? = null, parentProject: Project? = null) {
dependsOnTaskIfExists(task, project, parentProject)
(project ?: this.project).subprojects.forEach {
dependsOnTaskIfExistsRec(task, it, this.project)
}
}
inline fun<T: Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
inline fun <T : Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
var res: T? = null
pluginManager.withPlugin("java") {
res = body()
@@ -40,31 +30,40 @@ inline fun<T: Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
return res
}
fun Project.getCompiledClasses(): SourceSetOutput? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").output
}
fun Project.getCompiledClasses(): SourceSetOutput? = withJavaPlugin { mainSourceSet.output }
fun Project.getSources(): SourceDirectorySet? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").allSource
}
fun Project.getSources(): SourceDirectorySet? = withJavaPlugin { mainSourceSet.allSource }
fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").resources
}
fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin { mainSourceSet.resources }
fun File(root: File, vararg children: String): File = children.fold(root, { f, c -> File(f, c) })
fun File(root: String, vararg children: String): File = children.fold(File(root), { f, c -> File(f, c) })
fun fileFrom(root: File, vararg children: String): File = children.fold(root) { f, c -> File(f, c) }
fun fileFrom(root: String, vararg children: String): File = children.fold(File(root)) { f, c -> File(f, c) }
var Project.jvmTarget: String?
get() = extra.takeIf { it.has("jvmTarget") }?.get("jvmTarget") as? String
set(v) { extra["jvmTarget"] = v }
set(v) {
extra["jvmTarget"] = v
}
var Project.javaHome: String?
get() = extra.takeIf { it.has("javaHome") }?.get("javaHome") as? String
set(v) { extra["javaHome"] = v }
set(v) {
extra["javaHome"] = v
}
fun Project.generator(fqName: String) = task<JavaExec> {
classpath = the<JavaPluginConvention>().sourceSets["test"].runtimeClasspath
fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec {
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
main = fqName
workingDir = rootDir
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {
val v = it.toString()
if (v.isBlank()) true
else v.toBoolean()
}
inline fun CopySourceSpec.from(crossinline filesProvider: () -> Any?): CopySourceSpec = from(Callable { filesProvider() })
fun Project.javaPluginConvention(): JavaPluginConvention = the()

View File

@@ -0,0 +1,47 @@
import org.gradle.api.Project
import org.gradle.api.tasks.JavaExec
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.task
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
fun Project.smartJavaExec(configure: JavaExec.() -> Unit) = task<JavaExec> javaExec@{
configure()
val jarTask = project.task("${name}WriteClassPath", Jar::class) {
val classpath = classpath
val main = main
dependsOn(classpath)
inputs.property("main", main)
doFirst {
val classPathString = classpath.joinToString(" ") { project.file(it).toURI().toString() }
manifest {
attributes(
mapOf(
"Class-Path" to classPathString,
"Main-Class" to main
)
)
}
}
archiveName = "$main.${this@javaExec.name}.classpath.container.$extension"
destinationDir = temporaryDir
}
dependsOn(jarTask)
doFirst {
main = "-jar"
classpath = project.files()
val copyArgs = args.orEmpty().toList()
args(jarTask.outputs.files.singleFile)
args(copyArgs)
}
}

View File

@@ -23,7 +23,7 @@ fun Project.classesDirsArtifact(): FileCollection {
val classesDirsCfg = configurations.getOrCreate("classes-dirs")
val classesDirs = the<JavaPluginConvention>().sourceSets["main"].output.classesDirs
val classesDirs = mainSourceSet.output.classesDirs
val classesTask = tasks["classes"]
@@ -36,13 +36,15 @@ fun Project.classesDirsArtifact(): FileCollection {
return classesDirs
}
private const val MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME = "testJar"
fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
val testsJarCfg = configurations.getOrCreate("tests-jar").extendsFrom(configurations["testCompile"])
return task<Jar>("testsJar") {
return task<Jar>(MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME) {
dependsOn("testClasses")
pluginManager.withPlugin("java") {
from(project.the<JavaPluginConvention>().sourceSets.getByName("test").output)
from(testSourceSet.output)
}
classifier = "tests"
body()
@@ -51,7 +53,12 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
}
fun Project.noDefaultJar() {
tasks.findByName("jar")?.enabled = false
tasks.findByName("jar")?.let { defaultJarTask ->
defaultJarTask.enabled = false
configurations.findByName("archives")?.artifacts?.removeAll {
(it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false
}
}
}
fun<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
@@ -74,18 +81,19 @@ fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
fun Project.runtimeJar(taskName: String = "jar", body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask(taskName, body))
fun Project.sourcesJar(body: Jar.() -> Unit = {}): Jar =
fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
classifier = "sources"
try {
project.pluginManager.withPlugin("java-base") {
from(project.the<JavaPluginConvention>().sourceSets["main"].allSource)
if (sourceSet != null) {
project.pluginManager.withPlugin("java-base") {
from(project.javaPluginConvention().sourceSets[sourceSet].allSource)
}
}
} catch (e: UnknownDomainObjectException) {
// skip default sources location
}
tasks.findByName("classes")?.let { dependsOn(it) }
body()
project.addArtifact("archives", this, this)
}

View File

@@ -2,10 +2,11 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.tasks.AbstractCopyTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -14,14 +15,24 @@ import java.io.File
fun Project.commonDep(coord: String): String {
val parts = coord.split(':')
return when (parts.size) {
1 -> "$coord:$coord:${rootProject.extra["versions.$coord"]}"
2 -> "${parts[0]}:${parts[1]}:${rootProject.extra["versions.${parts[1]}"]}"
1 -> "$coord:$coord:${commonVer(coord, coord)}"
2 -> "${parts[0]}:${parts[1]}:${commonVer(parts[0], parts[1])}"
3 -> coord
else -> throw IllegalArgumentException("Illegal maven coordinates: $coord")
}
}
fun Project.commonDep(group: String, artifact: String): String = "$group:$artifact:${rootProject.extra["versions.$artifact"]}"
fun Project.commonDep(group: String, artifact: String, vararg suffixesAndClassifiers: String): String {
val (classifiers, artifactSuffixes) = suffixesAndClassifiers.partition { it.startsWith(':') }
return "$group:$artifact${artifactSuffixes.joinToString("")}:${commonVer(group, artifact)}${classifiers.joinToString("")}"
}
fun Project.commonVer(group: String, artifact: String) =
when {
rootProject.extra.has("versions.$artifact") -> rootProject.extra["versions.$artifact"]
rootProject.extra.has("versions.$group") -> rootProject.extra["versions.$group"]
else -> throw GradleException("Neither versions.$artifact nor versions.$group is defined in the root project's extra")
}
fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File(rootDir, "dependencies"), subdir: String? = null, optional: Boolean = false): ConfigurableFileCollection {
val dir = if (subdir != null) File(baseDir, subdir) else baseDir
@@ -39,30 +50,11 @@ fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File
}
fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir: String? = null): ConfigurableFileCollection {
val ultimateDepsDir = File(rootDir, "ultimate", "dependencies")
val ultimateDepsDir = fileFrom(rootDir, "ultimate", "dependencies")
return if (ultimateDepsDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateDepsDir, subdir = subdir)
else files()
}
fun Project.ideaSdkDeps(vararg artifactBaseNames: String, subdir: String = "lib", optional: Boolean = false): ConfigurableFileCollection =
preloadedDeps(*artifactBaseNames, baseDir = File(rootDir, "ideaSDK"), subdir = subdir, optional = optional)
fun Project.ideaUltimateSdkDeps(vararg artifactBaseNames: String, subdir: String = "lib"): ConfigurableFileCollection {
val ultimateSdkDir = File(rootDir, "ultimate", "ideaSDK")
return if (ultimateSdkDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateSdkDir, subdir = subdir)
else files()
}
fun Project.ideaSdkCoreDeps(vararg artifactBaseNames: String): ConfigurableFileCollection = ideaSdkDeps(*artifactBaseNames, subdir = "core")
fun Project.ideaUltimateSdkCoreDeps(vararg artifactBaseNames: String): ConfigurableFileCollection = ideaUltimateSdkDeps(*artifactBaseNames, subdir = "core")
fun Project.ideaPluginDeps(vararg artifactBaseNames: String, plugin: String, subdir: String = "lib", optional: Boolean = false): ConfigurableFileCollection =
ideaSdkDeps(*artifactBaseNames, subdir = "plugins/$plugin/$subdir", optional = optional)
fun Project.ideaUltimatePluginDeps(vararg artifactBaseNames: String, plugin: String, subdir: String = "lib"): ConfigurableFileCollection =
ideaUltimateSdkDeps(*artifactBaseNames, subdir = "plugins/$plugin/$subdir")
fun Project.kotlinDep(artifactBaseName: String, version: String): String = "org.jetbrains.kotlin:kotlin-$artifactBaseName:$version"
fun DependencyHandler.projectDist(name: String): ProjectDependency = project(name, configuration = "distJar").apply { isTransitive = false }
@@ -72,15 +64,15 @@ fun DependencyHandler.projectArchives(name: String): ProjectDependency = project
fun DependencyHandler.projectClasses(name: String): ProjectDependency = project(name, configuration = "classes-dirs")
val protobufLiteProject = ":custom-dependencies:protobuf-lite"
val protobufRelocatedProject = ":custom-dependencies:protobuf-relocated"
fun DependencyHandler.protobufLite(): ProjectDependency =
project(protobufLiteProject, configuration = "default").apply { isTransitive = false }
val protobufLiteTask = "$protobufLiteProject:prepare"
fun DependencyHandler.protobufFull(): ProjectDependency =
project(protobufLiteProject, configuration = "relocated").apply { isTransitive = false }
val protobufFullTask = "$protobufLiteProject:prepare-relocated-protobuf"
project(protobufRelocatedProject, configuration = "default").apply { isTransitive = false }
private fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex())
fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex())
private val wildcardsRe = """[^*?]+|(\*)|(\?)""".toRegex()
@@ -101,10 +93,33 @@ private fun String.toMaybeVersionedJarRegex(): Regex {
}
private val jreHome = System.getProperty("java.home")
fun firstFromJavaHomeThatExists(vararg paths: String): File =
paths.mapNotNull { File(jreHome, it).takeIf { it.exists() } }.firstOrNull()
?: throw GradleException("Cannot find under '$jreHome' neither of: ${paths.joinToString()}")
fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = File(this.property("JDK_18") as String)): File? =
paths.map { File(jdkHome, it) }.firstOrNull { it.exists() }.also {
if (it == null)
logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome")
}
fun toolsJar(): File = firstFromJavaHomeThatExists("../lib/tools.jar", "../Classes/tools.jar")
fun Project.toolsJar(jdkHome: File = File(this.property("JDK_18") as String)): File? =
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
object EmbeddedComponents {
val CONFIGURATION_NAME = "embeddedComponents"
}
fun AbstractCopyTask.fromEmbeddedComponents() {
val embeddedComponents = project.configurations.getByName(EmbeddedComponents.CONFIGURATION_NAME)
if (this is ShadowJar) {
from(embeddedComponents)
} else {
dependsOn(embeddedComponents)
from {
embeddedComponents.map { file ->
if (file.isDirectory)
project.files(file)
else
project.zipTree(file)
}
}
}
}

View File

@@ -1,13 +1,12 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.bundling.Zip
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.task
import org.gradle.kotlin.dsl.*
import java.io.File
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
@@ -18,9 +17,10 @@ val packagesToRelocate =
"org.apache",
"org.jdom",
"org.picocontainer",
"jline",
"org.jline",
"gnu",
"org.fusesource")
"org.fusesource",
"kotlinx.coroutines")
// The shaded compiler "dummy" is used to rewrite dependencies in projects that are used with the embeddable compiler
// on the runtime and use some shaded dependencies from the compiler
@@ -41,7 +41,6 @@ val packagesToExcludeFromDummy =
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/json/**",
"org/xmlpull/**",
"*.txt")
@@ -105,23 +104,22 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(taskName: String = "
}
}
fun Project.rewriteDepsToShadedJar(originalJarTask: Jar, shadowJarTask: Zip, body: Jar.() -> Unit = {}): Jar {
val originalFiles by lazy {
val jarContents = zipTree(originalJarTask.outputs.files.singleFile).files
val basePath = jarContents.find { it.name == "MANIFEST.MF" }?.parentFile?.parentFile ?: throw GradleException("cannot determine the jar root dir")
jarContents.map { it.relativeTo(basePath).path }.toSet()
fun Project.rewriteDepsToShadedJar(originalJarTask: Jar, shadowJarTask: Jar, body: Jar.() -> Unit = {}): Jar {
originalJarTask.apply {
classifier = "original"
}
return task<Jar>("rewrittenDepsJar") {
originalJarTask.apply {
classifier = "original"
}
shadowJarTask.apply {
dependsOn(originalJarTask)
from(originalJarTask)// { include("**") }
classifier = "shadow"
}
dependsOn(shadowJarTask)
from(project.zipTree(shadowJarTask.outputs.files.singleFile)) { include { originalFiles.any { originalFile -> it.file.canonicalPath.endsWith(originalFile) } } }
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
return shadowJarTask.apply {
dependsOn(originalJarTask)
from(originalJarTask)// { include("**") }
// When Gradle traverses the inputs, reject the shaded compiler JAR,
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
classifier = null
body()
}
}

View File

@@ -17,6 +17,7 @@
*/
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
@@ -44,15 +45,20 @@ fun Project.configureInstrumentation() {
// classes from the "friendly directory" to the compile classpath.
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
testCompile?.doFirst {
val mainSourceSet = the<JavaPluginConvention>().sourceSets.getByName("main")
testCompile.classpath = (testCompile.classpath
- mainSourceSet.output.classesDirs
+ files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy")))
}
}
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
dependencies {
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms") }
}
afterEvaluate {
the<JavaPluginConvention>().sourceSets.all { sourceSetParam ->
sourceSets.all { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
@@ -66,6 +72,7 @@ fun Project.configureInstrumentation() {
instrumentTask.apply {
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
sourceSet = sourceSetParam
instrumentationClasspath = instrumentationClasspathCfg
originalClassesDirs = classesDirsCopy
output = instrumentedClassesDir
}
@@ -88,6 +95,8 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
var sourceSet: SourceSet? = null
var instrumentationClasspath: Configuration? = null
@Input
var originalClassesDirs: FileCollection? = null
@@ -101,9 +110,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
@TaskAction
fun instrumentClasses() {
logger.info("input files are: ${originalClassesDirs?.joinToString("; ", transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)" }"})}")
output?.deleteRecursively()
copyOriginalClasses()
val classpath = project.ideaSdkDeps("javac2.jar", "jdom.jar", "asm-all.jar", "jgoodies-forms.jar")
val classpath = instrumentationClasspath!!
ant.withGroovyBuilder {
"taskdef"("name" to "instrumentIdeaExtensions",
@@ -113,7 +123,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
logger.info("Compiling forms and instrumenting code with nullability preconditions")
val instrumentNotNull = prepareNotNullInstrumenting(classpath)
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
instrumentCode(sourceDirs, instrumentNotNull)
}
@@ -124,10 +134,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
}
private fun prepareNotNullInstrumenting(classpath: ConfigurableFileCollection): Boolean {
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
ant.withGroovyBuilder {
"typedef"("name" to "skip",
"classpath" to classpath.asPath,
"classpath" to classpath,
"loaderref" to LOADER_REF,
"classname" to FILTER_ANNOTATION_REGEXP_CLASS)
}
@@ -139,7 +149,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
// Instrumentation needs to have access to sources of forms for inclusion
val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.the<JavaPluginConvention>().sourceSets.getByName("main").allSource.sourceDirectories }
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
val instrumentationClasspath =
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
logger.info("Using following dependency source dirs: $it")

View File

@@ -0,0 +1,180 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.internal.ConventionTask
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.*
import org.gradle.api.tasks.compile.AbstractCompile
import org.gradle.kotlin.dsl.*
import java.io.File
fun Project.configureInstrumentation() {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
// When we change the output classes directory, Gradle will automatically configure
// the test compile tasks to use the instrumented classes. Normally this is fine,
// however, it causes problems for Kotlin projects:
// The "internal" modifier can be used to restrict access to the same module.
// To make it possible to use internal methods from the main source set in test classes,
// the Kotlin Gradle plugin adds the original output directory of the Java task
// as "friendly directory" which makes it possible to access internal members
// of the main module. Also this directory should be available on classpath during compilation
// This fails when we change the classes dir. The easiest fix is to prepend the
// classes from the "friendly directory" to the compile classpath.
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
testCompile?.doFirst {
testCompile.classpath = (testCompile.classpath
- mainSourceSet.output.classesDirs
+ files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy")))
}
}
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
dependencies {
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all") }
}
afterEvaluate {
sourceSets.all { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
val classesDirsCopy = project.files(classesDirs.toTypedArray()).filter { it.exists() }
(sourceSetParam as ExtensionAware).extra.set("classesDirsCopy", classesDirsCopy)
logger.info("Saving old sources dir for project ${project.name}")
val instrumentedClassesDir = File(project.buildDir, "classes/${sourceSetParam.name}-instrumented")
(sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir)
val instrumentTask = project.tasks.create(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java)
instrumentTask.apply {
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
sourceSet = sourceSetParam
instrumentationClasspath = instrumentationClasspathCfg
originalClassesDirs = classesDirsCopy
output = instrumentedClassesDir
}
instrumentTask.outputs.dir(instrumentedClassesDir)
// Ensure that our task is invoked when the source set is built
sourceSetParam.compiledBy(instrumentTask)
@Suppress("UNUSED_EXPRESSION")
true
}
}
}
@CacheableTask
open class IntelliJInstrumentCodeTask : ConventionTask() {
companion object {
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
private const val LOADER_REF = "java2.loader"
}
var sourceSet: SourceSet? = null
var instrumentationClasspath: Configuration? = null
@Input
var originalClassesDirs: FileCollection? = null
@get:InputFiles
val sourceDirs: FileCollection
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@get:OutputDirectory
var output: File? = null
@TaskAction
fun instrumentClasses() {
logger.info("input files are: ${originalClassesDirs?.joinToString("; ", transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)" }"})}")
output?.deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath!!
ant.withGroovyBuilder {
"taskdef"("name" to "instrumentIdeaExtensions",
"classpath" to classpath.asPath,
"loaderref" to LOADER_REF,
"classname" to "com.intellij.ant.InstrumentIdeaExtensions")
}
logger.info("Compiling forms and instrumenting code with nullability preconditions")
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
instrumentCode(sourceDirs, instrumentNotNull)
}
private fun copyOriginalClasses() {
project.copy {
from(originalClassesDirs)
into(output)
}
}
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
ant.withGroovyBuilder {
"typedef"("name" to "skip",
"classpath" to classpath,
"loaderref" to LOADER_REF,
"classname" to FILTER_ANNOTATION_REGEXP_CLASS)
}
return true
}
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
val headlessOldValue = System.setProperty("java.awt.headless", "true")
// Instrumentation needs to have access to sources of forms for inclusion
val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
val instrumentationClasspath =
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
logger.info("Using following dependency source dirs: $it")
}
logger.info("Running instrumentIdeaExtensions with srcdir=${srcDirs.asPath}}, destdir=$output and classpath=$instrumentationClasspath")
ant.withGroovyBuilder {
"instrumentIdeaExtensions"("srcdir" to srcDirs.asPath,
"destdir" to output,
"classpath" to instrumentationClasspath,
"includeantruntime" to false,
"instrumentNotNull" to instrumentNotNull) {
if (instrumentNotNull) {
ant.withGroovyBuilder {
"skip"("pattern" to "kotlin/Metadata")
}
}
}
}
if (headlessOldValue != null) {
System.setProperty("java.awt.headless", headlessOldValue)
} else {
System.clearProperty("java.awt.headless")
}
}
}

View File

@@ -0,0 +1,171 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("unused") // usages in build scripts are not tracked properly
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.JavaExec
import org.gradle.kotlin.dsl.*
import java.io.File
private fun Project.intellijRepoDir() = File("${project.rootDir.absoluteFile}/buildSrc/prepare-deps/intellij-sdk/build/repo")
fun RepositoryHandler.intellijSdkRepo(project: Project): IvyArtifactRepository = ivy {
val baseDir = project.intellijRepoDir()
val intellijEnforceCommunitySdk = project.getBooleanProperty("intellijEnforceCommunitySdk") == true
setUrl(baseDir)
if (!intellijEnforceCommunitySdk) {
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate.ivy.xml")
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate.plugin.[module].ivy.xml")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]Ultimate/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellijUltimate/plugins/[module]/lib/[artifact](-[classifier]).jar")
}
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module].ivy.xml")
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij.plugin.[module].ivy.xml")
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module].ivy.xml")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij/plugins/[module]/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module]/[module]/lib/[artifact](-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact].jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact](-[revision])(-[classifier]).jar")
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/sources/[artifact]-[revision]-[classifier].[ext]")
metadataSources {
ivyDescriptor()
}
}
fun Project.intellijDep(module: String = "intellij") = "kotlin.build.custom.deps:$module:${rootProject.extra["versions.intellijSdk"]}"
fun Project.intellijCoreDep() = intellijDep("intellij-core")
fun Project.intellijPluginDep(plugin: String) = intellijDep(plugin)
fun Project.intellijUltimateDep() = intellijDep("intellij")
fun Project.intellijUltimatePluginDep(plugin: String) = intellijDep(plugin)
fun ModuleDependency.includeJars(vararg names: String, rootProject: Project? = null) {
names.forEach {
var baseName = it.removeSuffix(".jar")
if (rootProject != null && rootProject.extra.has("ignore.jar.$baseName")) {
return@forEach
}
if (rootProject != null && rootProject.extra.has("versions.jar.$baseName")) {
baseName += "-${rootProject.extra["versions.jar.$baseName"]}"
}
artifact {
name = baseName
type = "jar"
extension = "jar"
}
}
}
// Workaround. Top-level Kotlin function in a default package can't be called from a non-default package
object IntellijRootUtils {
fun getRepositoryRootDir(project: Project): File = with (project.rootProject) {
return File(intellijRepoDir(), "kotlin.build.custom.deps/${extra["versions.intellijSdk"]}")
}
fun getIntellijRootDir(project: Project): File = with (project.rootProject) {
return File(getRepositoryRootDir(this), "intellij${if (isIntellijCommunityAvailable()) "" else "Ultimate"}")
}
}
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(), rootProject = project.rootProject)
fun Project.isIntellijCommunityAvailable() = !(rootProject.extra["intellijUltimateEnabled"] as Boolean) || rootProject.extra["intellijSeparateSdks"] as Boolean
fun Project.isIntellijUltimateSdkAvailable() = (rootProject.extra["intellijUltimateEnabled"] as Boolean)
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
fun Project.intellijUltimateRootDir() =
if (isIntellijUltimateSdkAvailable())
File(intellijRepoDir(), "kotlin.build.custom.deps/${rootProject.extra["versions.intellijSdk"]}/intellijUltimate")
else
throw GradleException("intellij ultimate SDK is not available")
fun DependencyHandlerScope.excludeInAndroidStudio(rootProject: Project, block: DependencyHandlerScope.() -> Unit) {
if (!rootProject.extra.has("versions.androidStudioRelease")) {
block()
}
}
fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File, body: JavaExec.() -> Unit): JavaExec {
return task<JavaExec>(name) {
val ideaSandboxConfigDir = File(ideaSandboxDir, "config")
classpath = mainSourceSet.runtimeClasspath
main = "com.intellij.idea.Main"
workingDir = File(intellijRootDir(), "bin")
jvmArgs(
"-Xmx1250m",
"-XX:ReservedCodeCacheSize=240m",
"-XX:+HeapDumpOnOutOfMemoryError",
"-ea",
"-Didea.is.internal=true",
"-Didea.debug.mode=true",
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",
"-Dapple.laf.useScreenMenuBar=true",
"-Dapple.awt.graphics.UseQuartz=true",
"-Dsun.io.useCanonCaches=false",
"-Dplugin.path=${ideaPluginDir.absolutePath}",
"-Didea.additional.classpath=../idea-kotlin-runtime/kotlin-runtime.jar,../idea-kotlin-runtime/kotlin-reflect.jar"
)
if (rootProject.findProperty("versions.androidStudioRelease") != null) {
jvmArgs("-Didea.platform.prefix=AndroidStudio")
}
if (project.hasProperty("noPCE")) {
jvmArgs("-Didea.ProcessCanceledException=disabled")
}
args()
doFirst {
val disabledPluginsFile = File(ideaSandboxConfigDir, "disabled_plugins.txt")
val disabledPluginsContents = disabledPluginsFile.takeIf { it.isFile }?.readLines()
val filteredContents = disabledPluginsContents?.filterNot { it.contains("org.jetbrains.kotlin") }
if (filteredContents != null && filteredContents.size != disabledPluginsContents.size) {
with(disabledPluginsFile.printWriter()) {
filteredContents.forEach(this::println)
}
}
}
body()
}
}

View File

@@ -9,7 +9,7 @@ import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
import org.gradle.internal.os.OperatingSystem
enum class JdkMajorVersion {
JDK_16, JDK_17, JDK_18, JDK_9
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10
}
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"))
@@ -133,7 +133,7 @@ fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
val installedJdks = File(loc).listFiles { dir ->
dir.isDirectory &&
unixConventionalJdkDirRex.containsMatchIn(dir.name) &&
File(dir, "bin", "java").isFile
fileFrom(dir, "bin", "java").isFile
} ?: continue
for (dir in installedJdks) {
val versionMatch = javaVersionRegex.find(dir.name)
@@ -149,7 +149,9 @@ fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
private val windowsConventionalJdkRegistryPaths = listOf(
"SOFTWARE\\JavaSoft\\Java Development Kit",
"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit")
"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit",
"SOFTWARE\\JavaSoft\\JDK",
"SOFTWARE\\Wow6432Node\\JavaSoft\\JDK")
fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
val registry = Native.get(WindowsRegistry::class.java)
@@ -170,7 +172,7 @@ fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
else {
javaHome.takeIf { it.isNotEmpty() }
?.let { File(it) }
?.takeIf { it.isDirectory && File(it, "bin", "java.exe").isFile }
?.takeIf { it.isDirectory && fileFrom(it, "bin", "java.exe").isFile }
?.let {
addIfBetter(project, versionMatch.value, jdkKey, it)
}

View File

@@ -0,0 +1,15 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import org.gradle.api.artifacts.*
class DependencyMapper(
val group: String,
val module: String,
vararg val configurations: String,
val mapping: (ResolvedDependency) -> MappedDependency?
)
class MappedDependency(val main: PDependency, val deferred: List<PDependency> = emptyList())
class ParserContext(val dependencyMappers: List<DependencyMapper>, val variant: PillExtension.Variant)

View File

@@ -0,0 +1,39 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import java.io.File
import org.gradle.api.Project
open class PillExtension {
enum class Variant {
// Default variant (./gradlew pill)
BASE() { override val includes = setOf(BASE) },
// Full variant (./gradlew pill -Dpill.variant=full)
FULL() { override val includes = setOf(BASE, FULL) },
// Do not import the project to JPS model, but set some options for it
NONE() { override val includes = emptySet<Variant>() },
// 'BASE' if the "jps-compatible" plugin is applied, 'NONE' otherwise
DEFAULT() { override val includes = emptySet<Variant>() };
abstract val includes: Set<Variant>
}
open var variant: Variant = Variant.DEFAULT
open var importAsLibrary: Boolean = false
open var excludedDirs: List<File> = emptyList()
fun Project.excludedDirs(vararg dirs: String) {
excludedDirs = excludedDirs + dirs.map { File(projectDir, it) }
}
open var libraryPath: File? = null
set(v) {
importAsLibrary = true
field = v
}
}

View File

@@ -0,0 +1,189 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.internal.file.copy.SingleParentCopySpec
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.Copy
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.extra
import org.jetbrains.kotlin.pill.ArtifactElement.*
import org.jetbrains.kotlin.pill.POrderRoot.*
import java.io.File
class PArtifact(val artifactName: String, val outputDir: File, private val contents: ArtifactElement.Root) {
fun render(context: PathContext) = xml("component", "name" to "ArtifactManager") {
xml("artifact", "name" to artifactName) {
xml("output-path") {
raw(context(outputDir))
}
add(contents.renderRecursively(context))
}
}
}
sealed class ArtifactElement {
private val myChildren = mutableListOf<ArtifactElement>()
val children get() = myChildren
fun add(child: ArtifactElement) {
myChildren += child
}
abstract fun render(context: PathContext): xml
fun renderRecursively(context: PathContext): xml {
return render(context).apply {
children.forEach { add(it.renderRecursively(context)) }
}
}
fun getDirectory(path: String): ArtifactElement {
if (path.isEmpty()) {
return this
}
var current: ArtifactElement = this
for (segment in path.split("/")) {
val existing = current.children.firstOrNull { it is Directory && it.name == segment }
if (existing != null) {
current = existing
continue
}
current = Directory(segment).also { current.add(it) }
}
return current
}
class Root : ArtifactElement() {
override fun render(context: PathContext) = xml("root", "id" to "root")
}
data class Directory(val name: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "directory", "name" to name)
}
data class Archive(val name: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "archive", "name" to name)
}
data class ModuleOutput(val moduleName: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "module-output", "name" to moduleName)
}
data class FileCopy(val source: File) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "file-copy", "path" to context(source))
}
data class DirectoryCopy(val source: File) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "dir-copy", "path" to context(source))
}
data class ProjectLibrary(val name: String) : ArtifactElement() {
override fun render(context: PathContext) = xml("element", "id" to "library", "level" to "project", "name" to name)
}
data class ExtractedDirectory(val archive: File, val pathInJar: String = "/") : ArtifactElement() {
override fun render(context: PathContext) =
xml("element", "id" to "extracted-dir", "path" to context(archive), "path-in-jar" to pathInJar)
}
}
fun generateKotlinPluginArtifactFile(rootProject: Project): PFile {
val mainIdeaPluginTask = rootProject.tasks.getByName("ideaPlugin")
val gradleArtifactDir = File(rootProject.extra["ideaPluginDir"] as File, "lib")
val ideaPluginTasks = mainIdeaPluginTask.taskDependencies
.getDependencies(mainIdeaPluginTask)
.filter { it.name == "ideaPlugin" }
.filterIsInstance<Copy>()
val root = Root()
// Copy kotlinc directory
root.add(Directory("kotlinc").apply {
val kotlincDirectory = rootProject.extra["distKotlinHomeDir"].toString()
add(DirectoryCopy(File(kotlincDirectory)))
})
for (task in ideaPluginTasks) {
val spec = task.rootSpec.children.filterIsInstance<SingleParentCopySpec>().singleOrNull()
?: error("Copy spec is not unique in ${rootProject.name}. Available specs: ${task.rootSpec.children}")
val sourcePaths = spec.sourcePaths
for (sourcePath in sourcePaths) {
if (sourcePath is ShadowJar) {
if (sourcePath.project.path == ":prepare:idea-plugin") {
val kotlinPluginJar = Archive(sourcePath.archiveName).also { root.getDirectory("lib").add(it) }
kotlinPluginJar.add(FileCopy(File(rootProject.projectDir, "resources/kotlinManifest.properties")))
for (jarFile in sourcePath.project.configurations.getByName("packedJars").resolve()) {
kotlinPluginJar.add(ExtractedDirectory(jarFile))
}
@Suppress("UNCHECKED_CAST")
for (projectPath in sourcePath.project.extra["projectsToShadow"] as List<String>) {
val jpsModuleName = rootProject.findProject(projectPath)!!.name + ".src"
kotlinPluginJar.add(ModuleOutput(jpsModuleName))
}
continue
}
}
when (sourcePath) {
is Jar -> {
val targetDir = ("lib/" + task.destinationDir.toRelativeString(gradleArtifactDir)).withoutSlash()
val archiveForJar = Archive(sourcePath.project.name + ".jar").apply {
if (task.project.plugins.hasPlugin(JavaPlugin::class.java)) {
add(ModuleOutput(sourcePath.project.name + ".src"))
}
root.getDirectory(targetDir).add(this)
}
val embeddedComponents = sourcePath.project.configurations
.findByName(EmbeddedComponents.CONFIGURATION_NAME)?.resolvedConfiguration
if (embeddedComponents != null) {
val configuration = CollectedConfiguration(embeddedComponents, Scope.COMPILE)
for (dependencyInfo in listOf(configuration).collectDependencies()) {
val dependency = (dependencyInfo as? DependencyInfo.ResolvedDependencyInfo)?.dependency ?: continue
if (dependency.configuration == "runtimeElements") {
archiveForJar.add(ModuleOutput(dependency.moduleName + ".src"))
} else if (dependency.configuration == "tests-jar" || dependency.configuration == "jpsTest") {
error("Test configurations are not allowed here")
} else {
for (file in dependency.moduleArtifacts.map { it.file }) {
archiveForJar.add(ExtractedDirectory(file))
}
}
}
}
}
is Configuration -> {
require(sourcePath.name == "sideJars") { "Configurations other than 'sideJars' are not supported" }
for (file in sourcePath.resolve()) {
root.getDirectory("lib").add(FileCopy(file))
}
}
else -> error("${task.name} Unexpected task type ${task.javaClass.name}")
}
}
}
val artifact = PArtifact("KotlinPlugin", File(rootProject.projectDir, "out/artifacts/Kotlin"), root)
return PFile(
File(rootProject.projectDir, ".idea/artifacts/${artifact.artifactName}.xml"),
artifact.render(ProjectContext(rootProject))
)
}

View File

@@ -0,0 +1,497 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import org.gradle.api.Project
import org.gradle.api.artifacts.*
import org.gradle.api.tasks.*
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.kotlin.dsl.configure
import org.gradle.plugins.ide.idea.IdeaPlugin
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.HasConvention
import org.jetbrains.kotlin.pill.POrderRoot.*
import org.jetbrains.kotlin.pill.PSourceRoot.*
import org.jetbrains.kotlin.pill.PillExtension.*
import java.io.File
import java.util.LinkedList
data class PProject(
val name: String,
val rootDirectory: File,
val modules: List<PModule>,
val libraries: List<PLibrary>
)
data class PModule(
val name: String,
val bundleName: String,
val rootDirectory: File,
val moduleFile: File,
val contentRoots: List<PContentRoot>,
val orderRoots: List<POrderRoot>,
val moduleForProductionSources: PModule? = null,
val group: String? = null
)
data class PContentRoot(
val path: File,
val forTests: Boolean,
val sourceRoots: List<PSourceRoot>,
val excludedDirectories: List<File>
)
data class PSourceRoot(
val path: File,
val kind: Kind,
val kotlinOptions: PSourceRootKotlinOptions?
) {
enum class Kind { PRODUCTION, TEST, RESOURCES, TEST_RESOURCES }
}
data class PSourceRootKotlinOptions(
val noStdlib: Boolean?,
val noReflect: Boolean?,
val moduleName: String?,
val apiVersion: String?,
val languageVersion: String?,
val jvmTarget: String?,
val addCompilerBuiltIns: Boolean?,
val loadBuiltInsFromDependencies: Boolean?,
val extraArguments: List<String>
) {
fun intersect(other: PSourceRootKotlinOptions) = PSourceRootKotlinOptions(
if (noStdlib == other.noStdlib) noStdlib else null,
if (noReflect == other.noReflect) noReflect else null,
if (moduleName == other.moduleName) moduleName else null,
if (apiVersion == other.apiVersion) apiVersion else null,
if (languageVersion == other.languageVersion) languageVersion else null,
if (jvmTarget == other.jvmTarget) jvmTarget else null,
if (addCompilerBuiltIns == other.addCompilerBuiltIns) addCompilerBuiltIns else null,
if (loadBuiltInsFromDependencies == other.loadBuiltInsFromDependencies) loadBuiltInsFromDependencies else null,
extraArguments.intersect(other.extraArguments).toList()
)
}
data class POrderRoot(
val dependency: PDependency,
val scope: Scope,
val isExported: Boolean = false,
val isProductionOnTestDependency: Boolean = false
) {
enum class Scope { COMPILE, TEST, RUNTIME, PROVIDED }
}
sealed class PDependency {
data class Module(val name: String) : PDependency()
data class Library(val name: String) : PDependency()
data class ModuleLibrary(val library: PLibrary) : PDependency()
}
data class PLibrary(
val name: String,
val classes: List<File>,
val javadoc: List<File> = emptyList(),
val sources: List<File> = emptyList(),
val annotations: List<File> = emptyList(),
val dependencies: List<PLibrary> = emptyList()
) {
fun attachSource(file: File): PLibrary {
return this.copy(sources = this.sources + listOf(file))
}
}
fun parse(project: Project, libraries: List<PLibrary>, context: ParserContext): PProject = with (context) {
if (project != project.rootProject) {
error("$project is not a root project")
}
fun Project.matchesSelectedVariant(): Boolean {
val extension = this.extensions.findByType(PillExtension::class.java) ?: return true
val projectVariant = extension.variant.takeUnless { it == Variant.DEFAULT } ?: Variant.BASE
return projectVariant in context.variant.includes
}
val (includedProjects, excludedProjects) = project.allprojects
.partition { it.plugins.hasPlugin(JpsCompatiblePlugin::class.java) && it.matchesSelectedVariant() }
val modules = includedProjects.flatMap { parseModules(it, excludedProjects) }
return PProject("Kotlin", project.projectDir, modules, libraries)
}
/*
Ordering here and below is significant.
Placing 'runtime' configuration dependencies on the top make 'idea' tests to run normally.
('idea' module has 'intellij-core' as transitive dependency, and we really need to get rid of it.)
*/
private val CONFIGURATION_MAPPING = mapOf(
listOf("runtime") to Scope.RUNTIME,
listOf("compile") to Scope.COMPILE,
listOf("compileOnly") to Scope.PROVIDED
)
private val TEST_CONFIGURATION_MAPPING = mapOf(
listOf("runtime", "testRuntime") to Scope.RUNTIME,
listOf("compile", "testCompile") to Scope.COMPILE,
listOf("compileOnly", "testCompileOnly") to Scope.PROVIDED,
listOf("jpsTest") to Scope.TEST
)
private fun ParserContext.parseModules(project: Project, excludedProjects: List<Project>): List<PModule> {
val (productionContentRoots, testContentRoots) = parseContentRoots(project).partition { !it.forTests }
val modules = mutableListOf<PModule>()
fun getJavaExcludedDirs() = project.plugins.findPlugin(IdeaPlugin::class.java)
?.model?.module?.excludeDirs?.toList() ?: emptyList()
fun getPillExcludedDirs() = project.extensions.getByType(PillExtension::class.java).excludedDirs
val allExcludedDirs = getPillExcludedDirs() + getJavaExcludedDirs() + project.buildDir +
(if (project == project.rootProject) excludedProjects.map { it.buildDir } else emptyList())
var productionSourcesModule: PModule? = null
fun getModuleFile(suffix: String = ""): File {
val relativePath = File(project.projectDir, project.name + suffix + ".iml")
.toRelativeString(project.rootProject.projectDir)
return File(project.rootProject.projectDir, ".idea/modules/$relativePath")
}
for ((nameSuffix, roots) in mapOf(".src" to productionContentRoots, ".test" to testContentRoots)) {
if (roots.isEmpty()) {
continue
}
val mainRoot = roots.first()
var dependencies = parseDependencies(project, mainRoot.forTests)
if (productionContentRoots.isNotEmpty() && mainRoot.forTests) {
val productionModuleDependency = PDependency.Module(project.name + ".src")
dependencies += POrderRoot(productionModuleDependency, Scope.COMPILE, true)
}
val module = PModule(
project.name + nameSuffix,
project.name,
mainRoot.path,
getModuleFile(nameSuffix),
roots,
dependencies,
productionSourcesModule
)
modules += module
if (!mainRoot.forTests) {
productionSourcesModule = module
}
}
val mainModuleFileRelativePath = when (project) {
project.rootProject -> File(project.rootProject.projectDir, project.name + ".iml")
else -> getModuleFile()
}
modules += PModule(
project.name,
project.name,
project.projectDir,
mainModuleFileRelativePath,
listOf(PContentRoot(project.projectDir, false, emptyList(), allExcludedDirs)),
if (modules.isEmpty()) parseDependencies(project, false) else emptyList()
)
return modules
}
private fun parseContentRoots(project: Project): List<PContentRoot> {
val sourceRoots = parseSourceRoots(project).groupBy { it.kind }
fun getRoots(kind: PSourceRoot.Kind) = sourceRoots[kind] ?: emptyList()
val productionSourceRoots = getRoots(Kind.PRODUCTION) + getRoots(Kind.RESOURCES)
val testSourceRoots = getRoots(Kind.TEST) + getRoots(Kind.TEST_RESOURCES)
fun createContentRoots(sourceRoots: List<PSourceRoot>, forTests: Boolean): List<PContentRoot> {
return sourceRoots.map { PContentRoot(it.path, forTests, listOf(it), emptyList()) }
}
return createContentRoots(productionSourceRoots, forTests = false) +
createContentRoots(testSourceRoots, forTests = true)
}
private fun parseSourceRoots(project: Project): List<PSourceRoot> {
if (!project.plugins.hasPlugin(JavaPlugin::class.java)) {
return emptyList()
}
val kotlinTasksBySourceSet = project.tasks
.filter { it.name.startsWith("compile") && it.name.endsWith("Kotlin") }
.associateBy { it.invokeInternal("getSourceSetName") }
val sourceRoots = mutableListOf<PSourceRoot>()
for (sourceSet in project.sourceSets) {
val kotlinCompileTask = kotlinTasksBySourceSet[sourceSet.name]
val kind = if (sourceSet.name == SourceSet.TEST_SOURCE_SET_NAME) Kind.TEST else Kind.PRODUCTION
fun Any.getKotlin(): SourceDirectorySet {
val kotlinMethod = javaClass.getMethod("getKotlin")
val oldIsAccessible = kotlinMethod.isAccessible
try {
kotlinMethod.isAccessible = true
return kotlinMethod(this) as SourceDirectorySet
} finally {
kotlinMethod.isAccessible = oldIsAccessible
}
}
val kotlinSourceDirectories = (sourceSet as HasConvention).convention
.plugins["kotlin"]?.getKotlin()?.srcDirs
?: emptySet()
val directories = (sourceSet.java.sourceDirectories.files + kotlinSourceDirectories).toList()
.filter { it.exists() }
.takeIf { it.isNotEmpty() }
?: continue
val kotlinOptions = kotlinCompileTask?.let { getKotlinOptions(it) }
for (resourceRoot in sourceSet.resources.sourceDirectories.files) {
if (!resourceRoot.exists() || resourceRoot in directories) {
continue
}
val resourceRootKind = when (kind) {
Kind.PRODUCTION -> Kind.RESOURCES
Kind.TEST -> Kind.TEST_RESOURCES
else -> error("Invalid source root kind $kind")
}
sourceRoots += PSourceRoot(resourceRoot, resourceRootKind, kotlinOptions)
}
for (directory in directories) {
sourceRoots += PSourceRoot(directory, kind, kotlinOptions)
}
}
return sourceRoots
}
private fun getKotlinOptions(kotlinCompileTask: Any): PSourceRootKotlinOptions? {
val compileArguments = kotlinCompileTask.invokeInternal("getSerializedCompilerArguments") as List<String>
fun parseBoolean(name: String) = compileArguments.contains("-$name")
fun parseString(name: String) = compileArguments.dropWhile { it != "-$name" }.drop(1).firstOrNull()
val addCompilerBuiltins = "Xadd-compiler-builtins"
val loadBuiltinsFromDependencies = "Xload-builtins-from-dependencies"
fun isOptionForScriptingCompilerPlugin(option: String)
= option.startsWith("-Xplugin=") && option.contains("kotlin-scripting-gradle")
val extraArguments = compileArguments.filter {
it.startsWith("-X") && !isOptionForScriptingCompilerPlugin(it)
&& it != "-$addCompilerBuiltins" && it != "-$loadBuiltinsFromDependencies"
}
return PSourceRootKotlinOptions(
parseBoolean("no-stdlib"),
parseBoolean("no-reflect"),
parseString("module-name"),
parseString("api-version"),
parseString("language-version"),
parseString("jvm-target"),
parseBoolean(addCompilerBuiltins),
parseBoolean(loadBuiltinsFromDependencies),
extraArguments
)
}
private fun Any.invokeInternal(name: String, instance: Any = this): Any? {
val method = javaClass.methods.single { it.name.startsWith(name) && it.parameterTypes.isEmpty() }
val oldIsAccessible = method.isAccessible
try {
method.isAccessible = true
return method.invoke(instance)
} finally {
method.isAccessible = oldIsAccessible
}
}
private fun ParserContext.parseDependencies(project: Project, forTests: Boolean): List<POrderRoot> {
val configurationMapping = if (forTests) TEST_CONFIGURATION_MAPPING else CONFIGURATION_MAPPING
with(project.configurations) {
val mainRoots = mutableListOf<POrderRoot>()
val deferredRoots = mutableListOf<POrderRoot>()
fun collectConfigurations(): List<CollectedConfiguration> {
val configurations = mutableListOf<CollectedConfiguration>()
for ((configurationNames, scope) in configurationMapping) {
for (configurationName in configurationNames) {
val configuration = findByName(configurationName)?.also { it.resolve() } ?: continue
val extraDependencies = resolveExtraDependencies(configuration)
configurations += CollectedConfiguration(configuration.resolvedConfiguration, scope, extraDependencies)
}
}
return configurations
}
nextDependency@ for (dependencyInfo in collectConfigurations().collectDependencies()) {
val scope = dependencyInfo.scope
if (dependencyInfo is DependencyInfo.CustomDependencyInfo) {
val files = dependencyInfo.files
val library = PLibrary(files.firstOrNull()?.nameWithoutExtension ?: "unnamed", classes = files)
mainRoots += POrderRoot(PDependency.ModuleLibrary(library), scope)
continue
}
val dependency = (dependencyInfo as DependencyInfo.ResolvedDependencyInfo).dependency
for (mapper in dependencyMappers) {
if (dependency.moduleGroup == mapper.group
&& dependency.moduleName == mapper.module
&& dependency.configuration in mapper.configurations
) {
val mappedDependency = mapper.mapping(dependency)
if (mappedDependency != null) {
mainRoots += POrderRoot(mappedDependency.main, scope)
for (deferredDep in mappedDependency.deferred) {
deferredRoots += POrderRoot(deferredDep, scope)
}
}
continue@nextDependency
}
}
mainRoots += if (dependency.configuration == "runtimeElements" && scope != Scope.TEST) {
POrderRoot(PDependency.Module(dependency.moduleName + ".src"), scope)
} else if (dependency.configuration == "tests-jar" || dependency.configuration == "jpsTest") {
POrderRoot(
PDependency.Module(dependency.moduleName + ".test"),
scope,
isProductionOnTestDependency = true
)
} else {
val classes = dependency.moduleArtifacts.map { it.file }
val library = PLibrary(dependency.moduleName, classes)
POrderRoot(PDependency.ModuleLibrary(library), scope)
}
}
return removeDuplicates(mainRoots + deferredRoots)
}
}
private fun resolveExtraDependencies(configuration: Configuration): List<File> {
return configuration.dependencies
.filterIsInstance<SelfResolvingDependency>()
.map { it.resolve() }
.filter { isGradleApiDependency(it) }
.flatMap { it }
}
private fun isGradleApiDependency(files: Iterable<File>): Boolean {
return listOf("gradle-api", "groovy-all").all { dep ->
files.any { it.extension == "jar" && it.name.startsWith("$dep-") }
}
}
private fun removeDuplicates(roots: List<POrderRoot>): List<POrderRoot> {
val dependenciesByScope = roots.groupBy { it.scope }.mapValues { it.value.mapTo(mutableSetOf()) { it.dependency } }
fun dependenciesFor(scope: Scope) = dependenciesByScope[scope] ?: emptySet<PDependency>()
val result = mutableSetOf<POrderRoot>()
for (root in roots.distinct()) {
val scope = root.scope
val dependency = root.dependency
if (root in result) {
continue
}
if ((scope == Scope.PROVIDED || scope == Scope.RUNTIME) && dependency in dependenciesFor(Scope.COMPILE)) {
continue
}
if (scope == Scope.PROVIDED && dependency in dependenciesFor(Scope.RUNTIME)) {
result += POrderRoot(dependency, Scope.COMPILE)
continue
}
if (scope == Scope.RUNTIME && dependency in dependenciesFor(Scope.PROVIDED)) {
result += POrderRoot(dependency, Scope.COMPILE)
continue
}
result += root
}
return result.toList()
}
data class CollectedConfiguration(
val configuration: ResolvedConfiguration,
val scope: Scope,
val extraDependencies: List<File> = emptyList())
sealed class DependencyInfo(val scope: Scope) {
class ResolvedDependencyInfo(scope: Scope, val dependency: ResolvedDependency) : DependencyInfo(scope)
class CustomDependencyInfo(scope: Scope, val files: List<File>) : DependencyInfo(scope)
}
fun List<CollectedConfiguration>.collectDependencies(): List<DependencyInfo> {
val dependencies = mutableListOf<DependencyInfo>()
val unprocessed = LinkedList<DependencyInfo>()
val existing = mutableSetOf<Pair<Scope, ResolvedDependency>>()
for ((configuration, scope, extraDependencies) in this) {
for (dependency in configuration.firstLevelModuleDependencies) {
unprocessed += DependencyInfo.ResolvedDependencyInfo(scope, dependency)
}
if (!extraDependencies.isEmpty()) {
unprocessed += DependencyInfo.CustomDependencyInfo(scope, extraDependencies)
}
}
while (unprocessed.isNotEmpty()) {
val info = unprocessed.removeAt(0)
dependencies += info
info as? DependencyInfo.ResolvedDependencyInfo ?: continue
val data = Pair(info.scope, info.dependency)
existing += data
for (child in info.dependency.children) {
if (Pair(info.scope, child) in existing) {
continue
}
unprocessed += DependencyInfo.ResolvedDependencyInfo(info.scope, child)
}
}
return dependencies
}
private val Project.sourceSets: SourceSetContainer
get() {
lateinit var result: SourceSetContainer
project.configure<JavaPluginConvention> { result = sourceSets }
return result
}

View File

@@ -0,0 +1,40 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import org.gradle.api.Project
import java.io.File
interface PathContext {
operator fun invoke(file: File): String
fun url(file: File): Pair<String, String> {
val path = when {
file.isFile && file.extension.toLowerCase() == "jar" -> "jar://" + this(file) + "!/"
else -> "file://" + this(file)
}
return Pair("url", path)
}
}
class ProjectContext private constructor(private val projectDir: File) : PathContext {
constructor(project: PProject) : this(project.rootDirectory)
constructor(project: Project) : this(project.projectDir)
override fun invoke(file: File): String {
return file.absolutePath.replace(projectDir.absolutePath, "\$PROJECT_DIR\$")
}
}
class ModuleContext(val project: PProject, val module: PModule) : PathContext {
override fun invoke(file: File): String {
if (!file.startsWith(project.rootDirectory)) {
return file.absolutePath
}
return "\$MODULE_DIR\$/" + file.toRelativeString(module.moduleFile.parentFile)
}
}
fun String.withSlash() = if (this.endsWith("/")) this else (this + "/")
fun String.withoutSlash() = this.trimEnd('/')

View File

@@ -0,0 +1,309 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.kotlin.dsl.extra
import shadow.org.jdom2.input.SAXBuilder
import shadow.org.jdom2.*
import shadow.org.jdom2.output.Format
import shadow.org.jdom2.output.XMLOutputter
import java.io.File
class PillConfigurablePlugin : Plugin<Project> {
override fun apply(project: Project) {
project.configurations.create(EmbeddedComponents.CONFIGURATION_NAME)
project.extensions.create("pill", PillExtension::class.java)
}
}
class JpsCompatiblePlugin : Plugin<Project> {
companion object {
private fun mapper(module: String, vararg configurations: String): DependencyMapper {
return DependencyMapper("org.jetbrains.kotlin", module, *configurations) { MappedDependency(PDependency.Library(module)) }
}
private fun getDependencyMappers(projectLibraries: List<PLibrary>): List<DependencyMapper> {
val mappersForKotlinLibrariesExeptStdlib = projectLibraries
.filter { it.name != "kotlin-stdlib" }
.mapTo(mutableListOf()) { mapper(it.name, "default", "distJar", "runtimeElements") }
return mappersForKotlinLibrariesExeptStdlib + listOf(
DependencyMapper("org.jetbrains.kotlin", "kotlin-stdlib", "distJar", "runtimeElements") {
MappedDependency(
PDependency.Library("kotlin-stdlib"),
listOf(PDependency.Library("annotations-13.0"))
)
},
DependencyMapper("org.jetbrains.kotlin", "kotlin-reflect-api", "runtimeElements") {
MappedDependency(PDependency.Library("kotlin-reflect"))
},
DependencyMapper("org.jetbrains.kotlin", "kotlin-compiler-embeddable", "runtimeJar") { null },
DependencyMapper("org.jetbrains.kotlin", "kotlin-stdlib-js", "distJar") { null },
DependencyMapper("org.jetbrains.kotlin", "kotlin-compiler", "runtimeJar") { null },
DependencyMapper("org.jetbrains.kotlin", "compiler", "runtimeElements") { null }
)
}
fun getProjectLibraries(rootProject: Project): List<PLibrary> {
val distLibDir = File(rootProject.extra["distLibDir"].toString())
fun distJar(name: String) = File(rootProject.projectDir, "dist/kotlinc/lib/$name.jar")
val libraries = rootProject.allprojects
.mapNotNull { library ->
val libraryExtension = library.extensions.findByType(PillExtension::class.java)
?.takeIf { it.importAsLibrary }
?: return@mapNotNull null
val libraryPath = libraryExtension.libraryPath ?: distLibDir
val archivesBaseName = library.convention.findPlugin(BasePluginConvention::class.java)?.archivesBaseName ?: library.name
fun List<File>.filterExisting() = filter { it.exists() }
PLibrary(
library.name,
classes = listOf(File(libraryPath, "$archivesBaseName.jar")).filterExisting(),
sources = listOf(File(libraryPath, "$archivesBaseName-sources.jar")).filterExisting()
)
}
return libraries + PLibrary("annotations-13.0", classes = listOf(distJar("annotations-13.0")))
}
}
override fun apply(project: Project) {
project.plugins.apply(PillConfigurablePlugin::class.java)
// 'jpsTest' does not require the 'tests-jar' artifact
project.configurations.create("jpsTest")
if (project == project.rootProject) {
project.tasks.create("pill") {
doLast { pill(project) }
if (System.getProperty("pill.android.tests", "false") == "true") {
TaskUtils.useAndroidSdk(this)
TaskUtils.useAndroidJar(this)
}
}
project.tasks.create("unpill") {
doLast { unpill(project) }
}
}
}
private lateinit var projectDir: File
private lateinit var platformVersion: String
private lateinit var platformBaseNumber: String
private lateinit var platformDir: File
private fun initEnvironment(project: Project) {
projectDir = project.projectDir
platformVersion = project.extensions.extraProperties.get("versions.intellijSdk").toString()
platformBaseNumber = platformVersion.substringBefore(".", "").takeIf { it.isNotEmpty() }
?: error("Invalid platform version: $platformVersion")
platformDir = IntellijRootUtils.getIntellijRootDir(project)
}
private fun pill(rootProject: Project) {
initEnvironment(rootProject)
val variantOptionValue = System.getProperty("pill.variant", "base").toUpperCase()
val variant = PillExtension.Variant.values().firstOrNull { it.name == variantOptionValue }
?: run {
rootProject.logger.error("Invalid variant name: $variantOptionValue")
return
}
rootProject.logger.lifecycle("Pill: Setting up project for the '${variant.name.toLowerCase()}' variant...")
if (variant == PillExtension.Variant.NONE || variant == PillExtension.Variant.DEFAULT) {
rootProject.logger.error("'none' and 'default' should not be passed as a Pill variant property value")
return
}
val projectLibraries = getProjectLibraries(rootProject)
val parserContext = ParserContext(getDependencyMappers(projectLibraries), variant)
val jpsProject = parse(rootProject, projectLibraries, parserContext)
.mapLibraries(this::attachPlatformSources, this::attachAsmSources)
generateKotlinPluginArtifactFile(rootProject).write()
val files = render(jpsProject)
removeExistingIdeaLibrariesAndModules()
removeJpsRunConfigurations()
copyRunConfigurations()
setOptionsForDefaultJunitRunConfiguration(rootProject)
files.forEach { it.write() }
}
private fun unpill(project: Project) {
initEnvironment(project)
removeExistingIdeaLibrariesAndModules()
removeJpsRunConfigurations()
}
private fun removeExistingIdeaLibrariesAndModules() {
File(projectDir, ".idea/libraries").deleteRecursively()
File(projectDir, ".idea/modules").deleteRecursively()
}
private fun removeJpsRunConfigurations() {
File(projectDir, ".idea/runConfigurations")
.walk()
.filter { it.name.startsWith("JPS_") && it.extension.toLowerCase() == "xml" }
.forEach { it.delete() }
}
private fun copyRunConfigurations() {
val runConfigurationsDir = File(projectDir, "buildSrc/src/main/resources/runConfigurations")
val targetDir = File(projectDir, ".idea/runConfigurations")
val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir)
targetDir.mkdirs()
runConfigurationsDir.listFiles()
.filter { it.extension == "xml" }
.map { it.name to it.readText().replace("\$IDEA_HOME_PATH\$", platformDirProjectRelative) }
.forEach { File(targetDir, it.first).writeText(it.second) }
}
/*
This sets a proper (project root) working directory and a "idea.home.path" property to the default JUnit configuration,
so one does not need to make these changes manually.
*/
private fun setOptionsForDefaultJunitRunConfiguration(project: Project) {
val workspaceFile = File(projectDir, ".idea/workspace.xml")
if (!workspaceFile.exists()) {
project.logger.warn("${workspaceFile.name} does not exist, JUnit default run configuration was not modified")
return
}
val document = SAXBuilder().build(workspaceFile)
val rootElement = document.rootElement
fun Element.getOrCreateChild(name: String, vararg attributes: Pair<String, String>): Element {
for (child in getChildren(name)) {
if (attributes.all { (attribute, value) -> child.getAttributeValue(attribute) == value }) {
return child
}
}
return Element(name).apply {
for ((attributeName, value) in attributes) {
setAttribute(attributeName, value)
}
this@getOrCreateChild.addContent(this@apply)
}
}
val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir)
val runManagerComponent = rootElement.getOrCreateChild("component", "name" to "RunManager")
val junitConfiguration = runManagerComponent.getOrCreateChild(
"configuration",
"default" to "true",
"type" to "JUnit",
"factoryName" to "JUnit"
)
junitConfiguration.apply {
getOrCreateChild("option", "name" to "WORKING_DIRECTORY").setAttribute("value", "file://\$PROJECT_DIR\$")
getOrCreateChild("option", "name" to "VM_PARAMETERS").also { vmParams ->
var options = vmParams.getAttributeValue("value", "")
.split(' ')
.map { it.trim() }
.filter { it.isNotEmpty() }
fun addOrReplaceOptionValue(name: String, value: Any?) {
val optionsWithoutNewValue = options.filter { !it.startsWith("-D$name=") }
options = if (value == null) optionsWithoutNewValue else (optionsWithoutNewValue + listOf("-D$name=$value"))
}
val robolectricClasspath = project.rootProject
.project(":plugins:android-extensions-compiler")
.configurations.getByName("robolectricClasspath")
.files.joinToString(File.pathSeparator)
addOrReplaceOptionValue("idea.home.path", platformDirProjectRelative)
addOrReplaceOptionValue("ideaSdk.androidPlugin.path", platformDirProjectRelative + "/plugins/android/lib")
addOrReplaceOptionValue("robolectric.classpath", robolectricClasspath)
addOrReplaceOptionValue("use.pill", "true")
val isAndroidStudioBunch = project.findProperty("versions.androidStudioRelease") != null
addOrReplaceOptionValue("idea.platform.prefix", if (isAndroidStudioBunch) "AndroidStudio" else null)
val androidJarPath = project.configurations.findByName("androidJar")?.singleFile
val androidSdkPath = project.configurations.findByName("androidSdk")?.singleFile
if (androidJarPath != null && androidSdkPath != null) {
addOrReplaceOptionValue("android.sdk", "\$PROJECT_DIR\$/" + androidSdkPath.toRelativeString(projectDir))
addOrReplaceOptionValue("android.jar", "\$PROJECT_DIR\$/" + androidJarPath.toRelativeString(projectDir))
}
vmParams.setAttribute("value", options.joinToString(" "))
}
}
val output = XMLOutputter().also {
it.format = Format.getPrettyFormat().apply {
setEscapeStrategy { Verifier.isHighSurrogate(it) || it == '"' }
setIndent(" ")
setTextMode(Format.TextMode.TRIM)
setOmitEncoding(false)
setOmitDeclaration(false)
}
}
val postProcessedXml = output.outputString(document)
.replace("&#x22;", "&quot;")
.replace("&#xA;", "&#10;")
.replace("&#xC;", "&#13;")
workspaceFile.writeText(postProcessedXml)
}
private fun attachPlatformSources(library: PLibrary): PLibrary {
val platformSourcesJar = File(platformDir, "../sources/ideaIC-$platformVersion-sources.jar")
if (library.classes.any { it.startsWith(platformDir) }) {
return library.attachSource(platformSourcesJar)
}
return library
}
private fun attachAsmSources(library: PLibrary): PLibrary {
val asmSourcesJar = File(platformDir, "../asm-shaded-sources/asm-src-$platformBaseNumber.jar")
val asmAllJar = File(platformDir, "lib/asm-all.jar")
if (library.classes.any { it == asmAllJar }) {
return library.attachSource(asmSourcesJar)
}
return library
}
private fun PProject.mapLibraries(vararg mappers: (PLibrary) -> PLibrary): PProject {
fun mapLibrary(root: POrderRoot): POrderRoot {
val dependency = root.dependency
if (dependency is PDependency.ModuleLibrary) {
val newLibrary = mappers.fold(dependency.library) { lib, mapper -> mapper(lib) }
return root.copy(dependency = dependency.copy(library = newLibrary))
}
return root
}
val modules = this.modules.map { it.copy(orderRoots = it.orderRoots.map(::mapLibrary)) }
return this.copy(modules = modules)
}
}

View File

@@ -0,0 +1,201 @@
@file:Suppress("PackageDirectoryMismatch")
package org.jetbrains.kotlin.pill
import java.io.File
class PFile(val path: File, val text: String) {
fun write() {
path.parentFile.mkdirs()
path.writeText(text)
}
}
fun PFile(path: File, xml: xml) = PFile(path, xml.toString())
fun render(project: PProject): List<PFile> {
val files = mutableListOf<PFile>()
files += renderModulesFile(project)
project.modules.forEach { files += renderModule(project, it) }
project.libraries.forEach { files += renderLibrary(project, it) }
return files
}
private fun renderModulesFile(project: PProject) = PFile(
File(project.rootDirectory, ".idea/modules.xml"),
xml("project", "version" to 4) {
xml("component", "name" to "ProjectModuleManager") {
xml("modules") {
val pathContext = ProjectContext(project)
for (module in project.modules) {
val moduleFilePath = pathContext(module.moduleFile)
if (module.group != null) {
xml("module", "fileurl" to "file://$moduleFilePath", "filepath" to moduleFilePath, "group" to module.group)
} else {
xml("module", "fileurl" to "file://$moduleFilePath", "filepath" to moduleFilePath)
}
}
}
}
}
)
private fun renderModule(project: PProject, module: PModule) = PFile(
module.moduleFile,
xml("module",
"type" to "JAVA_MODULE",
"version" to 4
) {
val moduleForProductionSources = module.moduleForProductionSources
if (moduleForProductionSources != null) {
xml("component", "name" to "TestModuleProperties", "production-module" to moduleForProductionSources.name)
}
val kotlinCompileOptionsList = module.contentRoots.flatMap { it.sourceRoots }.mapNotNull { it.kotlinOptions }
var kotlinCompileOptions = kotlinCompileOptionsList.firstOrNull()
for (otherOptions in kotlinCompileOptionsList.drop(1)) {
kotlinCompileOptions = kotlinCompileOptions?.intersect(otherOptions)
}
val pathContext = ModuleContext(project, module)
val platformVersion = (kotlinCompileOptions?.jvmTarget ?: "1.8")
val classesDirectory = File(project.rootDirectory, "out/production/${module.name}")
if (kotlinCompileOptions != null) {
xml("component", "name" to "FacetManager") {
xml("facet", "type" to "kotlin-language", "name" to "Kotlin") {
xml("configuration", "version" to 3, "platform" to "JVM $platformVersion", "useProjectSettings" to "false") {
xml("compilerSettings") {
xml(
"option",
"name" to "additionalArguments",
"value" to kotlinCompileOptions.extraArguments.joinToString(" ")
)
}
xml("compilerArguments") {
xml("option", "name" to "destination", "value" to pathContext(classesDirectory))
fun Any?.option(name: String) {
if (this != null) xml("option", "name" to name, "value" to this.toString())
}
kotlinCompileOptions.noStdlib.option("noStdlib")
kotlinCompileOptions.noReflect.option("noReflect")
kotlinCompileOptions.moduleName.option("moduleName")
kotlinCompileOptions.languageVersion.option("languageVersion")
kotlinCompileOptions.apiVersion.option("apiVersion")
kotlinCompileOptions.addCompilerBuiltIns.option("addCompilerBuiltIns")
kotlinCompileOptions.loadBuiltInsFromDependencies.option("loadBuiltInsFromDependencies")
xml("option", "name" to "pluginOptions") { xml("array") }
xml("option", "name" to "pluginClasspaths") { xml("array") }
}
}
}
}
}
xml("component",
"name" to "NewModuleRootManager",
"LANGUAGE_LEVEL" to "JDK_${platformVersion.replace('.', '_')}",
"inherit-compiler-output" to "true"
) {
xml("exclude-output")
for (contentRoot in module.contentRoots) {
xml("content", pathContext.url(contentRoot.path)) {
for (sourceRoot in contentRoot.sourceRoots) {
var args = arrayOf(pathContext.url(sourceRoot.path))
args += when (sourceRoot.kind) {
PSourceRoot.Kind.PRODUCTION -> ("isTestSource" to "false")
PSourceRoot.Kind.TEST -> ("isTestSource" to "true")
PSourceRoot.Kind.RESOURCES -> ("type" to "java-resource")
PSourceRoot.Kind.TEST_RESOURCES -> ("type" to "java-test-resource")
}
xml("sourceFolder", *args)
}
for (excludedDir in contentRoot.excludedDirectories) {
xml("excludeFolder", pathContext.url(excludedDir))
}
}
}
xml("orderEntry", "type" to "inheritedJdk")
for (orderRoot in module.orderRoots) {
val dependency = orderRoot.dependency
var args = when (dependency) {
is PDependency.ModuleLibrary -> arrayOf(
"type" to "module-library"
)
is PDependency.Module -> arrayOf(
"type" to "module",
"module-name" to dependency.name
)
is PDependency.Library -> arrayOf(
"type" to "library",
"name" to dependency.name,
"level" to "project"
)
}
if (dependency is PDependency.Module && orderRoot.isProductionOnTestDependency) {
args += ("production-on-test" to "")
}
args += ("scope" to orderRoot.scope.toString())
if (orderRoot.isExported) {
args += ("exported" to "")
}
xml("orderEntry", *args) {
if (dependency is PDependency.ModuleLibrary) {
add(renderLibraryToXml(dependency.library, pathContext, named = false))
}
}
}
}
}
)
private fun renderLibrary(project: PProject, library: PLibrary): PFile {
val pathContext = ProjectContext(project)
// TODO find how IDEA escapes library names
val escapedName = library.renderName().replace(" ", "_").replace(".", "_").replace("-", "_")
return PFile(
File(project.rootDirectory, ".idea/libraries/$escapedName.xml"),
xml("component", "name" to "libraryTable") {
add(renderLibraryToXml(library, pathContext))
})
}
private fun renderLibraryToXml(library: PLibrary, pathContext: PathContext, named: Boolean = true): xml {
val args = if (named) arrayOf("name" to library.renderName()) else emptyArray()
return xml("library", *args) {
xml("CLASSES") {
library.classes.forEach { xml("root", pathContext.url(it)) }
}
xml("JAVADOC") {
library.javadoc.forEach { xml("root", pathContext.url(it)) }
}
xml("SOURCES") {
library.sources.forEach { xml("root", pathContext.url(it)) }
}
}
}
fun PLibrary.renderName() = name?.takeIf { it != "unspecified" } ?: classes.first().nameWithoutExtension

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