Compare commits

...

274 Commits

Author SHA1 Message Date
teamcity
d00b6dd1a7 Auto-merge beta2 with <default> 2015-11-26 16:08:34 +03:00
Dmitry Jemerov
3674663d30 use Kotlin call hierarchy provider only for Kotlin elements, to ensure that it does not interfere with standard Java features of IntelliJ IDEA
(cherry picked from commit 7004917)
2015-11-26 11:34:34 +01:00
teamcity
03b688d1a1 Auto-merge beta2 with <default> 2015-11-24 22:33:24 +03:00
Natalia Ukhorskaya
e74282753a Fix compatibility with AS 2.0
#KT-10153 Fixed
2015-11-24 19:06:47 +03:00
Dmitry Jemerov
a7c07b8519 Merge branch 'beta2' into beta2_/br141 2015-11-20 17:59:50 +01:00
Dmitry Jemerov
bbb92ead5b ensure that the short name of the Kotlin unused import inspection does not clash with Java (KT-10046)
(cherry picked from commit 30084df)
2015-11-20 14:07:12 +01:00
teamcity
b320e2ed0e Auto-merge beta2 with <default> 2015-11-19 23:20:52 +03:00
Michael Nedzelsky
08e9ff602f fix KT-10068 JsLibraryStdDetectionUtil does not use caching through JarUserDataManager
#KT-10068 Fixed
(cherry picked from commit ea4470a)
2015-11-19 18:54:44 +01:00
teamcity
c5e473bc50 Auto-merge beta2 with <default> 2015-11-19 18:35:01 +03:00
Nikolay Krasko
73596f7464 Enable bootstrapping for the branch 2015-11-19 16:14:54 +03:00
Alexander Udalov
0dcf34bb55 Fix deadlock on static initializers of KProperty implementations
#KT-10041 Fixed
2015-11-19 02:58:00 +03:00
Mikhail Glukhikh
0bcdfce84b Diagnostics corrected for smart cast impossible (cherry picked from commit 03287d5) 2015-11-18 20:13:28 +03:00
teamcity
45044a77d5 Auto-merge beta2 with <default> 2015-11-17 22:57:19 +03:00
Yan Zhulanow
e8be0962c2 Android extensions: get descriptors using reflection (temporary change)
(cherry picked from commit f228c04)
2015-11-17 20:29:53 +03:00
Yan Zhulanow
8afd6421bb Revert "do not package kotlin-runtime and kotlin-reflect into Kotlin Android extensions zip"
This reverts commit 83bf5daf7f.
(cherry picked from commit a1dcede)
2015-11-17 20:29:45 +03:00
teamcity
01b06401a2 Auto-merge beta2 with <default> 2015-11-17 15:16:54 +03:00
Dmitry Jemerov
a946126dca do not package kotlin-runtime and kotlin-reflect into Kotlin Android extensions zip
(cherry picked from commit 83bf5da)
2015-11-17 13:15:24 +01:00
teamcity
6147d11e1a Auto-merge beta2 with <default> 2015-11-14 01:25:54 +03:00
Ilya Gorbunov
47895c0cc2 Correct deprecation replacement for Progression constructors.
Update testdata for LoadBuiltinsTest
2015-11-13 21:57:27 +03:00
Nikolay Krasko
d8593d166d Merge remote-tracking branch 'origin/beta2' into beta2_/br141 2015-11-13 18:08:16 +03:00
Ilya Chernikov
bb6677620a Additional fix to the previous one: Disabling parallel builds without daemon again and undoing apprpriate fix to broken tests problem, since it effectively cancelled fix for parallel building itself and was causing exceptions on heavy builds 2015-11-12 19:14:00 +01:00
Nikolay Krasko
3ecdf558ae Register inspection 2015-11-12 19:35:13 +03:00
Nikolay Krasko
eee1839e8e Disable tests. Difference in test data is in line markers that is probable bug in old asm 2015-11-12 19:35:11 +03:00
Nikolay Krasko
c35b8a4b58 Revert test data specific to JDK 1.6 2015-11-12 19:35:10 +03:00
Ilya Chernikov
06104521f2 Disabling parallel builds without daemon again and undoing apprpriate fix to broken tests problem, since it effectively cancelled fix for parallel building itself and was causing exceptions on heavy builds 2015-11-12 17:13:26 +01:00
Valentin Kipyatkov
63fc7110a7 KT-9981 Code cleanup replace usages of !in incorrectly
#KT-9981 Fixed
2015-11-12 15:11:07 +03:00
Michael Bogdanov
f5bab93fd1 Additional diagnostic for KT-9980: KotlinFrontEndException: Exception while analyzing expression 2015-11-12 15:11:29 +03:00
Nikolay Krasko
c8e9e33076 Merge '1.0.0-beta-2417' into beta2_/br141 2015-11-12 01:38:22 +03:00
Ilya Gorbunov
8f2c05668e Make MutableMap.set return Unit
#KT-7853 Fixed
2015-11-11 19:15:52 +03:00
Ilya Gorbunov
737763cc67 Restore correct sorting order (after cleanup in 17fc1d95) 2015-11-11 19:15:51 +03:00
Ilya Gorbunov
2bd44799f8 Simplify message expression from lambda argument when converting assert to if. 2015-11-11 19:15:50 +03:00
Ilya Gorbunov
e13fb0e7bc Deprecated with ERROR preconditions with eager message. 2015-11-11 19:15:49 +03:00
Ilya Gorbunov
16df7a9d92 Replace getStackTrace usages in j2k and testData. 2015-11-11 19:15:48 +03:00
Ilya Gorbunov
d5d803963f Replace Regex.match and matchAll usages 2015-11-11 19:15:47 +03:00
Ilya Gorbunov
20a15dc175 Refactor intention test files enumerating, do not use deprecated filter method, which would get another behavior after dropping deprecated one. 2015-11-11 19:15:46 +03:00
Ilya Gorbunov
26bd8600cf Drop deprecations and tighten up left ones. 2015-11-11 19:15:45 +03:00
Nikolay Krasko
abb116ef9a Fix locator syntax 2015-11-11 19:06:57 +03:00
Nikolay Krasko
62363c95d8 Fix test data in debugger test 2015-11-11 18:48:55 +03:00
Nikolay Krasko
e58a45c9d8 Remove some tests no working on idea 141 and make change signature work with invalid old indecies 2015-11-11 18:14:37 +03:00
Ilya Gorbunov
a336888858 Make emptyMap upperbound to be Any? rather than Any.
#KT-9963
2015-11-11 17:17:42 +03:00
Ilya Gorbunov
19501aac59 Do not override default AbstractList iterator() implementation for primitiveArray.asList wrappers.
#KT-9927 Fixed
2015-11-11 17:17:41 +03:00
Nikolay Krasko
f9ac5ae737 Enable auto-increment in beta2 branch 2015-11-11 17:13:27 +03:00
Dmitry Jemerov
9cb5defc43 don't analyze class repeatedly if we already found an annotated member there
#KT-8557 Fixed
(cherry picked from commit 6f2fb3f)
2015-11-11 15:10:12 +01:00
Valentin Kipyatkov
4782077357 KT-9928 Replacement not offered for a usage of symbol deprecated with DeprecationLevel.ERROR
#KT-9928 Fixed
(cherry picked from commit de11d57)
2015-11-11 17:08:58 +03:00
Nikolay Krasko
7906615ae9 Merge tag 'build-1.0.0-beta-2403' into beta2_/br141 2015-11-11 14:32:24 +03:00
Nikolay Krasko
eeeb26ddda Merge tag 'build-1.0.0-beta-2385' into idea_continuous/br141 2015-11-11 03:12:56 +03:00
Nikolay Krasko
e4905931b6 Revert unwrapping usages lost in merge 2015-11-10 17:30:15 +03:00
Nikolay Krasko
40cecdaa33 Patch debugger test data 2015-11-10 17:29:59 +03:00
Nikolay Krasko
e8e9e27903 Restore KotlinReportSubmitter 2015-11-10 17:29:42 +03:00
Nikolay Krasko
3e1cd44df8 Fix compile errors after merge 2015-11-10 15:29:02 +03:00
Nikolay Krasko
12447eace1 Merge tag 'build-1.0.0-beta-2364' into idea_continuous/br141
# Conflicts:
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KotlinJavascriptMetaFile.kt
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KtClsFile.kt
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KtClsFileBase.kt
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/kotlinFileViewProviders.kt
#	idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt
#	idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt
#	idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightProjectDescriptor.java
#	idea/src/META-INF/plugin.xml
#	idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/DebuggerSteppingHelper.java
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt
#	idea/src/org/jetbrains/kotlin/idea/findUsages/handlers/KotlinFindClassUsagesHandler.kt
#	idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinTestRunLineMarkerContributor.kt
#	idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinAddOrderEntryActionFactory.kt
#	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureUsageProcessor.java
#	idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOverrideImplementTest.kt
#	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestCase.java
#	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java
#	idea/tests/org/jetbrains/kotlin/idea/debugger/SmartStepIntoTestGenerated.java
#	idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java
#	idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java
#	idea/tests/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureTest.java
#	idea/tests/org/jetbrains/kotlin/search/JUnitMembersSearcherTest.java
#	plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/KotlinAndroidTestCase.java
2015-11-10 14:52:58 +03:00
Nikolay Krasko
a7ad17fd6d Merge tag 'build-1.0.0-beta-2181' into idea_continuous/br141 2015-11-10 13:58:04 +03:00
Natalia Ukhorskaya
27140671db Drop smart step into: cannot be implemented on 141 2015-10-30 15:48:19 +03:00
Natalia Ukhorskaya
d36e01dbdd Fix debugger tests 2015-10-30 15:45:06 +03:00
Natalia Ukhorskaya
c9cb0abfad Fix wrong merge 2015-10-30 15:27:01 +03:00
Natalia Ukhorskaya
b0bb109209 Merge remote-tracking branch 'origin/master' into idea_continuous/br141
Conflicts:
	idea/src/org/jetbrains/kotlin/idea/debugger/JetPositionManager.kt
	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt
	idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/multipleBreakpointsAtLine.kt
	idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceAnonymousObjectCapturedInClosure.kt
	idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/lambdas/twoLambdasOnOneLineFirst.kt
	idea/testData/debugger/tinyApp/src/stepping/custom/severalFunLiterals.kt
	idea/testData/debugger/tinyApp/src/stepping/custom/severalFunLiteralsInClass.kt
	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java
2015-10-30 15:19:07 +03:00
Natalia Ukhorskaya
d80eb5765e Fix some errors after merge 2015-10-30 15:00:29 +03:00
Natalia Ukhorskaya
3c74b0fcce Revert 932542891b
Stepping for inline functions: add test for last statement in for
2015-10-30 12:48:37 +03:00
Natalia Ukhorskaya
6f9ed63dc9 Revert e534636f03
Support multiple breakpoints at one line (especially for lambdas)
2015-10-30 12:47:25 +03:00
Natalia Ukhorskaya
d56512fd57 Revert 17a564495d
Stepping for inline function: filter out inline function body lines from step over  #KT-9665 Fixed
2015-10-30 12:43:15 +03:00
Natalia Ukhorskaya
b84c73eab2 Revert 66a5351cd0
Do not show fake local variables for inline function/argument in Variables View for Debugger
2015-10-30 12:41:33 +03:00
Natalia Ukhorskaya
1ce461dbfa Revert cdcafb8199
Fix stepping for inline function inside while statement
2015-10-30 12:40:09 +03:00
Natalia Ukhorskaya
39348e38ec Merge remote-tracking branch 'origin/master' into idea_continuous/br141
Conflicts:
	idea/src/META-INF/plugin.xml
	idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpointType.java
	idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/breakpointTypeUtils.kt
	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinLambdaSmartStepIntoTarget.kt
	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt
	idea/testData/debugger/tinyApp/outs/breakpointInInlineFun.out
	idea/testData/debugger/tinyApp/outs/ceAnonymousObjectCapturedInClosure.out
	idea/testData/debugger/tinyApp/outs/customLibClassName.out
	idea/testData/debugger/tinyApp/outs/fwAbstractProperty.out
	idea/testData/debugger/tinyApp/outs/fwBackingField.out
	idea/testData/debugger/tinyApp/outs/fwInitializer.out
	idea/testData/debugger/tinyApp/outs/fwPropertyInInterface.out
	idea/testData/debugger/tinyApp/outs/localFunInLibrary.out
	idea/testData/debugger/tinyApp/outs/severalFunLiterals.out
	idea/testData/debugger/tinyApp/outs/severalFunLiteralsInClass.out
	idea/testData/debugger/tinyApp/outs/stepIntoStdlibInlineFun2step.out
	idea/testData/debugger/tinyApp/outs/twoLambdasOnOneLineFirst.out
	idea/testData/debugger/tinyApp/outs/withoutBodyProperties.out
	idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverIfWithInline.kt
	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt
	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java
	idea/tests/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureTest.java
2015-10-30 12:36:50 +03:00
TeamCityServer
177897e1f9 Auto-merge with tag <default> 2015-10-26 19:09:28 +03:00
Nikolay Krasko
81edaa94aa Merge tag 'build-1.0.0-beta-1175' into idea_continuous/br141 2015-10-26 17:25:14 +03:00
teamcity
fb3c9c8479 Auto-merge M15 with <default> 2015-10-21 16:52:31 +03:00
Valentin Kipyatkov
3aff0f1107 J2K: fixed conversion of Throwable.getMessage(), Throwable.getCause(), Map.Entry.getKey() and Map.Entry.getValue()
(cherry picked from commit 36ea9cf)
2015-10-21 13:48:44 +03:00
Nikolay Krasko
cbb5e27c14 Merge remote-tracking branch 'origin/M15' into M15_/br141 2015-10-21 12:41:52 +03:00
Nikolay Krasko
5c294538d7 Merge branch 'M15_/br143' into M15_/br141 2015-10-21 00:33:55 +03:00
Michael Bogdanov
5857a02841 Stable element order in redeclaration diagnostic
(cherry picked from commit d054c6b)
2015-10-20 19:45:50 +02:00
Nikolay Krasko
ddf714b93c Temporary get jps-build-test library from last idea because it was built with the newer kotlin 2015-10-20 19:51:38 +03:00
Denis Zharkov
541001fdb1 Mixin kotlin.Number methods into j.l.Number member scope
#KT-9672 Fixed
2015-10-20 19:43:34 +03:00
Ilya Gorbunov
b389f1947d Add deprecated xxxValue() extensions to Number for migration. 2015-10-20 18:25:24 +03:00
Nikolay Krasko
62dde8bf14 Fix tearDown in android tests 2015-10-20 18:22:31 +03:00
Dmitry Jemerov
dfe854796b rename Kt to Kotlin in KtType, KtIcons 2015-10-20 16:44:48 +02:00
Nikolay Krasko
dbae0bcb59 Fix compilation and debugger tests 2015-10-20 17:15:42 +03:00
Ilya Gorbunov
3cab96599f Correct deprecation message for StringBuilder { }. 2015-10-20 16:33:34 +03:00
Andrey Breslav
b53d935e83 Create empty sources JAR for kotlin-osgi-bundle 2015-10-20 16:25:14 +03:00
Nikolay Krasko
d6806a3307 Merge remote-tracking branch 'origin/M15' into idea_continuous/br141
# Conflicts:
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KotlinClsFileBase.kt
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/kotlinFileViewProviders.kt
#	idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/testUtils.kt
#	idea/src/org/jetbrains/kotlin/idea/actions/ShowExpressionTypeAction.kt
#	idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinExpressionTypeProvider.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/KotlinSourcePositionHighlighter.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpointType.java
#	idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/breakpointTypeUtils.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/DebuggerSteppingHelper.java
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinLambdaSmartStepIntoTarget.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinMethodSmartStepIntoTarget.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt
#	idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRunLineMarkerContributor.kt
#	idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinTestRunLineMarkerContributor.kt
#	idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt
#	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureUsageProcessor.java
#	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/JavaMethodDeferredKotlinUsage.kt
#	idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinClassesWithAnnotatedMembersSearcher.kt
#	idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java
#	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestCase.java
2015-10-20 14:21:43 +03:00
Dmitry Jemerov
5e3884718b use standard exception reporter in release branch 2015-10-20 13:08:42 +02:00
Mikhail Glukhikh
1d97c742b7 Java 8 tests fixed (txt only) 2015-10-20 12:12:31 +03:00
Nikolay Krasko
a185f07ff5 Merge remote-tracking branch 'origin/master' into M15 2015-10-20 04:19:14 +03:00
Ilya Gorbunov
8fb533f44b Fix legacy package facade name usage. 2015-10-20 04:09:52 +03:00
Ilya Gorbunov
a186b5ee0d Alter regex in verify script for versions like 1.0.0-beta+1005 2015-10-20 03:18:17 +03:00
Nikolay Krasko
588812bede Merge tag 'build-0.15.903' into idea_continuous/br141 2015-10-20 02:52:12 +03:00
Ilya Gorbunov
d20daf9766 ReplaceWith for File.recurse 2015-10-20 02:35:10 +03:00
Ilya Gorbunov
20b1cfee0f Fix deprecations in tests 2015-10-20 02:34:56 +03:00
Ilya Gorbunov
eceae7ccda Provide deprecated unconstrained contains, indexOf, lastIndexOf methods for migration. 2015-10-20 02:34:41 +03:00
Ilya Gorbunov
d70a7c1b66 Generate contains, indexOf, lastIndexOf with @NoInfer 2015-10-20 02:34:27 +03:00
Dmitry Jemerov
22bce2e129 fix main class name for builtin serializer 2015-10-20 00:49:48 +02:00
Dmitry Jemerov
fcc0143ae1 disable perf output by default (M15) 2015-10-20 00:26:32 +02:00
Nikolay Krasko
b0b8ad2ccb Restore old uninvalidate files 2015-10-20 01:25:27 +03:00
Nikolay Krasko
9e2f16397c Fix compile errors 2015-10-19 15:11:05 +03:00
Nikolay Krasko
3066ac3d07 Merge build-0.15.848 into idea_continuous/br141
# Conflicts:
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpointType.java
#	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureUsageProcessor.java
#	idea/tests/org/jetbrains/kotlin/idea/KotlinLightQuickFixTestCase.java
#	idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixTest.java
#	plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/KotlinAndroidTestCaseBase.java
2015-10-19 14:26:14 +03:00
teamcity
5faa8ca374 Auto-merge M15 with <default> 2015-10-16 16:39:46 +03:00
Nikolay Krasko
5671b72b5b Process request for searching class with empty qualified name without errors 2015-10-16 16:23:10 +03:00
teamcity
8b9995f404 Auto-merge M15 with <default> 2015-10-15 19:57:42 +03:00
Ilya Chernikov
01309eb51c Removing dependency of kotlin plugin from daemon client (kotlinr), it should only depend on rmi-interface 2015-10-15 14:39:38 +02:00
teamcity
a2ea50a084 Auto-merge M15 with <default> 2015-10-15 05:32:49 +03:00
Nikolay Krasko
d8b44f405f Merge remote-tracking branch 'origin/M15' into M15_/br141 2015-10-15 03:13:08 +03:00
Nikolay Krasko
c0eb547afe In br141 java test finder have no restriction for physical files so it can work for Kotlin light classes 2015-10-14 16:50:01 +03:00
Nikolay Krasko
4a58a1d17d Merge branch 'M15' into M15_/br141
# Conflicts:
#	idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateActionBase.kt
2015-10-14 16:49:01 +03:00
Nikolay Krasko
9f06becea7 Fixes for tests generated actions and quickfixes 2015-10-13 21:20:16 +03:00
Nikolay Krasko
933cead115 Merge remote-tracking branch 'origin/M15' into M15_/br141 2015-10-13 15:56:16 +03:00
Nikolay Krasko
d0cbf80bee Fix bad previous merges in Kotlin debugger 2015-10-13 15:44:44 +03:00
Nikolay Krasko
ac0a43132c Fix compile errors 2015-10-12 17:52:17 +03:00
Nikolay Krasko
936e029820 Merge 0.15.449 into idea_continous/br141 2015-10-12 14:16:08 +03:00
Nikolay Krasko
3b53a3fe3e Revert more changes after merge in debugger 2015-10-11 20:12:12 +03:00
Nikolay Krasko
b0e7c45168 Revert "Debugger: do not compute location during creation of step command"
This reverts commit d441f2cf8a.
2015-10-11 20:04:50 +03:00
Nikolay Krasko
977e61f7d1 Revert new markers for running testsˆ 2015-10-11 20:04:16 +03:00
Nikolay Krasko
3fd5961613 Fix KotlinAnnotatedElementSearcher 2015-10-11 20:03:44 +03:00
Nikolay Krasko
a9479b6710 Revert "use IDEA 15 UI for "Show expression type""
This reverts commit d6ea701901.
2015-10-11 19:43:58 +03:00
Nikolay Krasko
2f7bb20d7f No ContextAwareActionHandler in idea 141 2015-10-11 19:38:51 +03:00
Nikolay Krasko
751ea6bc9f Merge tag 'build-0.15.407' into idea_continuous/br141 2015-10-11 19:36:43 +03:00
TeamCityServer
038b6beb71 Auto-merge with tag <default> 2015-10-08 02:11:42 +03:00
TeamCityServer
15ef568dec Auto-merge with tag <default> 2015-10-07 23:05:36 +03:00
TeamCityServer
a0d097485a Auto-merge with tag <default> 2015-10-07 21:34:57 +03:00
Nikolay Krasko
4575042216 Merge tag 'build-0.15.234' into idea_continuous/br141
# Conflicts:
#	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/kotlinFileViewProviders.kt
#	idea/src/META-INF/plugin.xml
2015-10-07 20:02:53 +03:00
Nikolay Krasko
1e2c86ff43 Fix compilation in idea141 2015-10-06 20:35:13 +03:00
Nikolay Krasko
7228710069 Merge tag 'build-0.15.184' into idea_continuous/br141 2015-10-06 20:01:59 +03:00
TeamCityServer
bccb16615d Auto-merge with tag <default> 2015-10-02 20:14:21 +03:00
Nikolay Krasko
c2ba523a22 Revert "jna-util.jar was renamed to jna-platform.jar"
This reverts commit 9ab4aafa01.
2015-10-02 18:01:57 +03:00
Nikolay Krasko
b56c71cdc2 Method absent in Idea 141 added to fix compilation 2015-10-02 15:14:50 +03:00
Nikolay Krasko
f560590159 Merge tag 'build-0.15.76' into idea_continuous/br141 2015-10-02 13:48:55 +03:00
Nikolay Krasko
889460ff56 Merge tag 'build-0.14.437' into M14_/br141 2015-09-29 15:11:59 +03:00
Nikolay Krasko
8a91ddae10 Merge remote-tracking branch 'origin/M14' into M14_/br141 2015-09-28 16:31:15 +03:00
Nikolay Krasko
2332424696 Merge and revert all commits relates to update idea to 142.5047.6 2015-09-28 16:30:46 +03:00
Nikolay Krasko
61b32fea7c Merge commit '58fa2d3b533267f8035e6be0b3e2b77176b7d18f' into M14_/br141 2015-09-28 16:08:22 +03:00
Nikolay Krasko
3c393282cd Fix typo in extension 2015-09-28 16:02:29 +03:00
Dmitry Jemerov
daa2618146 change expected output according to changes in output due to PERF removal 2015-09-28 14:59:54 +02:00
Dmitry Kovanikov
b322636064 Minor: rename Kotlin console... action name to Kotlin REPL 2015-09-28 15:52:15 +03:00
Dmitry Kovanikov
f2c13980d1 Add icon to Kotlin console... action 2015-09-28 15:52:14 +03:00
Dmitry Kovanikov
5788d54521 KT-9262: don't show warning about non-existent location after typing ':quit' 2015-09-28 15:52:13 +03:00
Dmitry Kovanikov
9a037c1254 KT-9263: don't show error message when user tries to execute command in non-existed REPL console 2015-09-28 15:52:13 +03:00
Dmitry Kovanikov
d69bba12e9 KT-9249: show text representation of first shortcut inside repl placeholder 2015-09-28 15:52:12 +03:00
Dmitry Jemerov
a2b346f6ee dependency on java-i18n plugin
(cherry picked from commit 93e2827)
2015-09-28 14:49:56 +02:00
Mikhail Glukhikh
4203677824 ReplaceWith now functions correctly in built-ins #KT-9351 Fixed 2015-09-28 15:41:34 +03:00
Dmitry Jemerov
0d5e7a0cfc fix 'operator' modifier inspection
#KT-9349 Fixed
(cherry picked from commit ee1175d)
2015-09-28 14:40:18 +02:00
Nikolay Krasko
5a15353273 Modify cleanup test, that can't modify deprecated symbol because of invalid element
Add additional test for deprecated symbol
2015-09-28 15:40:03 +03:00
Nikolay Krasko
012c975c61 Setup building against M14 2015-09-28 14:41:15 +03:00
Nikolay Krasko
81bf3227fa Regenerate KotlinSteppingTestGenerated 2015-09-28 14:40:51 +03:00
Nikolay Krasko
a2f06278c8 Revert "IDEA 142.4859.6: Update LineNumberTestGenerated test data (due to IDEA's ASM upgrade to 5.0.4 which supports multiline labels)"
This reverts commit b4efe33efa.
2015-09-28 14:30:58 +03:00
Dmitry Jemerov
183328efe7 fix expected output that changed due to perf removal 2015-09-28 13:28:35 +02:00
Dmitry Jemerov
b1c87bab9e disable perf output by default (M13 only) 2015-09-28 13:28:15 +02:00
Nikolay Krasko
7a1135d715 Suppress warning in proguard about jna classes 2015-09-28 09:08:39 +03:00
Nikolay Krasko
17eead516c Update to IDEA 142.5047.6 2015-09-28 09:08:38 +03:00
Natalia Ukhorskaya
f0a4b4ed32 Add missing readAction 2015-09-28 09:08:38 +03:00
Natalia Ukhorskaya
0c520c5d65 jna-util.jar was renamed to jna-platform.jar 2015-09-28 09:08:37 +03:00
Natalia Ukhorskaya
61881ea3a8 Fix compilation errors 2015-09-28 09:08:37 +03:00
Natalia Ukhorskaya
735a690c60 Rewrite DebuggerTests (do not use FrameTree) 2015-09-28 09:08:36 +03:00
Nikolay Krasko
8389066f28 Fix after merge 2015-09-28 02:37:27 +03:00
Nikolay Krasko
8973ed5217 Merge remote-tracking branch 'origin/master' into idea_continuous/br141
# Conflicts:
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt
#	idea/testData/debugger/tinyApp/outs/stepOverInlinedLambda.out
#	idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlinedLambda.kt
#	idea/tests/org/jetbrains/kotlin/findUsages/AbstractJetFindUsagesTest.java
#	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java
#	update_dependencies.xml
2015-09-28 02:37:07 +03:00
Nikolay Krasko
645834e6f6 Fix compile errors 2015-09-28 02:24:52 +03:00
Nikolay Krasko
a8ae730c7f No method with icon create from vararg 2015-09-28 01:56:03 +03:00
Michael Nedzelsky
58fa2d3b53 get rid of internal JvmVersion annotation in kotlin-jdbc 2015-09-27 20:38:42 +03:00
Michael Nedzelsky
a00b390282 fix check for internal from another module in imports and file level annotations 2015-09-27 20:38:38 +03:00
Nikolay Krasko
4c9a076a8d Merge remote-tracking branch 'origin/master' into idea_continuous/br141
# Conflicts:
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt
#	idea/testData/debugger/tinyApp/outs/stepOverInlinedLambda.out
#	idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlinedLambda.kt
#	idea/tests/org/jetbrains/kotlin/findUsages/AbstractJetFindUsagesTest.java
#	idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java
#	update_dependencies.xml
2015-09-25 21:29:12 +03:00
Nikolay Krasko
08d42b1333 Revert to downloading bootstrap from default branch 2015-09-25 18:13:37 +03:00
Nikolay Krasko
717c7b7caf Merge tag 'build-0.14.390' into idea_continuous/br141 2015-09-25 18:11:32 +03:00
Nikolay Krasko
eb078d5840 Temporary disable repl setup 2015-09-25 15:57:39 +03:00
Nikolay Krasko
f3b1cd0a71 Fix compilation after merge 2015-09-25 15:56:09 +03:00
Nikolay Krasko
5a116129d2 Merge remote-tracking branch 'origin/master' into idea_continuous/br141 2015-09-25 15:54:56 +03:00
Natalia Ukhorskaya
cae65bdebc Change until version of plugin for Android Studio compatibility
(cherry picked from commit 94e827747e)
2015-09-17 17:53:43 +03:00
Nikolay Krasko
712c88a900 Fix compilation 2015-09-12 17:54:14 +03:00
Nikolay Krasko
74b59aa00e Fix in debugger test data 2015-09-12 17:23:12 +03:00
Nikolay Krasko
155cf874df Fix test by inserting errors without replacing all file 2015-09-12 17:14:27 +03:00
Nikolay Krasko
c477e1825e Merge remote-tracking branch 'origin/M13' into idea_continuous/br141
# Conflicts:
#	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureUsageProcessor.java
#	idea/testData/debugger/tinyApp/outs/delegatedPropertyInClass.out
#	idea/testData/debugger/tinyApp/outs/delegatedPropertyInClassWoRenderer.out
#	update_dependencies.xml
2015-09-11 13:06:43 +03:00
Nikolay Krasko
c4295de0c6 Fix compilation 2015-09-11 10:36:23 +03:00
Nikolay Krasko
fd5394665b Merge remote-tracking branch 'origin/M13' into idea_continuous/br141 2015-09-10 22:34:50 +03:00
Nikolay Krasko
a46af42022 Update dependencies files 2015-09-10 22:26:59 +03:00
Nikolay Krasko
ad77a8c416 Merge remote-tracking branch 'origin/M13' into idea_continuous/br141 2015-09-09 21:37:11 +03:00
Nikolay Krasko
39e9916629 Revert debugger test data 2015-09-09 15:42:24 +03:00
Nikolay Krasko
643147049e Merge tag 'build-0.13.1223' into idea_continuous/br141 2015-09-09 15:39:46 +03:00
Nikolay Krasko
de9c143ef4 Fixes after merge 2015-09-08 17:48:17 +03:00
Nikolay Krasko
2b656af7a7 Merge tag 'build-0.13.1180' into idea_continuous/br141
# Conflicts:
#	idea/src/org/jetbrains/kotlin/idea/debugger/render/DelegatedPropertyFieldDescriptor.kt
#	idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt
#	idea/src/org/jetbrains/kotlin/idea/findUsages/handlers/KotlinFindClassUsagesHandler.kt
#	idea/src/org/jetbrains/kotlin/idea/util/DebuggerUtils.java
#	idea/testData/debugger/tinyApp/outs/delegatedPropertyInClass.out
#	idea/testData/debugger/tinyApp/outs/delegatedPropertyInClassWoRenderer.out
2015-09-08 17:32:20 +03:00
Nikolay Krasko
86c96b6011 Take method with internal visibility in br141 to local code 2015-09-07 18:15:08 +03:00
Nikolay Krasko
e7401cdaf9 Merge tag 'build-0.13.1098' into idea_continuous/br141 2015-09-07 16:29:19 +03:00
Nikolay Krasko
f8a5f91fb8 Merge tag 'build-0.13.1055' into idea_continuous/br141 2015-09-07 16:23:36 +03:00
Nikolay Krasko
ce1ec60db8 Fix compilation errors after revert 2015-09-07 16:22:20 +03:00
Nikolay Krasko
722a3f722f Revert "Debugger: support stepping over inline function"
This reverts commit 73946050c1.
2015-09-07 16:07:01 +03:00
Nikolay Krasko
91a43b2cb1 Revert "Minor: extract method"
This reverts commit 4980780268.
2015-09-07 16:04:31 +03:00
Nikolay Krasko
d10061ba70 Revert "Debugger for inline functions: check for available strata (faster than compute source position)"
This reverts commit ba686c701e.
2015-09-07 16:04:18 +03:00
Nikolay Krasko
4ed1e6cf26 Revert "Debugger: support stepping out inline function"
This reverts commit 060b6e6b15.
2015-09-07 16:04:02 +03:00
Nikolay Krasko
e94108ef4f Revert "Minor: do less work in debug thread during stepping commands for inline functions"
This reverts commit c836060f3a.
2015-09-07 16:02:49 +03:00
Nikolay Krasko
0b37cd6058 Merge tag 0.13.1022 into idea_continuous/br141
# Conflicts:
#	idea/src/META-INF/plugin.xml
#	idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRunLineMarkerContributor.kt
#	idea/src/org/jetbrains/kotlin/idea/inspections/UnusedImportInspection.kt
#	idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixTest.java
#	update_dependencies.xml
2015-09-07 15:56:08 +03:00
Nikolay Krasko
5fc2118915 Downgrade to idea 141 api 2015-09-07 15:03:22 +03:00
Nikolay Krasko
081b4ed18c Revert "searcher for more efficient search of Kotlin classes which have methods annotated with @Test"
This reverts commit 724f13954a.
2015-09-07 14:55:36 +03:00
Nikolay Krasko
b9c55cc78e Merge tag 0.13.1022 into idea_continuous/br141
# Conflicts:
#	idea/src/META-INF/plugin.xml
#	idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRunLineMarkerContributor.kt
#	idea/src/org/jetbrains/kotlin/idea/inspections/UnusedImportInspection.kt
#	idea/tests/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixTest.java
#	update_dependencies.xml
2015-09-07 14:45:31 +03:00
Nikolay Krasko
053e7c7551 No kotlin libraries in 141 2015-09-03 17:17:18 +03:00
Nikolay Krasko
49db752021 Better merging in debugger tests 2015-09-03 13:58:17 +03:00
Nikolay Krasko
5a46e39a53 Adjust test data for idea 141 after merge 2015-09-03 13:57:47 +03:00
Nikolay Krasko
30924091e6 Revert "Run/Debug editor gutter drop down does not work in Kotlin files (KT-8720)"
This reverts commit 142ab96a5a.
2015-09-03 13:07:17 +03:00
Nikolay Krasko
5d68b0eb2f Revert "Update to 142.4245.2"
This reverts commit 6975afba3e.
2015-09-03 13:02:04 +03:00
Nikolay Krasko
2de8168a87 Revert "Update to 142.4245.2: Update Kotlin run line marker info to new API"
This reverts commit 5554a44f0f.
2015-09-03 13:00:23 +03:00
Nikolay Krasko
112d9e56f7 Revert "Update to 142.4245.2: register RunLineMarkerProvider not only for Java language (temp)"
This reverts commit ca907c4985.
2015-09-03 13:00:20 +03:00
Nikolay Krasko
377aabf9d5 Revert "Update to 142.4245.2: Fix compilation after update"
This reverts commit a946db98a1.
2015-09-03 13:00:18 +03:00
Nikolay Krasko
b18adfdd6a Revert "Update to 142.4245.2: Fix test data in pull up"
This reverts commit 339f8ee2ab.
2015-09-03 13:00:15 +03:00
Nikolay Krasko
d16c38327b Revert "Update to 142.4245.2: Debugger tests: changes in testData"
This reverts commit ffe41b88a7.
2015-09-03 13:00:13 +03:00
Nikolay Krasko
a9d9d91311 Revert "Update to 142.4245.2: Fix compilation"
This reverts commit 11331e74fd.
2015-09-03 13:00:10 +03:00
Nikolay Krasko
bacb0d3a51 Revert "Update to 142.4245.2: Temprorary modify test data after IDEA update"
This reverts commit 1132652026.
2015-09-03 13:00:02 +03:00
Nikolay Krasko
9a82813b5c Merge tag 'build-0.13.969' into idea_continuous/br141
# Conflicts:
#	idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt
#	idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt
#	update_dependencies.xml
2015-09-03 12:58:54 +03:00
Nikolay Krasko
3e22c15d24 Don't check for JS module 2015-08-25 14:08:47 +03:00
Nikolay Krasko
f4eeeb03c4 Revert "Debugger tests: changes in testData"
This reverts commit be5c1d0a44.
2015-08-25 11:07:56 +03:00
Nikolay Krasko
66a1ef5e1f Remove copying kotlin runtime from br141 2015-08-25 00:40:37 +03:00
TeamCityServer
d7d100e361 Auto-merge with tag <default> 2015-08-24 23:45:07 +03:00
TeamCityServer
987028171a Auto-merge with tag <default> 2015-08-24 20:45:51 +03:00
TeamCityServer
4413312f30 Auto-merge with tag <default> 2015-08-24 18:37:38 +03:00
TeamCityServer
db5b197921 Auto-merge with tag <default> 2015-08-24 16:43:27 +03:00
Nikolay Krasko
99b28d5c05 Merge tag 'build-0.13.717' into idea_continuous/br141
Conflicts:
	update_dependencies.xml
2015-08-24 15:37:42 +03:00
TeamCityServer
b5b9d3b25c Auto-merge with tag <default> 2015-08-21 15:59:31 +03:00
Stanislav Erokhin
8663dc7dae Fix after merge 2015-08-20 20:21:26 +03:00
Stanislav Erokhin
2b0699e5c9 Revert "Debugger tests: migrate to new API"
This reverts commit 9b0cfd4027.
2015-08-20 19:22:25 +03:00
Stanislav Erokhin
d1e327adde Manual merge 2015-08-20 19:12:59 +03:00
TeamCityServer
32e907167a Auto-merge with tag <default> 2015-08-19 23:04:31 +03:00
TeamCityServer
42a6f722c5 Auto-merge with tag <default> 2015-08-19 20:57:24 +03:00
TeamCityServer
1100cd5f6b Auto-merge with tag <default> 2015-08-19 10:45:55 +03:00
TeamCityServer
aa53e883a9 Auto-merge with tag <default> 2015-08-19 04:24:38 +03:00
TeamCityServer
db74c98145 Auto-merge with tag <default> 2015-08-18 20:54:21 +03:00
Yan Zhulanow
b5d9823845 Merge tag 'build-0.13.615' into idea_continuous/br141 2015-08-18 19:04:58 +03:00
TeamCityServer
57e6873e38 Auto-merge with tag <default> 2015-08-14 23:11:07 +03:00
TeamCityServer
db104cd818 Auto-merge with tag <default> 2015-08-14 20:08:36 +03:00
TeamCityServer
246535a43e Auto-merge with tag <default> 2015-08-13 19:10:15 +03:00
TeamCityServer
8cf466f98b Auto-merge with tag <default> 2015-08-13 19:07:26 +03:00
TeamCityServer
ed13cc3a4a Auto-merge with tag <default> 2015-08-13 17:39:18 +03:00
TeamCityServer
d846189110 Auto-merge with tag <default> 2015-08-12 20:38:59 +03:00
TeamCityServer
9afee1d2d9 Auto-merge with tag <default> 2015-08-12 19:01:25 +03:00
TeamCityServer
17e1abeead Auto-merge with tag <default> 2015-08-12 16:51:38 +03:00
TeamCityServer
48ac53da40 Auto-merge with tag <default> 2015-08-12 14:20:35 +03:00
TeamCityServer
a4f80bdaa1 Auto-merge with tag <default> 2015-08-11 21:56:02 +03:00
TeamCityServer
ab0add4c9b Auto-merge with tag <default> 2015-08-11 15:28:21 +03:00
TeamCityServer
2ebbc432d7 Auto-merge with tag <default> 2015-08-11 15:08:12 +03:00
TeamCityServer
c5e9e04899 Auto-merge with tag <default> 2015-08-11 12:13:47 +03:00
TeamCityServer
1ed0d4f56a Auto-merge with tag <default> 2015-08-11 07:03:48 +03:00
TeamCityServer
961d691656 Auto-merge with tag <default> 2015-08-11 06:14:09 +03:00
TeamCityServer
c970c96b71 Auto-merge with tag <default> 2015-08-11 04:06:15 +03:00
TeamCityServer
c6d3ff7936 Auto-merge with tag <default> 2015-08-10 23:46:41 +03:00
TeamCityServer
825946f2d7 Auto-merge with tag <default> 2015-08-10 19:31:08 +03:00
TeamCityServer
07152e250f Auto-merge with tag <default> 2015-08-10 18:26:12 +03:00
Nikolay Krasko
dab7669ea4 Merge tag 'build-0.13.480' into idea_continuous/br141
Conflicts:
	.idea/runConfigurations/All_Tests.xml
	.idea/runConfigurations/IDEA.xml
	.idea/runConfigurations/IDEA__No_ProcessCanceledException_.xml
	idea/src/META-INF/plugin.xml
	update_dependencies.xml
2015-08-10 15:20:12 +03:00
Natalia Ukhorskaya
7a7de2c70e Do not fail of kotlin-runtime.jar is not found 2015-08-07 10:17:52 +03:00
Natalia Ukhorskaya
a01c77b478 Fix debugger tests 2015-08-06 18:20:02 +03:00
Natalia Ukhorskaya
a2e131d825 Fix compilation errors 2015-08-06 17:41:14 +03:00
Natalia Ukhorskaya
6f3275e644 Revert SourcePositionHighlighter for lambdas ff0a064908 2015-08-06 16:08:18 +03:00
Natalia Ukhorskaya
2187afa611 Merge tag 'build-0.13.394' into idea_continuous/br141
Conflicts:
	idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/testUtils.kt
	idea/src/META-INF/plugin.xml
	j2k/src/org/jetbrains/kotlin/j2k/JavaToKotlinTranslator.kt
	update_dependencies.xml
2015-08-06 16:02:27 +03:00
teamcityserver
83103e83b5 Auto-merge with tag <default> 2015-07-27 14:08:26 +03:00
teamcityserver
8459e515dd Auto-merge with tag <default> 2015-07-24 23:58:14 +03:00
teamcityserver
479010a800 Auto-merge with tag <default> 2015-07-24 20:44:07 +03:00
teamcityserver
03e874fcb7 Auto-merge with tag <default> 2015-07-24 16:41:57 +03:00
Nikolay Krasko
a6275bbe1a Downgrade to idea 141 API 2015-07-24 13:38:09 +03:00
Nikolay Krasko
0c14e93f2b Merge tag 'build-0.13.109' into idea_continuous/br141
Conflicts:
	idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt
	plugins/android-idea-plugin/android-idea-plugin.iml
2015-07-24 12:51:57 +03:00
Nikolay Krasko
cd7ec5d473 Revert "Removed workaround for exception in IDEA."
2820dbf181
2015-07-24 12:46:39 +03:00
Nikolay Krasko
134c54196f Use templates in non-inline mode 2015-07-24 12:46:36 +03:00
Nikolay Krasko
c6954c12d3 Revert "Minor test data update after moving to new idea"
87e94aa20b
2015-07-24 12:45:15 +03:00
Nikolay Krasko
9fe570240a Fix compilation 2015-07-23 15:44:58 +03:00
Nikolay Krasko
bf1e81cbf0 Merge tag 'build-0.13.76' into idea_continuous/br141 2015-07-23 14:52:16 +03:00
Nikolay Krasko
2a1a389cac Merge tag 'build-0.13.47' into idea_continuous/br141
Conflicts:
	.idea/runConfigurations/IDEA.xml
	.idea/runConfigurations/IDEA__No_ProcessCanceledException_.xml
	idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/testUtils.kt
2015-07-22 13:21:32 +03:00
Nikolay Krasko
f149d48791 Ignore tests 2015-07-21 14:27:19 +03:00
Nikolay Krasko
600c567224 Restore mapping for built-in psi files 2015-07-21 13:50:38 +03:00
Nikolay Krasko
5556d4f77c Insert non-inline template in idea 141 2015-07-21 13:27:52 +03:00
teamcityserver
464c4d281f Auto-merge with tag <default> 2015-07-21 12:12:46 +03:00
teamcityserver
8bf23ba822 Auto-merge with tag <default> 2015-07-21 00:19:46 +03:00
Nikolay Krasko
d90fa2baa2 Revert "Move kotlin runtime jars to separate folder and attach them during debug idea start"
This reverts commit 796e05983c.
2015-07-20 17:15:36 +03:00
Nikolay Krasko
d3f62b0b51 Merge tag 'build-0.12.1313' into idea_continuous/br141
Conflicts:
	update_dependencies.xml
2015-07-20 16:44:21 +03:00
Nikolay Krasko
dd4cbf1eb6 Port KotlinLightPlatformCodeInsightFixtureTestCase 2015-07-17 20:41:50 +03:00
Nikolay Krasko
4d275967fa Revert debugger api 2015-07-17 20:41:48 +03:00
Nikolay Krasko
99ad891e8e Downgrade multi-selection check to old API 2015-07-17 19:28:05 +03:00
Nikolay Krasko
74a717564c Merge tag 'build-0.12.1274' into idea_continuous/br141
Conflicts:
	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureUsageProcessor.java
	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/JavaMethodDeferredKotlinUsage.kt
	idea/testData/debugger/tinyApp/outs/frameSimple.out
	idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamBefore.1.kt
	idea/testData/refactoring/changeSignature/JavaMethodOverridesChangeParamBefore.java
	idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamAfter.1.kt
	idea/testData/refactoring/changeSignature/JavaMethodOverridesReplaceParamAfter.java
	idea/tests/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureTest.java
	idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractReferenceResolveTest.java
	plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/KotlinAndroidTestCase.java
	plugins/android-idea-plugin/tests/org/jetbrains/kotlin/android/KotlinAndroidTestCaseBase.java
	update_dependencies.xml
2015-07-17 19:03:07 +03:00
Nikolay Krasko
f6f95c2767 Restore usages filtering 2015-07-06 20:28:39 +03:00
Nikolay Krasko
e21b7c336f Revert "Change Signature: Support Kotlin functions overriding Java methods"
This reverts commit 4eeff03525.

Conflicts:
	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureProcessor.java
	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureUsageProcessor.java
	idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/JavaMethodDeferredKotlinUsage.kt
	idea/tests/org/jetbrains/kotlin/idea/refactoring/changeSignature/JetChangeSignatureTest.java
2015-07-06 20:27:38 +03:00
Nikolay Krasko
102becd680 Revert creating new psi file each time in provider file create
Revert "Getting decompiled file content through getPsi() doesn't work for local class files" (d564f44aad)
Revert "Refactoring: rename file" (dde295011b)
Revert "Create file must return new file, as old one can be invalidated (KT-8266)" (ef477f99e9)
2015-07-06 19:17:21 +03:00
Nikolay Krasko
8c7f9dc7b3 Compilation fix: no junit-4.12 in idea 141. Replace with 4.11 2015-07-06 19:17:20 +03:00
Nikolay Krasko
31b43ea690 Compilation fix: no parameter with empty parameters list 2015-07-06 19:17:19 +03:00
Nikolay Krasko
9e2474b685 More memory for tests 2015-07-06 19:17:18 +03:00
Nikolay Krasko
5d03ade4f5 Revert commits responsible for update to idea 15
ef7cc6ae10 "Force openning project"
3d8f04e4fe "Update test data: Idea can't parse description with "ctrl+ alt + b" promotion"
2820dbf181 "Removed workaround for exception in IDEA."
66a4e0f299 "Mute error about org.iq80.snappy.Snappy"
549987b27f "Ignore actions with empty message"
94db320f7a "Update hack for restore validity of builtins files"
53ab02e877 "Generate private constructors for enums in coverter"
b64aff9f9a "Add actions with "Supress " prefix to irrelevant group"
737ad5b9e0 "Search in index under read action in tests"
3136e5eefd "removed registration of deprecated extensions points without implementations"
c2a1dc4c90 "Fix compilation errors"
aaa4e747db "Fix tests: type for string  isn't now rendered by default"
ba6b378378 "Fix tests: register JavaClassSupers service in WebDemoTest"
757b963731 "Register JavaClassSupers service"
73b2de95ab "Create from Usage: Do not delete temporary file as this operation is not supported by IDEA anymore"
8e51f1aadd "Idea moved to junit-4.12"
2ebdd32267 "Make compatible with 142 idea branch"
2536648e60 "Update to Idea 15 eap (142.2491.1)"
2015-07-06 19:17:17 +03:00
470 changed files with 1147 additions and 3812 deletions

View File

@@ -1,16 +1,16 @@
<component name="libraryTable">
<library name="junit-4.12">
<library name="junit-4.11">
<ANNOTATIONS>
<root url="file://$PROJECT_DIR$/annotations" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/hamcrest-core-1.3.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/junit-4.12.jar!/" />
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/junit-4.11.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/dependencies/hamcrest-core-1.3-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/junit-4.12-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/dependencies/junit-4.11-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

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

View File

@@ -2,7 +2,7 @@
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="Application" factoryName="Application" singleton="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config-idea -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Didea.ProcessCanceledException=disabled -Dkotlin.internal.mode.enabled=true -Didea.additional.classpath=../idea-kotlin-runtime/kotlin-runtime.jar,../idea-kotlin-runtime/kotlin-reflect.jar" />
<option name="VM_PARAMETERS" value="-Xmx800m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config-idea -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin,$PROJECT_DIR$/out/artifacts/KotlinAndroidExtensions -Didea.ProcessCanceledException=disabled -Dkotlin.internal.mode.enabled=true" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />

View File

@@ -482,7 +482,7 @@
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar" excludes="util.jar"/>
<zipfileset src="${idea.sdk}/lib/jna-platform.jar"/>
<zipfileset src="${idea.sdk}/lib/jna-utils.jar"/>
<zipfileset src="${idea.sdk}/lib/oromatcher.jar"/>
<zipfileset src="${idea.sdk}/jps/jps-model.jar"/>
<zipfileset src="${dependencies.dir}/jline.jar"/>

View File

@@ -171,7 +171,7 @@ public object TypeIntrinsics {
*/
private fun getFunctionTypeArity(jetType: KotlinType): Int {
val classFqName = getClassFqName(jetType) ?: return -1
val match = KOTLIN_FUNCTION_INTERFACE_REGEX.match(classFqName) ?: return -1
val match = KOTLIN_FUNCTION_INTERFACE_REGEX.find(classFqName) ?: return -1
return Integer.valueOf(match.groups[1]!!.value)
}

View File

@@ -26,6 +26,8 @@ public class CLIConfigurationKeys {
CompilerConfigurationKey.create("message collector");
public static final CompilerConfigurationKey<List<CompilerPlugin>> COMPILER_PLUGINS =
CompilerConfigurationKey.create("compiler plugins");
public static final CompilerConfigurationKey<Boolean> REPORT_PERF =
CompilerConfigurationKey.create("enable perf");
private CLIConfigurationKeys() {
}

View File

@@ -62,6 +62,7 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
val configuration = CompilerConfiguration()
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageSeverityCollector)
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf)
if (IncrementalCompilation.isEnabled()) {
val incrementalCompilationComponents = services.get(javaClass<IncrementalCompilationComponents>())
@@ -249,8 +250,10 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
}
public fun reportPerf(configuration: CompilerConfiguration, message: String) {
val collector = configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]!!
collector.report(CompilerMessageSeverity.INFO, "PERF: " + message, CompilerMessageLocation.NO_LOCATION)
if (configuration[CLIConfigurationKeys.REPORT_PERF] == true) {
val collector = configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]!!
collector.report(CompilerMessageSeverity.INFO, "PERF: " + message, CompilerMessageLocation.NO_LOCATION)
}
}
fun reportGCTime(configuration: CompilerConfiguration) {

View File

@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.descriptors.PackagePartProvider
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
import java.io.EOFException
public class JvmPackagePartProvider(val env: KotlinCoreEnvironment) : PackagePartProvider {
@@ -47,7 +48,11 @@ public class JvmPackagePartProvider(val env: KotlinCoreEnvironment) : PackagePar
}.filterNotNull().flatMap {
it.children.filter { it.name.endsWith(ModuleMapping.MAPPING_FILE_EXT) }.toList<VirtualFile>()
}.map {
ModuleMapping.create(it.contentsToByteArray())
try {
ModuleMapping.create(it.contentsToByteArray())
} catch (e: EOFException) {
throw RuntimeException("Error on reading package parts for '$packageFqName' package in '$it', roots: $roots", e)
}
}
return mappings.map { it.findPackageParts(packageFqName) }.filterNotNull().flatMap { it.parts }.distinct()

View File

@@ -29,6 +29,7 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.extensions.*
import com.intellij.openapi.fileTypes.ContentBasedFileSubstitutor
import com.intellij.openapi.fileTypes.FileTypeExtensionPoint
import com.intellij.openapi.fileTypes.PlainTextFileType
import com.intellij.openapi.project.Project
@@ -40,14 +41,13 @@ import com.intellij.psi.FileContextProvider
import com.intellij.psi.PsiElementFinder
import com.intellij.psi.augment.PsiAugmentProvider
import com.intellij.psi.compiled.ClassFileDecompilers
import com.intellij.psi.impl.JavaClassSupersImpl
import com.intellij.psi.impl.PsiElementFinderImpl
import com.intellij.psi.impl.PsiTreeChangePreprocessor
import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy
import com.intellij.psi.impl.compiled.ClsStubBuilderFactory
import com.intellij.psi.impl.file.impl.JavaFileManager
import com.intellij.psi.meta.MetaDataContributor
import com.intellij.psi.stubs.BinaryFileStubBuilders
import com.intellij.psi.util.JavaClassSupers
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.asJava.JavaElementFinder
import org.jetbrains.kotlin.asJava.KtLightClassForFacade
@@ -255,7 +255,7 @@ public class KotlinCoreEnvironment private constructor(
val appEnv = getOrCreateApplicationEnvironmentForProduction(configuration, configFilePaths)
// Disposing of the environment is unsafe in production then parallel builds are enabled, but turning it off universally
// breaks a lot of tests, therefore it is disabled for production and enabled for tests
if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY) == null || appEnv.application.isUnitTestMode) {
if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY) == null) {
// JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ)
// All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well
Disposer.register(parentDisposable, object : Disposable {
@@ -330,10 +330,12 @@ public class KotlinCoreEnvironment private constructor(
}
private fun registerAppExtensionPoints() {
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ContentBasedFileSubstitutor.EP_NAME, javaClass<ContentBasedFileSubstitutor>())
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), BinaryFileStubBuilders.EP_NAME, javaClass<FileTypeExtensionPoint<Any>>())
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileContextProvider.EP_NAME, javaClass<FileContextProvider>())
//
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), MetaDataContributor.EP_NAME, javaClass<MetaDataContributor>())
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsStubBuilderFactory.EP_NAME, javaClass<ClsStubBuilderFactory<*>>())
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME, javaClass<PsiAugmentProvider>())
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), JavaMainMethodProvider.EP_NAME, javaClass<JavaMainMethodProvider>())
//
@@ -373,7 +375,6 @@ public class KotlinCoreEnvironment private constructor(
registerFileType(KotlinFileType.INSTANCE, KotlinParserDefinition.STD_SCRIPT_SUFFIX)
registerParserDefinition(KotlinParserDefinition())
getApplication().registerService(javaClass<KotlinBinaryClassCache>(), KotlinBinaryClassCache())
getApplication().registerService(javaClass<JavaClassSupers>(), javaClass<JavaClassSupersImpl>())
}
}
@@ -395,7 +396,6 @@ public class KotlinCoreEnvironment private constructor(
private fun registerProjectServicesForCLI(projectEnvironment: JavaCoreProjectEnvironment) {
with (projectEnvironment.getProject()) {
registerService(javaClass<CoreJavaFileManager>(), ServiceManager.getService(this, javaClass<JavaFileManager>()) as CoreJavaFileManager)
val cliLightClassGenerationSupport = CliLightClassGenerationSupport(this)
registerService(javaClass<LightClassGenerationSupport>(), cliLightClassGenerationSupport)
registerService(javaClass<CliLightClassGenerationSupport>(), cliLightClassGenerationSupport)

View File

@@ -11,7 +11,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-runtime" level="project" />
<orderEntry type="library" name="intellij-core" level="project" />
<orderEntry type="library" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="javax.inject" level="project" />
<orderEntry type="library" name="junit-4.11" level="project" />
</component>
</module>

View File

@@ -20,9 +20,11 @@ import com.intellij.util.containers.ContainerUtil
import java.lang.reflect.*
import java.util.ArrayList
import java.util.LinkedHashSet
import java.util.concurrent.ConcurrentHashMap
private object ClassTraversalCache {
private val cache = ContainerUtil.createConcurrentWeakKeySoftValueMap<Class<*>, ClassInfo>()
private val cache = ContainerUtil.createConcurrentWeakKeySoftValueMap<Class<*>, ClassInfo>(
100, 0.75f, Runtime.getRuntime().availableProcessors(), ContainerUtil.canonicalStrategy())
fun getClassInfo(c: Class<*>): ClassInfo {
val classInfo = cache.get(c)

View File

@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.psi.stubs.elements
import com.intellij.psi.PsiElement
import com.intellij.psi.stubs.StubElement
import com.intellij.psi.stubs.StubInputStream
import com.intellij.psi.stubs.StubOutputStream

View File

@@ -33,10 +33,10 @@ class DataFlowValue(val id: Any?, val type: KotlinType, val kind: DataFlowValue.
STABLE_VALUE("stable"),
// Member value with open / custom getter
// Smart casts are not safe
MEMBER_VALUE_WITH_GETTER("custom getter", "member value that has open or custom getter"),
PROPERTY_WITH_GETTER("custom getter", "property that has open or custom getter"),
// Protected / public member value from another module
// Smart casts are not safe
ALIEN_PUBLIC_VALUE("alien public", "public API member value declared in different module"),
ALIEN_PUBLIC_PROPERTY("alien public", "public API property declared in different module"),
// Local variable not yet captured by a changing closure
// Smart casts are safe but possible changes in loops / closures ahead must be taken into account
PREDICTABLE_VARIABLE("predictable", "local variable that can be changed since the check in a loop"),
@@ -45,7 +45,7 @@ class DataFlowValue(val id: Any?, val type: KotlinType, val kind: DataFlowValue.
UNPREDICTABLE_VARIABLE("unpredictable", "local variable that is captured by a changing closure"),
// Member variable regardless of its visibility
// Smart casts are not safe
MEMBER_VARIABLE("member", "member variable that can be changed from another thread"),
MUTABLE_PROPERTY("member", "mutable property that could have been changed by this time"),
// Some complex expression
// Smart casts are not safe
OTHER("other", "complex expression");

View File

@@ -377,13 +377,13 @@ public class DataFlowValueFactory {
}
private static Kind propertyKind(@NotNull PropertyDescriptor propertyDescriptor, @Nullable ModuleDescriptor usageModule) {
if (propertyDescriptor.isVar()) return MEMBER_VARIABLE;
if (!isFinal(propertyDescriptor)) return MEMBER_VALUE_WITH_GETTER;
if (!hasDefaultGetter(propertyDescriptor)) return MEMBER_VALUE_WITH_GETTER;
if (propertyDescriptor.isVar()) return MUTABLE_PROPERTY;
if (!isFinal(propertyDescriptor)) return PROPERTY_WITH_GETTER;
if (!hasDefaultGetter(propertyDescriptor)) return PROPERTY_WITH_GETTER;
if (!invisibleFromOtherModules(propertyDescriptor)) {
ModuleDescriptor declarationModule = DescriptorUtils.getContainingModule(propertyDescriptor);
if (usageModule == null || !usageModule.equals(declarationModule)) {
return ALIEN_PUBLIC_VALUE;
return ALIEN_PUBLIC_PROPERTY;
}
}
return STABLE_VALUE;
@@ -400,7 +400,7 @@ public class DataFlowValueFactory {
}
if (!(variableDescriptor instanceof LocalVariableDescriptor) && !(variableDescriptor instanceof ParameterDescriptor)) return OTHER;
if (!variableDescriptor.isVar()) return STABLE_VALUE;
if (variableDescriptor instanceof SyntheticFieldDescriptor) return MEMBER_VARIABLE;
if (variableDescriptor instanceof SyntheticFieldDescriptor) return MUTABLE_PROPERTY;
// Local variable classification: PREDICTABLE or UNPREDICTABLE
PreliminaryDeclarationVisitor preliminaryVisitor =

View File

@@ -254,8 +254,8 @@ public object KotlinCompilerClient {
private fun String.extractPortFromRunFilename(digest: String): Int =
makeRunFilenameString(timestamp = "[0-9TZ:\\.\\+-]+", digest = digest, port = "(\\d+)", escapeSequence = "\\").toRegex()
.match(this)
makeRunFilenameString(timestamp = "[0-9TZ:\\.\\+-]+", digest = digest, port = "(\\d+)", escapeSequence = "\\").toRegex()
.find(this)
?.groups?.get(1)
?.value?.toInt()
?: 0

View File

@@ -129,7 +129,7 @@ public abstract class ByteIterator : kotlin.Iterator<kotlin.Byte> {
}
@kotlin.Deprecated(level = DeprecationLevel.WARNING, message = "Use IntProgression instead.", replaceWith = kotlin.ReplaceWith(expression = "IntProgression", imports = {})) public open class ByteProgression : kotlin.Progression<kotlin.Byte> {
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use ByteProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "ByteProgression.fromClosedRange(start, end, increment)", imports = {})) public constructor ByteProgression(/*0*/ start: kotlin.Byte, /*1*/ endInclusive: kotlin.Byte, /*2*/ increment: kotlin.Int)
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use ByteProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "ByteProgression.fromClosedRange(start, endInclusive, increment)", imports = {})) public constructor ByteProgression(/*0*/ start: kotlin.Byte, /*1*/ endInclusive: kotlin.Byte, /*2*/ increment: kotlin.Int)
@kotlin.Deprecated(message = "Use 'last' property instead.") public open override /*1*/ val end: kotlin.Byte
public open override /*1*/ fun <get-end>(): kotlin.Byte
public final val first: kotlin.Byte
@@ -231,7 +231,7 @@ public abstract class CharIterator : kotlin.Iterator<kotlin.Char> {
}
public open class CharProgression : kotlin.Progression<kotlin.Char> {
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use CharProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "CharProgression.fromClosedRange(start, end, increment)", imports = {})) public constructor CharProgression(/*0*/ start: kotlin.Char, /*1*/ endInclusive: kotlin.Char, /*2*/ increment: kotlin.Int)
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use CharProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "CharProgression.fromClosedRange(start, endInclusive, increment)", imports = {})) public constructor CharProgression(/*0*/ start: kotlin.Char, /*1*/ endInclusive: kotlin.Char, /*2*/ increment: kotlin.Int)
@kotlin.Deprecated(message = "Use 'last' property instead.") public open override /*1*/ val end: kotlin.Char
public open override /*1*/ fun <get-end>(): kotlin.Char
public final val first: kotlin.Char
@@ -650,7 +650,7 @@ public abstract class IntIterator : kotlin.Iterator<kotlin.Int> {
}
public open class IntProgression : kotlin.Progression<kotlin.Int> {
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use IntProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "IntProgression.fromClosedRange(start, end, increment)", imports = {})) public constructor IntProgression(/*0*/ start: kotlin.Int, /*1*/ endInclusive: kotlin.Int, /*2*/ increment: kotlin.Int)
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use IntProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "IntProgression.fromClosedRange(start, endInclusive, increment)", imports = {})) public constructor IntProgression(/*0*/ start: kotlin.Int, /*1*/ endInclusive: kotlin.Int, /*2*/ increment: kotlin.Int)
@kotlin.Deprecated(message = "Use 'last' property instead.") public open override /*1*/ val end: kotlin.Int
public open override /*1*/ fun <get-end>(): kotlin.Int
public final val first: kotlin.Int
@@ -840,7 +840,7 @@ public abstract class LongIterator : kotlin.Iterator<kotlin.Long> {
}
public open class LongProgression : kotlin.Progression<kotlin.Long> {
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use LongProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "LongProgression.fromClosedRange(start, end, increment)", imports = {})) public constructor LongProgression(/*0*/ start: kotlin.Long, /*1*/ endInclusive: kotlin.Long, /*2*/ increment: kotlin.Long)
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use LongProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "LongProgression.fromClosedRange(start, endInclusive, increment)", imports = {})) public constructor LongProgression(/*0*/ start: kotlin.Long, /*1*/ endInclusive: kotlin.Long, /*2*/ increment: kotlin.Long)
@kotlin.Deprecated(message = "Use 'last' property instead.") public open override /*1*/ val end: kotlin.Long
public open override /*1*/ fun <get-end>(): kotlin.Long
public final val first: kotlin.Long
@@ -1165,7 +1165,7 @@ public abstract class ShortIterator : kotlin.Iterator<kotlin.Short> {
}
@kotlin.Deprecated(level = DeprecationLevel.WARNING, message = "Use IntProgression instead.", replaceWith = kotlin.ReplaceWith(expression = "IntProgression", imports = {})) public open class ShortProgression : kotlin.Progression<kotlin.Short> {
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use ShortProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "ShortProgression.fromClosedRange(start, end, increment)", imports = {})) public constructor ShortProgression(/*0*/ start: kotlin.Short, /*1*/ endInclusive: kotlin.Short, /*2*/ increment: kotlin.Int)
/*primary*/ @kotlin.Deprecated(message = "This constructor will become private soon. Use ShortProgression.fromClosedRange() instead.", replaceWith = kotlin.ReplaceWith(expression = "ShortProgression.fromClosedRange(start, endInclusive, increment)", imports = {})) public constructor ShortProgression(/*0*/ start: kotlin.Short, /*1*/ endInclusive: kotlin.Short, /*2*/ increment: kotlin.Int)
@kotlin.Deprecated(message = "Use 'last' property instead.") public open override /*1*/ val end: kotlin.Short
public open override /*1*/ fun <get-end>(): kotlin.Short
public final val first: kotlin.Short

View File

@@ -10,35 +10,35 @@ fun box(): String {
val s = J::s
// Check that correct reflection objects are created
assert(i !is KMutableProperty<*>, "Fail i class: ${i.javaClass}")
assert(s is KMutableProperty<*>, "Fail s class: ${s.javaClass}")
assert(i !is KMutableProperty<*>) { "Fail i class: ${i.javaClass}" }
assert(s is KMutableProperty<*>) { "Fail s class: ${s.javaClass}" }
// Check that no Method objects are created for such properties
assert(i.javaGetter == null, "Fail i getter")
assert(s.javaGetter == null, "Fail s getter")
assert(s.javaSetter == null, "Fail s setter")
assert(i.javaGetter == null) { "Fail i getter" }
assert(s.javaGetter == null) { "Fail s getter" }
assert(s.javaSetter == null) { "Fail s setter" }
// Check that correct Field objects are created
val ji = i.javaField!!
val js = s.javaField!!
assert(Modifier.isFinal(ji.getModifiers()), "Fail i final")
assert(!Modifier.isFinal(js.getModifiers()), "Fail s final")
assert(Modifier.isFinal(ji.getModifiers())) { "Fail i final" }
assert(!Modifier.isFinal(js.getModifiers())) { "Fail s final" }
// Check that those Field objects work as expected
val a = J(42, "abc")
assert(ji.get(a) == 42, "Fail ji get")
assert(js.get(a) == "abc", "Fail js get")
assert(ji.get(a) == 42) { "Fail ji get" }
assert(js.get(a) == "abc") { "Fail js get" }
js.set(a, "def")
assert(js.get(a) == "def", "Fail js set")
assert(a.s == "def", "Fail js access")
assert(js.get(a) == "def") { "Fail js set" }
assert(a.s == "def") { "Fail js access" }
// Check that valid Kotlin reflection objects are created by those Field objects
val ki = ji.kotlin as KProperty1<J, Int>
val ks = js.kotlin as KMutableProperty1<J, String>
assert(ki.get(a) == 42, "Fail ki get")
assert(ks.get(a) == "def", "Fail ks get")
assert(ki.get(a) == 42) { "Fail ki get" }
assert(ks.get(a) == "def") { "Fail ks get" }
ks.set(a, "ghi")
assert(ks.get(a) == "ghi", "Fail ks set")
assert(ks.get(a) == "ghi") { "Fail ks set" }
return "OK"
}

View File

@@ -21,7 +21,7 @@ fun testProperLineNumber(): String {
fail()
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("chainCalls.kt:21" != actual) {
return "fail 2: ${actual}"
@@ -34,7 +34,7 @@ fun testProperLineNumber(): String {
fail()
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("chainCalls.kt:34" != actual) {
return "fail 3: ${actual}"
@@ -46,7 +46,7 @@ fun testProperLineNumber(): String {
test().fail()
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("chainCalls.kt:46" != actual) {
return "fail 4: ${actual}"

View File

@@ -18,7 +18,7 @@ fun testProperLineNumber(): String {
test()
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("infixCalls.kt:17" != actual) {
return "fail 1: ${actual}"
@@ -30,7 +30,7 @@ fun testProperLineNumber(): String {
call() fail test()
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("infixCalls.kt:30" != actual) {
return "fail 1: ${actual}"

View File

@@ -18,7 +18,7 @@ fun testProperLineNumberAfterInline(): String {
test())
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:17" != actual) {
return "fail 2: ${actual}"
@@ -36,7 +36,7 @@ fun testProperLineForOtherParameters(): String {
fail())
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:35" != actual) {
return "fail 3: ${actual}"
@@ -50,7 +50,7 @@ fun testProperLineForOtherParameters(): String {
test())
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:49" != actual) {
return "fail 4: ${actual}"
@@ -62,7 +62,7 @@ fun testProperLineForOtherParameters(): String {
checkEquals(fail(), test())
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:62" != actual) {
return "fail 5: ${actual}"
@@ -74,7 +74,7 @@ fun testProperLineForOtherParameters(): String {
checkEquals(fail(), test())
}
catch(e: AssertionError) {
val entry = e.getStackTrace()!![1]
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:74" != actual) {
return "fail 6: ${actual}"

View File

@@ -11,14 +11,14 @@ class Secondary {
}
fun check(f: KFunction<Any>) {
assert(f.javaMethod == null, "Fail f method")
assert(f.javaConstructor != null, "Fail f constructor")
assert(f.javaMethod == null) { "Fail f method" }
assert(f.javaConstructor != null) { "Fail f constructor" }
val c = f.javaConstructor!!
assert(c.kotlinFunction != null, "Fail m function")
assert(c.kotlinFunction != null) { "Fail m function" }
val ff = c.kotlinFunction!!
assert(f == ff, "Fail f != ff")
assert(f == ff) { "Fail f != ff" }
}
fun box(): String {

View File

@@ -19,9 +19,9 @@ fun box(): String {
assertEquals(setter, Class.forName("ExtensionPropertyKt").getMethod("setExt", javaClass<K>(), javaClass<Double>()))
val k = K(42L)
assert(getter.invoke(null, k) == 42.0, "Fail k getter")
assert(getter.invoke(null, k) == 42.0) { "Fail k getter" }
setter.invoke(null, k, -239.0)
assert(getter.invoke(null, k) == -239.0, "Fail k setter")
assert(getter.invoke(null, k) == -239.0) { "Fail k setter" }
return "OK"
}

View File

@@ -8,14 +8,14 @@ fun bar(s: String): Int = s.length()
fun String.baz(): Int = this.length()
fun check(f: KFunction<Int>) {
assert(f.javaConstructor == null, "Fail f constructor")
assert(f.javaMethod != null, "Fail f method")
assert(f.javaConstructor == null) { "Fail f constructor" }
assert(f.javaMethod != null) { "Fail f method" }
val m = f.javaMethod!!
assert(m.kotlinFunction != null, "Fail m function")
assert(m.kotlinFunction != null) { "Fail m function" }
val ff = m.kotlinFunction!!
assert(f == ff, "Fail f != ff")
assert(f == ff) { "Fail f != ff" }
}
fun box(): String {

View File

@@ -6,7 +6,7 @@ class K(var value: Long)
fun box(): String {
val p = K::value
assert(p.javaField != null, "Fail p field")
assert(p.javaField != null) { "Fail p field" }
val getter = p.javaGetter!!
val setter = p.javaSetter!!
@@ -15,9 +15,9 @@ fun box(): String {
assertEquals(setter, javaClass<K>().getMethod("setValue", javaClass<Long>()))
val k = K(42L)
assert(getter.invoke(k) == 42L, "Fail k getter")
assert(getter.invoke(k) == 42L) { "Fail k getter" }
setter.invoke(k, -239L)
assert(getter.invoke(k) == -239L, "Fail k setter")
assert(getter.invoke(k) == -239L) { "Fail k setter" }
return "OK"
}

View File

@@ -6,7 +6,7 @@ var topLevel = "123"
fun box(): String {
val p = ::topLevel
assert(p.javaField != null, "Fail p field")
assert(p.javaField != null) { "Fail p field" }
val field = p.javaField!!
val className = field.getDeclaringClass().getName()
assertEquals("TopLevelPropertyKt", className)
@@ -17,9 +17,9 @@ fun box(): String {
assertEquals(getter, Class.forName("TopLevelPropertyKt").getMethod("getTopLevel"))
assertEquals(setter, Class.forName("TopLevelPropertyKt").getMethod("setTopLevel", javaClass<String>()))
assert(getter.invoke(null) == "123", "Fail k getter")
assert(getter.invoke(null) == "123") { "Fail k getter" }
setter.invoke(null, "456")
assert(getter.invoke(null) == "456", "Fail k setter")
assert(getter.invoke(null) == "456") { "Fail k setter" }
return "OK"
}

View File

@@ -1,7 +1,7 @@
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class test.Sub, unresolved supertypes: Super
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInJava/source.kt:5:22: error: unresolved reference: foo
fun bar() = SubSub().foo()
^
COMPILATION_ERROR
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class test.Sub, unresolved supertypes: Super
COMPILATION_ERROR

View File

@@ -1,7 +1,7 @@
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class test.Sub, unresolved supertypes: test.Super
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInKotlin/source.kt:5:22: error: unresolved reference: foo
fun bar() = SubSub().foo()
^
COMPILATION_ERROR
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class test.Sub, unresolved supertypes: test.Super
COMPILATION_ERROR

View File

@@ -8,5 +8,5 @@ fun main(args: Array<String>) {
val annotationClass = javaClass<AnnotationClass>()
val annotation = klass.getAnnotation(annotationClass)!!
val value = annotation.value
require(value == "100 20000 2000000 2000000000000 3.14 3.14 true \u03c0 :)", "Annotation value: $value")
require(value == "100 20000 2000000 2000000000000 3.14 3.14 true \u03c0 :)", { "Annotation value: $value" })
}

View File

@@ -12,4 +12,4 @@ fun foo() {
.bar()
}
// 2 3 7 8 9 8 9 11 12 11 12 17 13
// 2 3 7 8 9 11 12 17 13

View File

@@ -12,4 +12,4 @@ fun foo() {
.bar()
}
// 2 3 7 8 9 8 9 11 12 11 17 12 17 13
// 2 3 7 8 9 11 17 12 17 13

View File

@@ -3,4 +3,4 @@ fun foo() {
42
}
// 2 3 4
// 3 4

View File

@@ -9,4 +9,4 @@ fun foo(i: Int = 1) {
inline fun bar(i: Int = 1) {
}
// 2 3 9 10 4 7 6 10 9 10
// 2 3 9 4 7 6 10 9 10

View File

@@ -13,4 +13,4 @@ inline fun foo(f: () -> Unit) {
f()
}
// 2 12 13 3 14 6 12 13 7 14 9 12 13 14
// 2 12 3 6 12 7 9 12 13 14

View File

@@ -12,4 +12,4 @@ fun foo() {
}
}
// 2 3 5 6 8 9 11 8 13
// 2 3 5 8 9 11 8 13

View File

@@ -12,4 +12,4 @@ fun foo() {
}
}
// 2 3 5 6 8 9 11 8 13
// 2 3 5 8 9 11 8 13

View File

@@ -16,4 +16,4 @@ fun foo() {
}
}
// 2 3 7 5 7 8 10 11 15 13 15 10 17
// 2 3 7 5 7 10 11 15 13 15 10 17

View File

@@ -12,4 +12,4 @@ fun foo() {
}
}
// 2 3 5 6 8 9 11 8 13
// 2 3 5 8 9 11 8 13

View File

@@ -12,4 +12,4 @@ fun foo(x: Int) {
}
}
// 2 3 4 5 6 8 9 10 11 8 13
// 3 4 5 9 10 11 8 13

View File

@@ -12,4 +12,4 @@ fun foo(x: Int) {
}
}
// 2 3 4 5 6 8 9 10 11 8 13
// 2 3 4 5 8 9 10 11 8 13

View File

@@ -42,7 +42,7 @@ internal fun Sequence<String>.ifNotContainsSequence(patternsIter: Iterator<LineP
{ acc, line ->
when {
!acc.iter.isValid() -> return@fold acc
acc.iter.value.regex.match(line)?.let { acc.iter.value.matchCheck(it) } ?: false -> acc.nextLineAndPattern()
acc.iter.value.regex.find(line)?.let { acc.iter.value.matchCheck(it) } ?: false -> acc.nextLineAndPattern()
else -> acc.nextLine()
}
}

View File

@@ -23,7 +23,7 @@ package kotlin
* A progression of values of type `Byte`.
*/
public open class ByteProgression
@Deprecated("This constructor will become private soon. Use ByteProgression.fromClosedRange() instead.", ReplaceWith("ByteProgression.fromClosedRange(start, end, increment)"))
@Deprecated("This constructor will become private soon. Use ByteProgression.fromClosedRange() instead.", ReplaceWith("ByteProgression.fromClosedRange(start, endInclusive, increment)"))
public constructor
(
start: Byte,
@@ -81,7 +81,7 @@ public open class ByteProgression
* A progression of values of type `Char`.
*/
public open class CharProgression
@Deprecated("This constructor will become private soon. Use CharProgression.fromClosedRange() instead.", ReplaceWith("CharProgression.fromClosedRange(start, end, increment)"))
@Deprecated("This constructor will become private soon. Use CharProgression.fromClosedRange() instead.", ReplaceWith("CharProgression.fromClosedRange(start, endInclusive, increment)"))
public constructor
(
start: Char,
@@ -140,7 +140,7 @@ public open class CharProgression
* A progression of values of type `Short`.
*/
public open class ShortProgression
@Deprecated("This constructor will become private soon. Use ShortProgression.fromClosedRange() instead.", ReplaceWith("ShortProgression.fromClosedRange(start, end, increment)"))
@Deprecated("This constructor will become private soon. Use ShortProgression.fromClosedRange() instead.", ReplaceWith("ShortProgression.fromClosedRange(start, endInclusive, increment)"))
public constructor
(
start: Short,
@@ -198,7 +198,7 @@ public open class ShortProgression
* A progression of values of type `Int`.
*/
public open class IntProgression
@Deprecated("This constructor will become private soon. Use IntProgression.fromClosedRange() instead.", ReplaceWith("IntProgression.fromClosedRange(start, end, increment)"))
@Deprecated("This constructor will become private soon. Use IntProgression.fromClosedRange() instead.", ReplaceWith("IntProgression.fromClosedRange(start, endInclusive, increment)"))
public constructor
(
start: Int,
@@ -256,7 +256,7 @@ public open class IntProgression
* A progression of values of type `Long`.
*/
public open class LongProgression
@Deprecated("This constructor will become private soon. Use LongProgression.fromClosedRange() instead.", ReplaceWith("LongProgression.fromClosedRange(start, end, increment)"))
@Deprecated("This constructor will become private soon. Use LongProgression.fromClosedRange() instead.", ReplaceWith("LongProgression.fromClosedRange(start, endInclusive, increment)"))
public constructor
(
start: Long,

View File

@@ -19,7 +19,6 @@ package kotlin.reflect.jvm.internal
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import java.lang.reflect.Field
import kotlin.reflect.KProperty
import kotlin.reflect.jvm.internal.JvmPropertySignature.JavaField
import kotlin.reflect.jvm.internal.JvmPropertySignature.KotlinProperty
@@ -40,11 +39,13 @@ internal abstract class DescriptorBasedProperty<out R> protected constructor(
descriptor
)
override val descriptor: PropertyDescriptor by ReflectProperties.lazySoft<PropertyDescriptor>(descriptorInitialValue) {
private val descriptor_ = ReflectProperties.lazySoft<PropertyDescriptor>(descriptorInitialValue) {
container.findPropertyDescriptor(name, signature)
}
val javaField: Field? by ReflectProperties.lazySoft {
override val descriptor: PropertyDescriptor get() = descriptor_()
private val javaField_ = ReflectProperties.lazySoft {
val jvmSignature = RuntimeTypeMapper.mapPropertySignature(descriptor)
when (jvmSignature) {
is KotlinProperty -> {
@@ -56,6 +57,9 @@ internal abstract class DescriptorBasedProperty<out R> protected constructor(
}
}
// Used in subclasses as an implementation of an irrelevant property from KPropertyImpl
val javaField: Field? get() = javaField_()
override fun equals(other: Any?): Boolean {
val that = other.asKPropertyImpl() ?: return false
return container == that.container && name == that.name && signature == that.signature

View File

@@ -25,7 +25,9 @@ internal open class KProperty0Impl<out R> : DescriptorBasedProperty<R>, KPropert
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
override val getter by ReflectProperties.lazy { Getter(this) }
private val getter_ = ReflectProperties.lazy { Getter(this) }
override val getter: Getter<R> get() = getter_()
override fun get(): R = getter.call()
@@ -39,7 +41,9 @@ internal open class KMutableProperty0Impl<R> : KProperty0Impl<R>, KMutableProper
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
override val setter by ReflectProperties.lazy { Setter(this) }
private val setter_ = ReflectProperties.lazy { Setter(this) }
override val setter: Setter<R> get() = setter_()
override fun set(value: R) = setter.call(value)

View File

@@ -25,7 +25,9 @@ internal open class KProperty1Impl<T, out R> : DescriptorBasedProperty<R>, KProp
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
override val getter by ReflectProperties.lazy { Getter(this) }
private val getter_ = ReflectProperties.lazy { Getter(this) }
override val getter: Getter<T, R> get() = getter_()
override fun get(receiver: T): R = getter.call(receiver)
@@ -39,7 +41,9 @@ internal open class KMutableProperty1Impl<T, R> : KProperty1Impl<T, R>, KMutable
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
override val setter by ReflectProperties.lazy { Setter(this) }
private val setter_ = ReflectProperties.lazy { Setter(this) }
override val setter: Setter<T, R> get() = setter_()
override fun set(receiver: T, value: R) = setter.call(receiver, value)

View File

@@ -25,7 +25,9 @@ internal open class KProperty2Impl<D, E, out R> : DescriptorBasedProperty<R>, KP
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
override val getter by ReflectProperties.lazy { Getter(this) }
private val getter_ = ReflectProperties.lazy { Getter(this) }
override val getter: Getter<D, E, R> get() = getter_()
override fun get(receiver1: D, receiver2: E): R = getter.call(receiver1, receiver2)
@@ -39,7 +41,9 @@ internal open class KMutableProperty2Impl<D, E, R> : KProperty2Impl<D, E, R>, KM
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
override val setter by ReflectProperties.lazy { Setter(this) }
private val setter_ = ReflectProperties.lazy { Setter(this) }
override val setter: Setter<D, E, R> get() = setter_()
override fun set(receiver1: D, receiver2: E, value: R) = setter.call(receiver1, receiver2, value)

View File

@@ -10,6 +10,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-runtime" level="project" />
<orderEntry type="library" name="asm" level="project" />
<orderEntry type="library" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" scope="TEST" name="junit-4.11" level="project" />
</component>
</module>
</module>

View File

@@ -56,7 +56,7 @@ class GenerateProgressions(out: PrintWriter) : BuiltInsSourceGenerator(out) {
* A progression of values of type `$t`.
*/
public open class $progression
@Deprecated("This constructor will become private soon. Use $progression.fromClosedRange() instead.", ReplaceWith("$progression.fromClosedRange(start, end, increment)"))
@Deprecated("This constructor will become private soon. Use $progression.fromClosedRange() instead.", ReplaceWith("$progression.fromClosedRange(start, endInclusive, increment)"))
public constructor
(
start: $t,

View File

@@ -691,7 +691,6 @@ fun main(args: Array<String>) {
model("debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto", testMethod = "doSmartStepIntoTest", testClassName = "SmartStepInto")
model("debugger/tinyApp/src/stepping/stepInto", testMethod = "doStepIntoTest", testClassName = "StepIntoOnly")
model("debugger/tinyApp/src/stepping/stepOut", testMethod = "doStepOutTest")
model("debugger/tinyApp/src/stepping/stepOver", testMethod = "doStepOverTest")
model("debugger/tinyApp/src/stepping/filters", testMethod = "doStepIntoTest")
model("debugger/tinyApp/src/stepping/custom", testMethod = "doCustomTest")
}

View File

@@ -31,7 +31,9 @@ import java.io.IOException
public class ClsJavaStubByVirtualFileCache {
private class CachedJavaStub(val modificationStamp: Long, val javaFileStub: PsiJavaFileStubImpl)
private val cache = ContainerUtil.createConcurrentWeakKeySoftValueMap<VirtualFile, CachedJavaStub>()
private val cache = ContainerUtil.createConcurrentWeakKeySoftValueMap<VirtualFile, CachedJavaStub>(
100, 0.75f, Runtime.getRuntime().availableProcessors(), ContainerUtil.canonicalStrategy<VirtualFile>()
)
public fun get(classFile: VirtualFile): PsiJavaFileStubImpl? {
val cached = cache.get(classFile)

View File

@@ -0,0 +1,43 @@
/*
* 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.idea.configuration
import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.openapi.editor.markup.GutterIconRenderer
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.idea.KotlinIcons
import org.jetbrains.kotlin.idea.MainFunctionDetector
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.KtVisitorVoid
import org.jetbrains.kotlin.resolve.BindingContext
import javax.swing.Icon
class MainFunctionGutterVisitor(val holder: AnnotationHolder, val bindingContext: BindingContext) : KtVisitorVoid() {
override fun visitNamedFunction(function: KtNamedFunction) {
if (MainFunctionDetector(bindingContext).isMain(function)) {
function.nameIdentifier?.let { nameIdentifier ->
holder.createInfoAnnotation(nameIdentifier, "Run configuration from here").gutterIconRenderer = MainGutterIconRenderer(nameIdentifier)
}
}
}
}
class MainGutterIconRenderer(val nameIdentifier: PsiElement) : GutterIconRenderer() {
override fun getIcon(): Icon = KotlinIcons.LAUNCH
override fun hashCode(): Int = nameIdentifier.hashCode()
override fun equals(other: Any?): Boolean = other is MainGutterIconRenderer && other.nameIdentifier == nameIdentifier
}

View File

@@ -16,11 +16,11 @@
package org.jetbrains.kotlin.idea.decompiler
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
import org.jetbrains.kotlin.idea.decompiler.textBuilder.buildDecompiledTextFromJsMetadata
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
public class KotlinJavascriptMetaFile(provider: KotlinClassFileViewProviderBase) : KtClsFileBase(provider) {
public class KotlinJavascriptMetaFile(provider: KotlinJavascriptMetaFileViewProvider) : KtClsFileBase(provider) {
protected override val decompiledText: LockedClearableLazyValue<DecompiledText> = LockedClearableLazyValue(Any()) {
buildDecompiledTextFromJsMetadata(getVirtualFile())
}

View File

@@ -16,11 +16,12 @@
package org.jetbrains.kotlin.idea.decompiler
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
import com.intellij.psi.SingleRootFileViewProvider
import org.jetbrains.kotlin.idea.decompiler.textBuilder.buildDecompiledText
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
public class KtClsFile(provider: KotlinClassFileViewProviderBase) : KtClsFileBase(provider) {
public class KtClsFile(provider: SingleRootFileViewProvider) : KtClsFileBase(provider) {
protected override val decompiledText: LockedClearableLazyValue<DecompiledText> = LockedClearableLazyValue(Any()) {
buildDecompiledText(getVirtualFile())
}

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.idea.decompiler
import com.intellij.openapi.util.TextRange
import com.intellij.psi.FileViewProvider
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
@@ -30,7 +31,7 @@ import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
public abstract class KtClsFileBase(val provider: KotlinClassFileViewProviderBase) : KtFile(provider, true) {
public abstract class KtClsFileBase(val provider: FileViewProvider) : KtFile(provider, true) {
protected abstract val decompiledText: LockedClearableLazyValue<DecompiledText>
public fun getDeclarationForDescriptor(descriptor: DeclarationDescriptor): KtDeclaration? {
@@ -65,7 +66,6 @@ public abstract class KtClsFileBase(val provider: KotlinClassFileViewProviderBas
override fun onContentReload() {
super.onContentReload()
provider.content.drop()
decompiledText.drop()
}

View File

@@ -16,69 +16,54 @@
package org.jetbrains.kotlin.idea.decompiler
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.fileTypes.FileType
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.FileIndexFacade
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiManager
import com.intellij.psi.SingleRootFileViewProvider
import com.intellij.psi.impl.source.PsiFileImpl
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
abstract class KotlinClassFileViewProviderBase(
manager: PsiManager,
file: VirtualFile,
physical: Boolean) : SingleRootFileViewProvider(manager, file, physical, KotlinLanguage.INSTANCE) {
val content : LockedClearableLazyValue<String> = LockedClearableLazyValue(Any()) {
val psiFile = createFile(manager.getProject(), file, KotlinFileType.INSTANCE)
val text = psiFile?.getText() ?: ""
(psiFile as? PsiFileImpl)?.markInvalidated()
text
}
override fun createFile(project: Project, file: VirtualFile, fileType: FileType): PsiFile? {
// Workaround for KT-8344
return super.createFile(project, file, fileType)
}
override fun getContents() = content.get()
}
public class KotlinClassFileViewProvider(
manager: PsiManager,
file: VirtualFile,
val file: VirtualFile,
physical: Boolean,
val isInternal: Boolean) : KotlinClassFileViewProviderBase(manager, file, physical) {
val isInternal: Boolean) : SingleRootFileViewProvider(manager, file, physical, KotlinLanguage.INSTANCE) {
override fun createFile(project: Project, file: VirtualFile, fileType: FileType): PsiFile? {
val fileIndex = ServiceManager.getService(project, javaClass<FileIndexFacade>())
if (!fileIndex.isInLibraryClasses(file) && fileIndex.isInSource(file)) {
return null
}
if (isInternal) return null
return KtClsFile(this)
val ktClsFile by lazy() {
//TODO: check index that file is library file, as in ClassFileViewProvider
if (!isInternal) KtClsFile(this) else null
}
override fun createCopy(copy: VirtualFile) = KotlinClassFileViewProvider(getManager(), copy, false, isInternal)
override fun getContents(): CharSequence {
return ktClsFile?.getText() ?: ""
}
override fun createFile(project: Project, file: VirtualFile, fileType: FileType): PsiFile? = ktClsFile
override fun createCopy(copy: VirtualFile): SingleRootFileViewProvider {
return KotlinClassFileViewProvider(getManager(), copy, false, isInternal)
}
}
public class KotlinJavascriptMetaFileViewProvider (
manager: PsiManager,
val file: VirtualFile,
physical: Boolean,
val isInternal: Boolean) : KotlinClassFileViewProviderBase(manager, file, physical) {
val isInternal: Boolean) : SingleRootFileViewProvider(manager, file, physical, KotlinLanguage.INSTANCE) {
//TODO: check index that file is library file, as in ClassFileViewProvider
override fun createFile(project: Project, file: VirtualFile, fileType: FileType) =
val ktJsMetaFile by lazy(this) {
//TODO: check index that file is library file, as in ClassFileViewProvider
if (!isInternal) KotlinJavascriptMetaFile(this) else null
}
override fun createCopy(copy: VirtualFile) = KotlinJavascriptMetaFileViewProvider(getManager(), copy, false, isInternal)
}
override fun getContents(): CharSequence {
return ktJsMetaFile?.getText() ?: ""
}
override fun createFile(project: Project, file: VirtualFile, fileType: FileType): PsiFile? = ktJsMetaFile
override fun createCopy(copy: VirtualFile): SingleRootFileViewProvider {
return KotlinJavascriptMetaFileViewProvider(getManager(), copy, false, isInternal)
}
}

View File

@@ -41,6 +41,8 @@ public class JsLibraryStdDetectionUtil {
}
public static boolean hasJsStdlibJar(@NotNull Library library) {
if (!KotlinJavaScriptLibraryDetectionUtil.isKotlinJavaScriptLibrary(library)) return false;
List<VirtualFile> classes = Arrays.asList(library.getFiles(OrderRootType.CLASSES));
return getJsLibraryStdVersion(classes, false) != null;
}

View File

@@ -41,6 +41,8 @@ import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFullyAndGetResult
import org.jetbrains.kotlin.idea.configuration.MainFunctionGutterVisitor
import org.jetbrains.kotlin.idea.kdoc.KDocHighlightingVisitor
import org.jetbrains.kotlin.idea.quickfix.QuickFixes
import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil

View File

@@ -82,7 +82,9 @@ class OverridesCompletion(
AllIcons.Gutter.ImplementingMethod
else
AllIcons.Gutter.OverridingMethod
val icon = RowIcon(baseIcon, additionalIcon)
val icon = RowIcon(2)
icon.setIcon(baseIcon, 0)
icon.setIcon(additionalIcon, 1)
val baseClassDeclaration = DescriptorToSourceUtilsIde.getAnyDeclaration(position.project, baseClass)
val baseClassIcon = KotlinDescriptorIconProvider.getIcon(baseClass, baseClassDeclaration, 0)

View File

@@ -66,5 +66,5 @@ public open class KotlinJavaScriptHandler(path: String) : ArchiveHandler(path) {
shortName: String,
isDirectory: Boolean,
val content: ByteArray
) : EntryInfo(shortName, isDirectory, ArchiveHandler.DEFAULT_LENGTH, ArchiveHandler.DEFAULT_TIMESTAMP, parent)
) : EntryInfo(parent, shortName, isDirectory, ArchiveHandler.DEFAULT_LENGTH, ArchiveHandler.DEFAULT_TIMESTAMP)
}

View File

@@ -167,7 +167,8 @@ public class KotlinConsoleRunner(
val placeholderAttrs = TextAttributes()
placeholderAttrs.foregroundColor = ReplColors.PLACEHOLDER_COLOR
placeholderAttrs.fontType = Font.ITALIC
editor.setPlaceholderAttributes(placeholderAttrs)
// editor.setPlaceholderAttributes(placeholderAttrs)
}
private fun disableCompletion(consoleView: LanguageConsoleView) {
@@ -180,7 +181,7 @@ public class KotlinConsoleRunner(
fun configureEditorGutter(editor: EditorEx, color: Color, iconWithTooltip: IconWithTooltip): RangeHighlighter {
editor.settings.isLineMarkerAreaShown = true // hack to show gutter
editor.settings.isFoldingOutlineShown = true
editor.gutterComponentEx.setPaintBackground(true)
// editor.gutterComponentEx.setPaintBackground(true)
val editorColorScheme = editor.colorsScheme
editorColorScheme.setColor(EditorColors.GUTTER_BACKGROUND, color)
editor.colorsScheme = editorColorScheme

View File

@@ -18,20 +18,20 @@ package org.jetbrains.kotlin.idea.test
import com.intellij.codeInsight.daemon.impl.EditorTracker
import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.Presentation
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.actionSystem.ex.ActionManagerEx
import com.intellij.openapi.editor.ex.EditorEx
import com.intellij.openapi.startup.StartupManager
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.text.StringUtil
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import com.intellij.psi.PsiManager
import com.intellij.psi.impl.PsiManagerEx
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.LoggedErrorProcessor
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.apache.log4j.Logger
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode
import org.jetbrains.kotlin.idea.references.BuiltInsReferenceResolver
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.utils.addIfNotNull
@@ -58,7 +58,7 @@ public abstract class KotlinLightCodeInsightFixtureTestCase : LightCodeInsightFi
invalidateLibraryCache(project)
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: org.apache.log4j.Logger) {
exceptions.addIfNotNull(t)
super.processError(message, t, details, logger)
}
@@ -71,13 +71,16 @@ public abstract class KotlinLightCodeInsightFixtureTestCase : LightCodeInsightFi
KotlinInternalMode.enabled = kotlinInternalModeOriginalValue
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
unInvalidateBuiltinsAndStdLib(getProject()) {
super.tearDown()
}
val builtInsSources = BuiltInsReferenceResolver.getInstance(getProject()).builtInsSources!!
val fileManager = (PsiManager.getInstance(getProject()) as PsiManagerEx).getFileManager()
if (exceptions.isNotEmpty()) {
exceptions.forEach { it.printStackTrace() }
throw AssertionError("Exceptions in other threads happened")
super.tearDown()
// Restore mapping between PsiFiles and VirtualFiles dropped in FileManager.cleanupForNextTest(),
// otherwise built-ins psi elements will become invalid in next test.
for (source in builtInsSources) {
val provider = source.getViewProvider()
fileManager.setViewProvider(provider.getVirtualFile(), provider)
}
}

View File

@@ -19,8 +19,11 @@ package org.jetbrains.kotlin.idea.test
import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.openapi.startup.StartupManager
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import com.intellij.psi.PsiManager
import com.intellij.psi.impl.PsiManagerEx
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode
import org.jetbrains.kotlin.idea.references.BuiltInsReferenceResolver
import org.jetbrains.kotlin.test.KotlinTestUtils
public abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeInsightFixtureTestCase() {
@@ -40,8 +43,16 @@ public abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatfo
KotlinInternalMode.enabled = kotlinInternalModeOriginalValue
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
unInvalidateBuiltinsAndStdLib(getProject()) {
super.tearDown()
val builtInsSources = BuiltInsReferenceResolver.getInstance(getProject()).builtInsSources!!
val fileManager = (PsiManager.getInstance(getProject()) as PsiManagerEx).getFileManager()
super.tearDown()
// Restore mapping between PsiFiles and VirtualFiles dropped in FileManager.cleanupForNextTest(),
// otherwise built-ins psi elements will become invalid in next test.
for (source in builtInsSources) {
val provider = source.getViewProvider()
fileManager.setViewProvider(provider.getVirtualFile(), provider)
}
}
}

View File

@@ -25,7 +25,7 @@ import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.testFramework.LightProjectDescriptor;
import org.jetbrains.annotations.NotNull;
public class KotlinLightProjectDescriptor extends LightProjectDescriptor {
public class KotlinLightProjectDescriptor implements LightProjectDescriptor {
protected KotlinLightProjectDescriptor() {
}

View File

@@ -76,18 +76,23 @@ public fun Module.configureAs(kind: ModuleKind) {
}
public fun KtFile.dumpTextWithErrors(): String {
return diagnosticsHeader() + getText()
}
public fun KtFile.diagnosticsHeader(): String {
val diagnostics = analyzeFullyAndGetResult().bindingContext.getDiagnostics()
val errors = diagnostics.filter { it.getSeverity() == Severity.ERROR }
if (errors.isEmpty()) return getText()
val header = errors.map { "// ERROR: " + DefaultErrorMessages.render(it).replace('\n', ' ') }.joinToString("\n", postfix = "\n")
return header + getText()
if (errors.isEmpty()) return ""
return errors.map { "// ERROR: " + DefaultErrorMessages.render(it).replace('\n', ' ') }.joinToString("\n", postfix = "\n")
}
public fun closeAndDeleteProject(): Unit =
ApplicationManager.getApplication().runWriteAction() { LightPlatformTestCase.closeAndDeleteProject() }
public fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: RunnableWithException) {
// Doesn't work in idea 141. Shouldn't be used.
val builtInsSources = BuiltInsReferenceResolver.getInstance(project).builtInsSources!!
val fileManager = (PsiManager.getInstance(project) as PsiManagerEx).getFileManager()
val stdLibViewProviders = HashSet<KotlinClassFileViewProvider>()
val vFileToViewProviderMap = ((PsiManager.getInstance(project) as PsiManagerEx).fileManager as FileManagerImpl).vFileToViewProviderMap
@@ -99,11 +104,11 @@ public fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: RunnableWit
runnable.run()
// Base tearDown() invalidates builtins and std-lib files. Restore them with brute force.
// Restore mapping between PsiFiles and VirtualFiles dropped in FileManager.cleanupForNextTest(),
// otherwise built-ins psi elements will become invalid in next test.
fun unInvalidateFile(file: PsiFileImpl) {
val field = javaClass<PsiFileImpl>().getDeclaredField("myInvalidated")!!
field.setAccessible(true)
field.set(file, false)
val provider = file.getViewProvider();
fileManager.setViewProvider(provider.getVirtualFile(), provider);
}
builtInsSources.forEach { unInvalidateFile(it) }

View File

@@ -88,7 +88,19 @@ private fun String.amendNextLinesIfNeeded(reader: OutputLineReader): String {
nextLine = reader.readLine()
}
if (nextLine != null) reader.pushBack(nextLine)
if (nextLine != null) {
// This code is needed for compatibility with AS 2.0 and IDEA 15.0, because of difference in android plugins
val positionField = try {
reader.javaClass.getDeclaredField("myPosition")
}
catch(e: Throwable) {
null
}
if (positionField != null) {
positionField.isAccessible = true
positionField.setInt(reader, positionField.getInt(reader) - 1)
}
}
return builder.toString()
}

View File

@@ -0,0 +1,5 @@
<html>
<body>
Reports any <b>import</b> statements in Kotlin code that are unused.
</body>
</html>

View File

@@ -6,7 +6,7 @@
<version>@snapshot@</version>
<vendor url="http://www.jetbrains.com">JetBrains s.r.o.</vendor>
<idea-version since-build="143.379.11" until-build="144.9999"/>
<idea-version since-build="141.1009.5" until-build="141.9999999"/>
<depends optional="true" config-file="junit.xml">JUnit</depends>
<depends optional="true" config-file="gradle.xml">org.jetbrains.plugins.gradle</depends>
@@ -499,16 +499,12 @@
<debuggerClassFilterProvider implementation="org.jetbrains.kotlin.idea.debugger.filter.KotlinDebuggerInternalClassesFilterProvider"/>
<debugger.nodeRenderer implementation="org.jetbrains.kotlin.idea.debugger.render.KotlinClassWithDelegatedPropertyRenderer"/>
<debugger.sourcePositionProvider implementation="org.jetbrains.kotlin.idea.debugger.KotlinSourcePositionProvider"/>
<debugger.sourcePositionHighlighter implementation="org.jetbrains.kotlin.idea.debugger.KotlinSourcePositionHighlighter"/>
<debugger.frameExtraVarsProvider implementation="org.jetbrains.kotlin.idea.debugger.KotlinFrameExtraVariablesProvider"/>
<debugger.extraSteppingFilter implementation="org.jetbrains.kotlin.idea.ExtraSteppingFilter"/>
<xdebugger.settings implementation="org.jetbrains.kotlin.idea.debugger.KotlinDebuggerSettings"/>
<xdebugger.breakpointType implementation="org.jetbrains.kotlin.idea.debugger.breakpoints.KotlinFieldBreakpointType"/>
<xdebugger.breakpointType implementation="org.jetbrains.kotlin.idea.debugger.breakpoints.KotlinLineBreakpointType" order="first"/>
<debugger.syntheticProvider implementation="org.jetbrains.kotlin.idea.debugger.filter.KotlinSyntheticTypeComponentProvider"/>
<debugger.javaBreakpointHandlerFactory implementation="org.jetbrains.kotlin.idea.debugger.breakpoints.KotlinFieldBreakpointHandlerFactory"/>
<debugger.javaBreakpointHandlerFactory implementation="org.jetbrains.kotlin.idea.debugger.breakpoints.KotlinLineBreakpointHandlerFactory"/>
<debugger.jvmSteppingCommandProvider implementation="org.jetbrains.kotlin.idea.debugger.stepping.KotlinSteppingCommandProvider"/>
<debugger.javaBreakpointHandlerFactory implementation="org.jetbrains.kotlin.idea.debugger.breakpoints.KotlinBreakpointHandlerFactory"/>
<codeInsight.implementMethod language="kotlin" implementationClass="org.jetbrains.kotlin.idea.core.overrideImplement.ImplementMembersHandler"/>
<codeInsight.overrideMethod language="kotlin" implementationClass="org.jetbrains.kotlin.idea.core.overrideImplement.OverrideMembersHandler"/>
@@ -524,10 +520,6 @@
<callHierarchyProvider
language="kotlin"
implementationClass="org.jetbrains.kotlin.idea.hierarchy.calls.KotlinCallHierarchyProvider" />
<callHierarchyProvider
language="JAVA"
implementationClass="org.jetbrains.kotlin.idea.hierarchy.calls.KotlinCallHierarchyProvider"
order="first" />
<methodHierarchyProvider
language="kotlin"
implementationClass="org.jetbrains.kotlin.idea.hierarchy.overrides.KotlinOverrideHierarchyProvider" />
@@ -1094,11 +1086,6 @@
<category>Kotlin</category>
</intentionAction>
<intentionAction>
<className>org.jetbrains.kotlin.idea.intentions.ObjectLiteralToLambdaIntention</className>
<category>Kotlin</category>
</intentionAction>
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.ObjectLiteralToLambdaInspection"
displayName="Convert object literal to lambda"
groupName="Kotlin"
@@ -1219,7 +1206,7 @@
level="WARNING"
/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.UnusedImportInspection"
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.KotlinUnusedImportInspection"
displayName="Unused import directive"
groupName="Kotlin"
enabledByDefault="true"

View File

@@ -77,7 +77,7 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos
for (host in RepositoryHelper.getPluginHosts().filterNotNull()) {
val plugins = try {
RepositoryHelper.loadPlugins(host, null)
RepositoryHelper.loadPlugins(host, null, null)
}
catch(e: Exception) {
LOG.info("Checking custom plugin reposityory $host failed", e)

View File

@@ -62,7 +62,7 @@ public class ShowExpressionTypeAction : AnAction() {
}
if (type != null) {
HintManager.getInstance().showInformationHint(editor, renderTypeHint(type))
HintManager.getInstance().showInformationHint(editor, "<html>" + DescriptorRenderer.HTML.renderType(type) + "</html>")
}
}

View File

@@ -18,9 +18,6 @@ package org.jetbrains.kotlin.idea.actions.generate
import com.intellij.codeInsight.CodeInsightActionHandler
import com.intellij.codeInsight.actions.CodeInsightAction
import com.intellij.lang.ContextAwareActionHandler
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.Presentation
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
@@ -30,21 +27,6 @@ import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
abstract class KotlinGenerateActionBase() : CodeInsightAction(), CodeInsightActionHandler {
override fun update(
presentation: Presentation,
project: Project,
editor: Editor,
file: PsiFile,
dataContext: DataContext,
actionPlace: String?
) {
super.update(presentation, project, editor, file, dataContext, actionPlace)
val actionHandler = handler
if (actionHandler is ContextAwareActionHandler && presentation.isEnabled) {
presentation.isEnabled = actionHandler.isAvailableForQuickList(editor, file, dataContext)
}
}
override fun isValidForFile(project: Project, editor: Editor, file: PsiFile): Boolean {
if (file !is KtFile || file.isCompiled) return false

View File

@@ -1,41 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.codeInsight
import com.intellij.lang.ExpressionTypeProvider
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.idea.actions.ShowExpressionTypeAction
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.KtStatementExpression
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
class KotlinExpressionTypeProvider : ExpressionTypeProvider<KtExpression>() {
override fun getExpressionsAt(elementAt: PsiElement): List<KtExpression> =
elementAt.parentsWithSelf.filterIsInstance<KtExpression>().filterNot { it.shouldSkip() }.toArrayList()
private fun KtExpression.shouldSkip(): Boolean {
return this is KtStatementExpression && this !is KtFunction
}
override fun getInformationHint(element: KtExpression): String {
val type = ShowExpressionTypeAction.typeByExpression(element) ?: return "Type is unknown"
return ShowExpressionTypeAction.renderTypeHint(type)
}
override fun getErrorHint(): String = "No expression found"
}

View File

@@ -21,9 +21,6 @@ import com.intellij.debugger.NoDataException
import com.intellij.debugger.SourcePosition
import com.intellij.debugger.engine.DebugProcess
import com.intellij.debugger.engine.DebugProcessImpl
import com.intellij.debugger.engine.PositionManagerEx
import com.intellij.debugger.engine.evaluation.EvaluationContext
import com.intellij.debugger.jdi.StackFrameProxyImpl
import com.intellij.debugger.requests.ClassPrepareRequestor
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.roots.libraries.LibraryUtil
@@ -33,8 +30,6 @@ import com.intellij.psi.impl.compiled.ClsFileImpl
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.psi.util.*
import com.intellij.util.ThreeState
import com.intellij.xdebugger.frame.XStackFrame
import com.sun.jdi.AbsentInformationException
import com.sun.jdi.Location
import com.sun.jdi.ReferenceType
@@ -54,7 +49,6 @@ import org.jetbrains.kotlin.fileClasses.getInternalName
import org.jetbrains.kotlin.idea.caches.resolve.analyzeAndGetResult
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFullyAndGetResult
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
import org.jetbrains.kotlin.idea.debugger.breakpoints.getLambdasAtLineIfAny
import org.jetbrains.kotlin.idea.decompiler.KtClsFile
import org.jetbrains.kotlin.idea.search.usagesSearch.isImportUsage
import org.jetbrains.kotlin.idea.util.DebuggerUtils
@@ -65,24 +59,15 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.utils.toReadOnlyList
import java.util.*
import com.intellij.debugger.engine.DebuggerUtils as JDebuggerUtils
class PositionedElement(val className: String?, val element: PsiElement?)
public class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiRequestPositionManager, PositionManagerEx() {
public class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiRequestPositionManager {
private val myTypeMappers = WeakHashMap<String, CachedValue<JetTypeMapper>>()
override fun evaluateCondition(context: EvaluationContext, frame: StackFrameProxyImpl, location: Location, expression: String): ThreeState? {
return ThreeState.UNSURE
}
override fun createStackFrame(frame: StackFrameProxyImpl, debugProcess: DebugProcessImpl, location: Location): XStackFrame? {
return KotlinStackFrame(frame)
}
override fun getSourcePosition(location: Location?): SourcePosition? {
if (location == null) {
throw NoDataException.INSTANCE
@@ -137,7 +122,10 @@ public class KotlinPositionManager(private val myDebugProcess: DebugProcess) : M
val end = CodeInsightUtils.getEndLineOffset(file, lineNumber)
if (start == null || end == null) return null
val literalsOrFunctions = getLambdasAtLineIfAny(file, lineNumber)
val literalsOrFunctions = CodeInsightUtils.
findElementsOfClassInRange(file, start, end, KtFunctionLiteral::class.java, KtNamedFunction::class.java).
filter { KtPsiUtil.getParentCallIfPresent(it as KtExpression) != null }
if (literalsOrFunctions.isEmpty()) return null;
val isInLibrary = LibraryUtil.findLibraryEntry(file.virtualFile, file.project) != null
@@ -148,16 +136,17 @@ public class KotlinPositionManager(private val myDebugProcess: DebugProcess) : M
val currentLocationClassName = JvmClassName.byFqNameWithoutInnerClasses(FqName(currentLocationFqName)).internalName
for (literal in literalsOrFunctions) {
if (isInlinedLambda(literal, typeMapper.bindingContext)) {
if (isInsideInlineArgument(literal, location, myDebugProcess as DebugProcessImpl)) {
return literal
val functionLiteral = literal as KtFunction
if (isInlinedLambda(functionLiteral, typeMapper.bindingContext)) {
if (isInsideInlineArgument(functionLiteral, location, myDebugProcess as DebugProcessImpl)) {
return functionLiteral
}
continue
}
val internalClassName = getInternalClassNameForElement(literal.firstChild, typeMapper, file, isInLibrary).className
if (internalClassName == currentLocationClassName) {
return literal
return functionLiteral
}
}
@@ -230,7 +219,7 @@ public class KotlinPositionManager(private val myDebugProcess: DebugProcess) : M
}
private fun classNameForPositionAndInlinedOnes(sourcePosition: SourcePosition): List<String> {
val result = hashSetOf<String>()
val result = arrayListOf<String>()
val name = classNameForPosition(sourcePosition)
if (name != null) {
result.add(name)
@@ -238,22 +227,7 @@ public class KotlinPositionManager(private val myDebugProcess: DebugProcess) : M
val list = findInlinedCalls(sourcePosition.elementAt, sourcePosition.file)
result.addAll(list)
val lambdas = findLambdas(sourcePosition)
result.addAll(lambdas)
return result.toReadOnlyList();
}
private fun findLambdas(sourcePosition: SourcePosition): List<String> {
return runReadAction {
val lambdas = getLambdasAtLineIfAny(sourcePosition)
val file = sourcePosition.file.containingFile as KtFile
val isInLibrary = LibraryUtil.findLibraryEntry(file.virtualFile, file.project) != null
lambdas.map {
val typeMapper = if (!isInLibrary) prepareTypeMapper(file) else createTypeMapperForLibraryFile(it, file)
getInternalClassNameForElement(it, typeMapper, file, isInLibrary).className
}.filterNotNull()
}
return result;
}
public fun classNameForPosition(sourcePosition: SourcePosition): String? {

View File

@@ -1,32 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.debugger
import com.intellij.debugger.SourcePosition
import com.intellij.debugger.engine.SourcePositionHighlighter
import com.intellij.openapi.util.TextRange
import org.jetbrains.kotlin.psi.KtFunctionLiteral
public class KotlinSourcePositionHighlighter: SourcePositionHighlighter() {
override fun getHighlightRange(sourcePosition: SourcePosition?): TextRange? {
val lambda = sourcePosition?.elementAt?.parent
if (lambda is KtFunctionLiteral) {
return lambda.textRange
}
return null
}
}

View File

@@ -1,32 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.debugger
import com.intellij.debugger.engine.JavaStackFrame
import com.intellij.debugger.jdi.LocalVariableProxyImpl
import com.intellij.debugger.jdi.StackFrameProxyImpl
import com.intellij.debugger.ui.impl.watch.MethodsTracker
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl
import org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil
class KotlinStackFrame(frame: StackFrameProxyImpl) : JavaStackFrame(StackFrameDescriptorImpl(frame, MethodsTracker()), true) {
override fun getVisibleVariables(): List<LocalVariableProxyImpl>? {
return super.getVisibleVariables().filter {
!InlineCodegenUtil.isFakeLocalVariableForInline(it.name())
}
}
}

View File

@@ -21,17 +21,11 @@ import com.intellij.debugger.engine.JavaBreakpointHandler
import com.intellij.debugger.engine.JavaBreakpointHandlerFactory
import com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType
public class KotlinFieldBreakpointHandlerFactory : JavaBreakpointHandlerFactory {
public class KotlinBreakpointHandlerFactory: JavaBreakpointHandlerFactory {
override fun createHandler(process: DebugProcessImpl): JavaBreakpointHandler? {
return KotlinFieldBreakpointHandler(process)
}
}
public class KotlinLineBreakpointHandlerFactory: JavaBreakpointHandlerFactory {
override fun createHandler(process: DebugProcessImpl): JavaBreakpointHandler? {
return KotlinLineBreakpointHandler(process)
}
}
public class KotlinFieldBreakpointHandler(process: DebugProcessImpl) : JavaBreakpointHandler(javaClass<KotlinFieldBreakpointType>(), process)
public class KotlinLineBreakpointHandler(process: DebugProcessImpl) : JavaBreakpointHandler(javaClass<KotlinLineBreakpointType>(), process)

View File

@@ -1,151 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.debugger.breakpoints;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.ui.breakpoints.Breakpoint;
import com.intellij.debugger.ui.breakpoints.BreakpointManager;
import com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType;
import com.intellij.debugger.ui.breakpoints.LineBreakpoint;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.breakpoints.XBreakpoint;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
import org.jetbrains.java.debugger.breakpoints.properties.JavaLineBreakpointProperties;
import org.jetbrains.kotlin.idea.KotlinIcons;
import org.jetbrains.kotlin.psi.KtFunction;
import javax.swing.*;
import java.util.List;
public class KotlinLineBreakpointType extends JavaLineBreakpointType {
public KotlinLineBreakpointType() {
super("kotlin-line", "Kotlin Line Breakpoints");
}
@Override
public boolean matchesPosition(@NotNull LineBreakpoint<?> breakpoint, @NotNull SourcePosition position) {
JavaBreakpointProperties properties = getProperties(breakpoint);
if (properties == null || properties instanceof JavaLineBreakpointProperties) {
if (properties != null && ((JavaLineBreakpointProperties)properties).getLambdaOrdinal() == null) return true;
PsiElement containingMethod = getContainingMethod(breakpoint);
if (containingMethod == null) return false;
return inTheMethod(position, containingMethod);
}
return true;
}
@Override
@Nullable
public PsiElement getContainingMethod(@NotNull LineBreakpoint<?> breakpoint) {
SourcePosition position = breakpoint.getSourcePosition();
if (position == null) return null;
JavaBreakpointProperties properties = getProperties(breakpoint);
if (properties instanceof JavaLineBreakpointProperties) {
Integer ordinal = ((JavaLineBreakpointProperties) properties).getLambdaOrdinal();
PsiElement lambda = getLambdaByOrdinal(position, ordinal);
if (lambda != null) return lambda;
}
return getContainingMethod(position.getElementAt());
}
@Nullable
private static JavaBreakpointProperties getProperties(@NotNull LineBreakpoint<?> breakpoint) {
XBreakpoint<?> xBreakpoint = breakpoint.getXBreakpoint();
return xBreakpoint != null ? (JavaBreakpointProperties) xBreakpoint.getProperties() : null;
}
@Nullable
private static KtFunction getLambdaByOrdinal(SourcePosition position, Integer ordinal) {
if (ordinal != null && ordinal >= 0) {
List<KtFunction> lambdas = BreakpointTypeUtilsKt.getLambdasAtLineIfAny(position);
if (lambdas.size() >= ordinal) {
return lambdas.get(ordinal);
}
}
return null;
}
@Nullable
public static PsiElement getContainingMethod(@Nullable PsiElement elem) {
//noinspection unchecked
return PsiTreeUtil.getParentOfType(elem, KtFunction.class);
}
public static boolean inTheMethod(@NotNull SourcePosition pos, @NotNull PsiElement method) {
PsiElement elem = pos.getElementAt();
if (elem == null) return false;
return Comparing.equal(getContainingMethod(elem), method);
}
@Override
public boolean canPutAt(@NotNull VirtualFile file, int line, @NotNull Project project) {
return BreakpointTypeUtilsKt.canPutAt(file, line, project, getClass());
}
@NotNull
@Override
public List<JavaBreakpointVariant> computeVariants(@NotNull Project project, @NotNull XSourcePosition position) {
return BreakpointTypeUtilsKt.computeVariants(project, position, this);
}
@Nullable
@Override
public TextRange getHighlightRange(XLineBreakpoint<JavaLineBreakpointProperties> breakpoint) {
JavaLineBreakpointProperties properties = breakpoint.getProperties();
if (properties != null) {
Integer ordinal = properties.getLambdaOrdinal();
if (ordinal != null) {
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
if (javaBreakpoint instanceof LineBreakpoint) {
SourcePosition position = ((LineBreakpoint) javaBreakpoint).getSourcePosition();
if (position != null) {
KtFunction lambda = getLambdaByOrdinal(position, ordinal);
if (lambda != null) {
return lambda.getTextRange();
}
}
}
}
}
return null;
}
public class ExactKotlinJavaBreakpointVariant extends ExactJavaBreakpointVariant {
public ExactKotlinJavaBreakpointVariant(XSourcePosition position, KtFunction function, Integer lambdaOrdinal) {
super(position, function, lambdaOrdinal);
}
@Override
public Icon getIcon() {
return KotlinIcons.LAMBDA;
}
}
}

View File

@@ -16,32 +16,19 @@
package org.jetbrains.kotlin.idea.debugger.breakpoints
import com.intellij.debugger.SourcePosition
import com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiComment
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiManager
import com.intellij.psi.PsiWhiteSpace
import com.intellij.psi.*
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.xdebugger.XDebuggerUtil
import com.intellij.xdebugger.XSourcePosition
import com.intellij.xdebugger.impl.XSourcePositionImpl
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
import org.jetbrains.kotlin.idea.core.refactoring.getLineEndOffset
import org.jetbrains.kotlin.idea.core.refactoring.getLineNumber
import org.jetbrains.kotlin.idea.core.refactoring.getLineStartOffset
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.resolve.BindingContext
import java.util.*
fun canPutAt(file: VirtualFile, line: Int, project: Project, breakpointTypeClass: Class<*>): Boolean {
val psiFile = PsiManager.getInstance(project).findFile(file)
@@ -74,12 +61,12 @@ fun canPutAt(file: VirtualFile, line: Int, project: Project, breakpointTypeClass
result = KotlinFieldBreakpointType::class.java
}
else {
result = KotlinLineBreakpointType::class.java
result = null
}
return false
}
else {
result = KotlinLineBreakpointType::class.java
result = null
}
return true
@@ -88,73 +75,4 @@ fun canPutAt(file: VirtualFile, line: Int, project: Project, breakpointTypeClass
return result == breakpointTypeClass
}
fun computeVariants(
project: Project, position: XSourcePosition,
kotlinBreakpointType: KotlinLineBreakpointType
): List<JavaLineBreakpointType.JavaBreakpointVariant> {
val file = PsiManager.getInstance(project).findFile(position.file) as? KtFile ?: return emptyList()
val pos = SourcePosition.createFromLine(file, position.line)
val lambdas = getLambdasAtLineIfAny(pos)
if (lambdas.isEmpty()) return emptyList()
val result = LinkedList<JavaLineBreakpointType.JavaBreakpointVariant>()
val mainMethod = KotlinLineBreakpointType.getContainingMethod(pos.elementAt)
if (mainMethod != null) {
result.add((kotlinBreakpointType as JavaLineBreakpointType).ExactJavaBreakpointVariant(
XSourcePositionImpl.createByElement(mainMethod),
mainMethod, -1))
}
lambdas.forEachIndexed { ordinal, lambda ->
result.add(kotlinBreakpointType.ExactKotlinJavaBreakpointVariant(
XSourcePositionImpl.createByElement(lambda.bodyExpression), lambda, ordinal))
}
if (result.size > 1) {
val allBreakpoint = (kotlinBreakpointType as JavaLineBreakpointType).JavaBreakpointVariant(position)
result.addFirst(allBreakpoint)
}
return result
}
fun getLambdasAtLineIfAny(sourcePosition: SourcePosition): List<KtFunction> {
val file = sourcePosition.file as? KtFile ?: return emptyList()
val lineNumber = sourcePosition.line
return getLambdasAtLineIfAny(file, lineNumber)
}
fun getLambdasAtLineIfAny(file: KtFile, line: Int): List<KtFunction> {
var lineStartOffset = file.getLineStartOffset(line) ?: return emptyList()
var lineEndOffset = file.getLineEndOffset(line) ?: return emptyList()
var topMostElement: PsiElement? = null
var elementAt: PsiElement?
while (topMostElement !is KtElement && lineStartOffset < lineEndOffset) {
elementAt = file.findElementAt(lineStartOffset)
if (elementAt != null) {
topMostElement = CodeInsightUtils.getTopmostElementAtOffset(elementAt, lineStartOffset)
}
lineStartOffset++
}
if (topMostElement !is KtElement) return emptyList()
val start = topMostElement.startOffset
val end = topMostElement.endOffset
val allInlineFunctionCalls = CodeInsightUtils.
findElementsOfClassInRange(file, start, end, KtFunction::class.java)
.filter { KtPsiUtil.getParentCallIfPresent(it as KtExpression) != null }
.filterIsInstance<KtFunction>()
.toSet()
return allInlineFunctionCalls.filter {
val statement = (it.bodyExpression as? KtBlockExpression)?.statements?.firstOrNull() ?: it
statement.getLineNumber() == line && statement.getLineNumber(false) == line
}
}

View File

@@ -123,7 +123,7 @@ object KotlinEvaluationBuilder: EvaluatorBuilder {
class KotlinEvaluator(val codeFragment: KtCodeFragment, val sourcePosition: SourcePosition): Evaluator {
override fun evaluate(context: EvaluationContextImpl): Any? {
if (codeFragment.text.isEmpty()) {
return context.debugProcess.virtualMachineProxy.mirrorOfVoid()
return context.debugProcess.virtualMachineProxy.mirrorOf()
}
var isCompiledDataFromCache = true

View File

@@ -75,8 +75,4 @@ class DelegatedPropertyFieldDescriptor(
return getObject().referenceType().methodsByName(JvmAbi.getterName(fieldName))?.firstOrNull()
}
override fun getDeclaredType(): String? {
return findGetterForDelegatedProperty()?.returnType()?.name()
}
}

View File

@@ -1,125 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.debugger.stepping;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.SuspendContextImpl;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.jdi.StackFrameProxyImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiElement;
import com.intellij.xdebugger.impl.XSourcePositionImpl;
import kotlin.IntRange;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.psi.KtFunction;
import org.jetbrains.kotlin.psi.KtFunctionLiteral;
import org.jetbrains.kotlin.psi.KtNamedFunction;
import java.util.List;
public class DebuggerSteppingHelper {
public static DebugProcessImpl.ResumeCommand createStepOverCommand(
final SuspendContextImpl suspendContext,
final boolean ignoreBreakpoints,
final KtFile file,
final IntRange linesRange,
final List<KtFunction> inlineArguments,
final List<PsiElement> additionalElementsToSkip
) {
final DebugProcessImpl debugProcess = suspendContext.getDebugProcess();
return debugProcess.new ResumeCommand(suspendContext) {
@Override
public void contextAction() {
final StackFrameProxyImpl frameProxy = suspendContext.getFrameProxy();
if (frameProxy != null) {
DebugProcessImpl.ResumeCommand runToCursorCommand = ApplicationManager.getApplication().runReadAction(new Computable<DebugProcessImpl.ResumeCommand>() {
@Override
public DebugProcessImpl.ResumeCommand compute() {
try {
XSourcePositionImpl position = KotlinSteppingCommandProviderKt.getStepOverPosition(
frameProxy.location(),
file,
linesRange,
inlineArguments,
additionalElementsToSkip
);
if (position != null) {
return debugProcess.createRunToCursorCommand(suspendContext, position, ignoreBreakpoints);
}
}
catch (EvaluateException ignored) {
}
return null;
}
});
if (runToCursorCommand != null) {
runToCursorCommand.contextAction();
return;
}
}
debugProcess.createStepOutCommand(suspendContext).contextAction();
}
};
}
public static DebugProcessImpl.ResumeCommand createStepOutCommand(
final SuspendContextImpl suspendContext,
final boolean ignoreBreakpoints,
final List<KtNamedFunction> inlineFunctions,
final KtFunctionLiteral inlineArgument
) {
final DebugProcessImpl debugProcess = suspendContext.getDebugProcess();
return debugProcess.new ResumeCommand(suspendContext) {
@Override
public void contextAction() {
final StackFrameProxyImpl frameProxy = suspendContext.getFrameProxy();
if (frameProxy != null) {
DebugProcessImpl.ResumeCommand runToCursorCommand = ApplicationManager.getApplication().runReadAction(new Computable<DebugProcessImpl.ResumeCommand>() {
@Override
public DebugProcessImpl.ResumeCommand compute() {
try {
XSourcePositionImpl position = KotlinSteppingCommandProviderKt.getStepOutPosition(
frameProxy.location(),
suspendContext,
inlineFunctions,
inlineArgument
);
if (position != null) {
return debugProcess.createRunToCursorCommand(suspendContext, position, ignoreBreakpoints);
}
}
catch (EvaluateException ignored) {
}
return null;
}
});
if (runToCursorCommand != null) {
runToCursorCommand.contextAction();
return;
}
}
debugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints).contextAction();
}
};
}
}

View File

@@ -36,11 +36,11 @@ public class KotlinLambdaMethodFilter(
private val myLastStatementLine: Int
init {
val body = lambda.bodyExpression
if (body != null && lambda.isMultiLine()) {
if (lambda.isMultiLine()) {
var firstStatementPosition: SourcePosition? = null
var lastStatementPosition: SourcePosition? = null
val statements = (body as? KtBlockExpression)?.statements ?: listOf(body)
val body = lambda.bodyExpression as KtBlockExpression
val statements = body.statements
if (statements.isNotEmpty()) {
firstStatementPosition = SourcePosition.createFromElement(statements.first())
if (firstStatementPosition != null) {

View File

@@ -30,8 +30,6 @@ public class KotlinLambdaSmartStepTarget(
lines: Range<Int>,
val isInline: Boolean
): SmartStepTarget(label, highlightElement, true, lines) {
override fun getIcon() = KotlinIcons.LAMBDA
fun getLambda() = getHighlightElement() as KtFunction
companion object {

View File

@@ -17,13 +17,6 @@ public class KotlinMethodSmartStepTarget(
highlightElement: PsiElement,
lines: Range<Int>
): SmartStepTarget(label, highlightElement, false, lines) {
override fun getIcon(): Icon? {
return when {
resolvedElement is KtNamedFunction && resolvedElement.getReceiverTypeReference() != null -> KotlinIcons.EXTENSION_FUNCTION
else -> KotlinIcons.FUNCTION
}
}
companion object {
private val renderer = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES.withOptions {
parameterNameRenderingPolicy = ParameterNameRenderingPolicy.NONE

View File

@@ -78,7 +78,7 @@ public class KotlinSmartStepIntoHandler : JvmSmartStepIntoHandler() {
private fun recordFunctionLiteral(function: KtFunction): Boolean {
val context = function.analyze()
val resolvedCall = function.getParentCall(context).getResolvedCall(context)
if (resolvedCall != null) {
if (resolvedCall != null && !InlineUtil.isInline(resolvedCall.getResultingDescriptor())) {
val arguments = resolvedCall.valueArguments
for ((param, argument) in arguments) {
if (argument.arguments.any { getArgumentExpression(it) == function }) {

View File

@@ -1,406 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.debugger.stepping
import com.intellij.debugger.NoDataException
import com.intellij.debugger.SourcePosition
import com.intellij.debugger.engine.DebugProcessImpl
import com.intellij.debugger.engine.SuspendContextImpl
import com.intellij.debugger.impl.DebuggerContextImpl
import com.intellij.debugger.impl.JvmSteppingCommandProvider
import com.intellij.psi.PsiElement
import com.intellij.xdebugger.impl.XSourcePositionImpl
import com.sun.jdi.AbsentInformationException
import com.sun.jdi.Location
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFully
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
import org.jetbrains.kotlin.idea.core.refactoring.getLineEndOffset
import org.jetbrains.kotlin.idea.core.refactoring.getLineNumber
import org.jetbrains.kotlin.idea.core.refactoring.getLineStartOffset
import org.jetbrains.kotlin.idea.util.DebuggerUtils
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.psi.psiUtil.parents
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
public class KotlinSteppingCommandProvider: JvmSteppingCommandProvider() {
override fun getStepOverCommand(
suspendContext: SuspendContextImpl?,
ignoreBreakpoints: Boolean,
stepSize: Int
): DebugProcessImpl.ResumeCommand? {
if (suspendContext == null || suspendContext.isResumed) return null
val sourcePosition = suspendContext.debugProcess.debuggerContext.sourcePosition ?: return null
return getStepOverCommand(suspendContext, ignoreBreakpoints, sourcePosition)
}
@TestOnly
fun getStepOverCommand(
suspendContext: SuspendContextImpl,
ignoreBreakpoints: Boolean,
debuggerContext: DebuggerContextImpl
): DebugProcessImpl.ResumeCommand? {
return getStepOverCommand(suspendContext, ignoreBreakpoints, debuggerContext.sourcePosition)
}
fun getStepOverCommand(suspendContext: SuspendContextImpl, ignoreBreakpoints: Boolean, sourcePosition: SourcePosition): DebugProcessImpl.ResumeCommand? {
val file = sourcePosition.file as? KtFile ?: return null
if (sourcePosition.line < 0) return null
val containingFunction = sourcePosition.elementAt.parents.firstOrNull { it is KtNamedFunction && !it.isLocal } ?: return null
val startLineNumber = containingFunction.getLineNumber(true)
val endLineNumber = containingFunction.getLineNumber(false)
if (startLineNumber > endLineNumber) return null
val linesRange = startLineNumber + 1..endLineNumber + 1
val inlineFunctionCalls = getInlineFunctionCallsIfAny(sourcePosition)
if (inlineFunctionCalls.isEmpty()) return null
val inlineArguments = getInlineArgumentsIfAny(inlineFunctionCalls)
if (inlineArguments.any { it.shouldNotUseStepOver(sourcePosition.elementAt) }) {
return null
}
val additionalElementsToSkip = sourcePosition.elementAt.getAdditionalElementsToSkip()
return DebuggerSteppingHelper.createStepOverCommand(suspendContext, ignoreBreakpoints, file, linesRange, inlineArguments, additionalElementsToSkip)
}
private fun PsiElement.getAdditionalElementsToSkip(): List<PsiElement> {
val result = arrayListOf<PsiElement>()
val ifParent = getParentOfType<KtIfExpression>(false)
if (ifParent != null) {
if (ifParent.then.contains(this)) {
ifParent.elseKeyword?.let { result.add(it) }
ifParent.`else`?.let { result.add(it) }
}
}
val tryParent = getParentOfType<KtTryExpression>(false)
if (tryParent != null) {
val catchClause = getParentOfType<KtCatchClause>(false)
if (catchClause != null) {
result.addAll(tryParent.catchClauses.filter { it != catchClause })
}
}
val whenEntry = getParentOfType<KtWhenEntry>(false)
if (whenEntry != null) {
if (whenEntry.expression.contains(this)) {
val whenParent = whenEntry.getParentOfType<KtWhenExpression>(false)
if (whenParent != null) {
result.addAll(whenParent.entries.filter { it != whenEntry })
}
}
}
return result
}
private fun PsiElement.shouldNotUseStepOver(elementAt: PsiElement): Boolean {
val ifParent = getParentOfType<KtIfExpression>(false)
if (ifParent != null) {
// if (inlineFunCall()) {...}
if (ifParent.condition.contains(this)) {
return true
}
/*
<caret>if (...) inlineFunCall()
else inlineFunCall()
*/
val ifParentElementAt = elementAt.getParentOfType<KtIfExpression>(false)
if (ifParentElementAt == null) {
if (ifParent.then.contains(this)) {
return true
}
if (ifParent.`else`.contains(this)) {
return true
}
}
}
val tryParent = getParentOfType<KtTryExpression>(false)
if (tryParent != null) {
/* try { inlineFunCall() }
catch()...
*/
if (tryParent.tryBlock.contains(this)) {
return true
}
}
val whenEntry = getParentOfType<KtWhenEntry>(false)
if (whenEntry != null) {
// <caret>inlineFunCall -> ...
if (whenEntry.conditions.any { it.contains(this) } ) {
return true
}
// <caret>1 == 2 -> inlineFunCall()
if (whenEntry.expression.contains(this)) {
val parentEntryElementAt = elementAt.getParentOfType<KtWhenEntry>(false) ?: return true
return parentEntryElementAt == whenEntry &&
whenEntry.conditions.any { it.contains(elementAt) }
}
}
val whileParent = getParentOfType<KtWhileExpression>(false)
if (whileParent != null) {
// last statement in while
return (whileParent.body as? KtBlockExpression)?.statements?.lastOrNull()?.getLineNumber() == elementAt.getLineNumber()
}
return false
}
private fun PsiElement?.contains(element: PsiElement): Boolean {
return this?.textRange?.contains(element.textRange) ?: false
}
@TestOnly
fun getStepOutCommand(suspendContext: SuspendContextImpl, debugContext: DebuggerContextImpl): DebugProcessImpl.ResumeCommand? {
return getStepOutCommand(suspendContext, debugContext.sourcePosition)
}
override fun getStepOutCommand(suspendContext: SuspendContextImpl?, stepSize: Int): DebugProcessImpl.ResumeCommand? {
if (suspendContext == null || suspendContext.isResumed) return null
val sourcePosition = suspendContext.debugProcess.debuggerContext.sourcePosition ?: return null
return getStepOutCommand(suspendContext, sourcePosition)
}
private fun getStepOutCommand(suspendContext: SuspendContextImpl, sourcePosition: SourcePosition): DebugProcessImpl.ResumeCommand? {
val file = sourcePosition.file as? KtFile ?: return null
if (sourcePosition.line < 0) return null
val lineStartOffset = file.getLineStartOffset(sourcePosition.line) ?: return null
val inlineFunctions = getInlineFunctionsIfAny(file, lineStartOffset)
val inlinedArgument = getInlineArgumentIfAny(file, lineStartOffset)
if (inlineFunctions.isEmpty() && inlinedArgument == null) return null
return DebuggerSteppingHelper.createStepOutCommand(suspendContext, true, inlineFunctions, inlinedArgument)
}
private fun getInlineFunctionsIfAny(file: KtFile, offset: Int): List<KtNamedFunction> {
val elementAt = file.findElementAt(offset) ?: return emptyList()
val containingFunction = elementAt.getParentOfType<KtNamedFunction>(false) ?: return emptyList()
val descriptor = containingFunction.resolveToDescriptor()
if (!InlineUtil.isInline(descriptor)) return emptyList()
val inlineFunctionsCalls = DebuggerUtils.analyzeElementWithInline(
containingFunction.getResolutionFacade(),
containingFunction.analyzeFully(),
containingFunction,
false
).filterIsInstance<KtNamedFunction>()
return inlineFunctionsCalls
}
private fun getInlineArgumentsIfAny(inlineFunctionCalls: List<KtCallExpression>): List<KtFunction> {
return inlineFunctionCalls.flatMap {
it.valueArguments
.map { getArgumentExpression(it) }
.filterIsInstance<KtFunction>()
}
}
private fun getArgumentExpression(it: ValueArgument) = (it.getArgumentExpression() as? KtFunctionLiteralExpression)?.functionLiteral ?: it.getArgumentExpression()
private fun getInlineFunctionCallsIfAny(sourcePosition: SourcePosition): List<KtCallExpression> {
val file = sourcePosition.file as? KtFile ?: return emptyList()
val lineNumber = sourcePosition.line
var elementAt = sourcePosition.elementAt
var startOffset = file.getLineStartOffset(lineNumber) ?: elementAt.startOffset
var endOffset = file.getLineEndOffset(lineNumber) ?: elementAt.endOffset
var topMostElement: PsiElement? = null
while (topMostElement !is KtElement && startOffset < endOffset) {
elementAt = file.findElementAt(startOffset)
if (elementAt != null) {
topMostElement = CodeInsightUtils.getTopmostElementAtOffset(elementAt, startOffset)
}
startOffset++
}
if (topMostElement !is KtElement) return emptyList()
val start = topMostElement.startOffset
val end = topMostElement.endOffset
fun isInlineCall(expr: KtExpression): Boolean {
val context = expr.analyze(BodyResolveMode.PARTIAL)
val resolvedCall = expr.getResolvedCall(context) ?: return false
return InlineUtil.isInline(resolvedCall.resultingDescriptor)
}
val allInlineFunctionCalls = CodeInsightUtils.
findElementsOfClassInRange(file, start, end, KtExpression::class.java)
.map { KtPsiUtil.getParentCallIfPresent(it as KtExpression) }
.filterIsInstance<KtCallExpression>()
.filter { isInlineCall(it) }
.toSet()
// It is necessary to check range because of multiline assign
var linesRange = lineNumber..lineNumber
return allInlineFunctionCalls.filter {
val shouldInclude = it.getLineNumber() in linesRange
if (shouldInclude) {
linesRange = Math.min(linesRange.start, it.getLineNumber())..Math.max(linesRange.end, it.getLineNumber(false))
}
shouldInclude
}
}
}
fun getStepOverPosition(
location: Location,
file: KtFile,
range: Range<Int>,
inlinedArguments: List<KtElement>,
elementsToSkip: List<PsiElement>
): XSourcePositionImpl? {
val computedReferenceType = location.declaringType() ?: return null
fun isLocationSuitable(nextLocation: Location): Boolean {
if (nextLocation.method() != location.method() || nextLocation.lineNumber() !in range) {
return false
}
return try {
nextLocation.sourceName("Kotlin") == file.name
}
catch(e: AbsentInformationException) {
return true
}
}
val locations = computedReferenceType.allLineLocations()
.dropWhile { it != location }
.drop(1)
.filter { isLocationSuitable(it) }
.dropWhile { it.lineNumber() == location.lineNumber() }
for (locationAtLine in locations) {
val lineNumber = locationAtLine.lineNumber()
val lineStartOffset = file.getLineStartOffset(lineNumber - 1) ?: continue
if (inlinedArguments.any { it.textRange.contains(lineStartOffset) }) continue
if (elementsToSkip.any { it.textRange.contains(lineStartOffset) }) continue
val elementAt = file.findElementAt(lineStartOffset) ?: continue
return XSourcePositionImpl.createByElement(elementAt) ?: return null
}
return null
}
fun getStepOutPosition(
location: Location,
suspendContext: SuspendContextImpl,
inlineFunctions: List<KtNamedFunction>,
inlinedArgument: KtFunctionLiteral?
): XSourcePositionImpl? {
val computedReferenceType = location.declaringType() ?: return null
val locations = computedReferenceType.allLineLocations()
val nextLineLocations = locations.dropWhile { it.lineNumber() != location.lineNumber() }.filter { it.method() == location.method() }
if (inlineFunctions.isNotEmpty()) {
return suspendContext.getXPositionForStepOutFromInlineFunction(nextLineLocations, inlineFunctions) ?: return null
}
if (inlinedArgument != null) {
return suspendContext.getXPositionForStepOutFromInlinedArgument(nextLineLocations, inlinedArgument) ?: return null
}
return null
}
private fun SuspendContextImpl.getXPositionForStepOutFromInlineFunction(
locations: List<Location>,
inlineFunctionsToSkip: List<KtNamedFunction>
): XSourcePositionImpl? {
return getNextPositionWithFilter(locations) {
file, offset ->
if (inlineFunctionsToSkip.any { it.textRange.contains(offset) }) {
return@getNextPositionWithFilter true
}
val inlinedArgument = getInlineArgumentIfAny(file, offset)
inlinedArgument != null && inlinedArgument.textRange.contains(offset)
}
}
private fun SuspendContextImpl.getXPositionForStepOutFromInlinedArgument(
locations: List<Location>,
inlinedArgumentToSkip: KtFunctionLiteral
): XSourcePositionImpl? {
return getNextPositionWithFilter(locations) {
file, offset ->
inlinedArgumentToSkip.textRange.contains(offset)
}
}
private fun SuspendContextImpl.getNextPositionWithFilter(
locations: List<Location>,
skip: (KtFile, Int) -> Boolean
): XSourcePositionImpl? {
for (location in locations) {
val file = try {
this.debugProcess.positionManager.getSourcePosition(location)?.file as? KtFile
}
catch(e: NoDataException) {
null
} ?: continue
val currentLine = location.lineNumber() - 1
val lineStartOffset = file.getLineStartOffset(currentLine) ?: continue
if (skip(file, lineStartOffset)) continue
val elementAt = file.findElementAt(lineStartOffset) ?: continue
return XSourcePositionImpl.createByElement(elementAt)
}
return null
}
private fun getInlineArgumentIfAny(file: KtFile, offset: Int): KtFunctionLiteral? {
val elementAt = file.findElementAt(offset) ?: return null
val functionLiteralExpression = elementAt.getParentOfType<KtFunctionLiteralExpression>(false) ?: return null
val context = functionLiteralExpression.analyze(BodyResolveMode.PARTIAL)
if (!InlineUtil.isInlinedArgument(functionLiteralExpression.functionLiteral, context, false)) return null
return functionLiteralExpression.functionLiteral
}

View File

@@ -18,18 +18,18 @@ package org.jetbrains.kotlin.idea.findUsages.handlers
import com.intellij.find.findUsages.AbstractFindUsagesDialog
import com.intellij.find.findUsages.FindUsagesOptions
import com.intellij.find.findUsages.JavaFindUsagesHelper
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.psi.PsiClass
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiReference
import com.intellij.psi.*
import com.intellij.psi.meta.PsiMetaOwner
import com.intellij.psi.search.PsiElementProcessor
import com.intellij.psi.search.PsiElementProcessorAdapter
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.psi.util.PsiUtil
import com.intellij.psi.xml.XmlAttributeValue
import com.intellij.usageView.UsageInfo
import com.intellij.util.FilteredQuery
import com.intellij.util.Processor
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.asJava.KtLightMethod
import org.jetbrains.kotlin.asJava.LightClassUtil
import org.jetbrains.kotlin.asJava.toLightClass
@@ -196,7 +196,7 @@ public class KotlinFindClassUsagesHandler(
else -> null
} ?: return Collections.emptyList()
return JavaFindUsagesHelper.getElementNames(psiClass)
return getElementNames(psiClass)
}
protected override fun isSearchForTextOccurencesAvailable(psiElement: PsiElement, isSingleFile: Boolean): Boolean {
@@ -206,4 +206,58 @@ public class KotlinFindClassUsagesHandler(
public override fun getFindUsagesOptions(dataContext: DataContext?): FindUsagesOptions {
return factory.findClassOptions
}
fun getElementNames(element: PsiElement): Set<String> {
if (element is PsiDirectory) {
// normalize a directory to a corresponding package
val aPackage = runReadAction { JavaDirectoryService.getInstance().getPackage(element) }
return if (aPackage == null) emptySet<String>() else getElementNames(aPackage)
}
val result = HashSet<String>()
runReadAction {
when (element) {
is PsiPackage -> {
ContainerUtil.addIfNotNull(result, element.qualifiedName)
}
is PsiClass -> {
val qname = element.qualifiedName
if (qname != null) {
result.add(qname)
val topLevelClass = PsiUtil.getTopLevelClass(element)
if (topLevelClass != null) {
val topName = topLevelClass.qualifiedName
assert(topName != null)
if (qname.length() > topName!!.length()) {
result.add(topName + qname.substring(topName.length()).replace('.', '$'))
}
}
}
}
is PsiMethod -> {
ContainerUtil.addIfNotNull(result, element.name)
}
is PsiVariable -> {
ContainerUtil.addIfNotNull(result, element.name)
}
is PsiMetaOwner -> {
val metaData = element.metaData
if (metaData != null) {
ContainerUtil.addIfNotNull(result, metaData.name)
}
}
is PsiNamedElement -> {
ContainerUtil.addIfNotNull(result, element.name)
}
is XmlAttributeValue -> {
ContainerUtil.addIfNotNull(result, element.value)
}
else -> {
}
}
}
return result
}
}

View File

@@ -52,6 +52,7 @@ public class KotlinCallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
private int usageCount = 0;
private final Set<PsiReference> references = new HashSet<PsiReference>();
private final CallHierarchyNodeDescriptor javaDelegate;
private final PsiElement psiElement;
public KotlinCallHierarchyNodeDescriptor(@NotNull Project project,
HierarchyNodeDescriptor parentDescriptor,
@@ -59,6 +60,7 @@ public class KotlinCallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
boolean isBase,
boolean navigateToReference) {
super(project, parentDescriptor, element, isBase);
this.psiElement = element;
this.javaDelegate = new CallHierarchyNodeDescriptor(myProject, null, element, isBase, navigateToReference);
}
@@ -73,6 +75,10 @@ public class KotlinCallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
javaDelegate.addReference(reference);
}
private PsiElement getPsiElement() {
return psiElement;
}
public final PsiElement getTargetElement(){
return getPsiElement();
}

View File

@@ -28,6 +28,7 @@ import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.KotlinLanguage;
import org.jetbrains.kotlin.idea.hierarchy.HierarchyUtils;
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil;
import org.jetbrains.kotlin.psi.KtFile;
@@ -42,7 +43,7 @@ public class KotlinCallHierarchyProvider implements HierarchyProvider {
if (element == null) return null;
element = HierarchyUtils.getCallHierarchyElement(element);
if (element instanceof KtFile) return null;
if (element instanceof KtFile || element.getLanguage() != KotlinLanguage.INSTANCE) return null;
return element;
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.highlighter
import com.intellij.execution.lineMarker.ExecutorAction
import com.intellij.execution.lineMarker.RunLineMarkerContributor
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.idea.KotlinIcons
import org.jetbrains.kotlin.idea.MainFunctionDetector
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
import org.jetbrains.kotlin.psi.KtNamedFunction
public class KotlinRunLineMarkerContributor : RunLineMarkerContributor() {
override fun getInfo(element: PsiElement?): RunLineMarkerContributor.Info? {
val function = element?.parent as? KtNamedFunction
if (function == null) return null
if (function.nameIdentifier != element) return null
val detector = MainFunctionDetector { function ->
function.resolveToDescriptor() as FunctionDescriptor
}
if (detector.isMain(function)) {
return RunLineMarkerContributor.Info(KotlinIcons.LAUNCH, null, ExecutorAction.getActions(0))
}
return null
}
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.highlighter
import com.intellij.codeInsight.TestFrameworks
import com.intellij.execution.TestStateStorage
import com.intellij.execution.lineMarker.ExecutorAction
import com.intellij.execution.lineMarker.RunLineMarkerContributor
import com.intellij.execution.testframework.TestIconMapper
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.asJava.KtLightClass
import org.jetbrains.kotlin.asJava.toLightClass
import org.jetbrains.kotlin.asJava.toLightMethods
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtNamedDeclaration
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import javax.swing.Icon
class KotlinTestRunLineMarkerContributor : RunLineMarkerContributor() {
private fun getTestStateIcon(url: String, project: Project): Icon? {
val state = TestStateStorage.getInstance(project).getState(url) ?: return null
val magnitude = TestIconMapper.getMagnitude(state.magnitude)
return TestIconMapper.getIcon(magnitude)
}
override fun getInfo(element: PsiElement): RunLineMarkerContributor.Info? {
val declaration = element.getStrictParentOfType<KtNamedDeclaration>() ?: return null
if (declaration.nameIdentifier != element) return null
// To prevent IDEA failing on red code
if (declaration.resolveToDescriptorIfAny() == null) return null
val project = element.project
val (url, framework) = when (declaration) {
is KtClassOrObject -> {
val lightClass = declaration.toLightClass() ?: return null
val framework = TestFrameworks.detectFramework(lightClass) ?: return null
if (!framework.isTestClass(lightClass)) return null
"java:suite://${lightClass.qualifiedName!!}" to framework
}
is KtNamedFunction -> {
val lightMethod = declaration.toLightMethods().firstOrNull() ?: return null
val lightClass = lightMethod.containingClass as? KtLightClass ?: return null
val framework = TestFrameworks.detectFramework(lightClass) ?: return null
if (!framework.isTestMethod(lightMethod)) return null
"java:test://${lightClass.qualifiedName}.${lightMethod.name}" to framework
}
else -> return null
}
val icon = getTestStateIcon(url, project) ?: framework.icon
return RunLineMarkerContributor.Info(icon, { "Run Test" }, ExecutorAction.getActions(1))
}
}

View File

@@ -89,6 +89,7 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe
Errors.USELESS_ELVIS,
ErrorsJvm.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION,
Errors.DEPRECATION,
Errors.DEPRECATION_ERROR,
Errors.NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION,
Errors.OPERATOR_MODIFIER_REQUIRED,
Errors.DEPRECATED_UNARY_PLUS_MINUS,

View File

@@ -21,8 +21,7 @@ import com.intellij.codeInsight.actions.OptimizeImportsProcessor
import com.intellij.codeInsight.daemon.QuickFixBundle
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx
import com.intellij.codeInsight.daemon.impl.DaemonListeners
import com.intellij.codeInsight.daemon.impl.DaemonProgressIndicator
import com.intellij.codeInsight.daemon.impl.HighlightingSessionImpl
import com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass
import com.intellij.codeInsight.intention.LowPriorityAction
import com.intellij.codeInspection.InspectionManager
import com.intellij.codeInspection.LocalQuickFix
@@ -50,7 +49,7 @@ import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.ImportPath
import java.util.*
class UnusedImportInspection : AbstractKotlinInspection() {
class KotlinUnusedImportInspection : AbstractKotlinInspection() {
override fun runForWholeFile() = true
override fun checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array<out ProblemDescriptor>? {
@@ -132,8 +131,8 @@ class UnusedImportInspection : AbstractKotlinInspection() {
// unwrap progress indicator
val progress = sequence(ProgressManager.getInstance().progressIndicator) {
(it as? ProgressWrapper)?.originalProgressIndicator
}.last() as DaemonProgressIndicator
val highlightingSession = HighlightingSessionImpl.getHighlightingSession(file, progress)
}.last()
val highlightingSession = ProgressableTextEditorHighlightingPass.getHighlightingSession(progress)
val project = highlightingSession.project
val editor = highlightingSession.editor
@@ -150,11 +149,11 @@ class UnusedImportInspection : AbstractKotlinInspection() {
}
}
Disposer.register(progress, invokeFixLater)
Disposer.register(highlightingSession, invokeFixLater)
if (progress.isCanceled) {
Disposer.dispose(invokeFixLater)
Disposer.dispose(progress)
Disposer.dispose(highlightingSession)
progress.checkCanceled()
}
}

View File

@@ -46,6 +46,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesHandlerFactory
import org.jetbrains.kotlin.idea.findUsages.handlers.KotlinFindClassUsagesHandler
import org.jetbrains.kotlin.idea.project.ProjectStructureUtil
import org.jetbrains.kotlin.idea.search.usagesSearch.*
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
import org.jetbrains.kotlin.lexer.KtTokens
@@ -71,6 +72,10 @@ public class UnusedSymbolInspection : AbstractKotlinInspection() {
private val javaInspection = UnusedDeclarationInspection()
public fun isEntryPoint(declaration: KtNamedDeclaration): Boolean {
// TODO Workaround for EA-64030 - IOE: PsiJavaParserFacadeImpl.createAnnotationFromText
// This should be fixed on IDEA side: ClsAnnotation should not throw exceptions when annotation class has Java keyword
if (declaration.getAnnotationEntries().any { it.getTypeReference()?.getText()?.endsWith("native") ?: false }) return false
val lightElement: PsiElement? = when (declaration) {
is KtClassOrObject -> declaration.toLightClass()
is KtNamedFunction, is KtSecondaryConstructor -> LightClassUtil.getLightClassMethod(declaration as KtFunction)

View File

@@ -95,7 +95,7 @@ public class AddForLoopIndicesIntention : SelfTargetingRangeIntention<KtForExpre
else -> templateBuilder.setEndVariableBefore(body)
}
templateBuilder.run(editor, true)
templateBuilder.run(editor, false)
}
private fun createWithIndexExpression(originalExpression: KtExpression): KtExpression {

View File

@@ -23,8 +23,12 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.core.replaced
import org.jetbrains.kotlin.idea.util.ShortenReferences
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.utils.addToStdlib.check
public class ConvertAssertToIfWithThrowIntention : SelfTargetingIntention<KtCallExpression>(javaClass(), "Replace 'assert' with 'if' statement"), LowPriorityAction {
override fun isApplicableTo(element: KtCallExpression, caretOffset: Int): Boolean {
@@ -44,17 +48,21 @@ public class ConvertAssertToIfWithThrowIntention : SelfTargetingIntention<KtCall
override fun applyTo(element: KtCallExpression, editor: Editor) {
val args = element.getValueArguments()
val conditionText = args[0]?.getArgumentExpression()?.getText() ?: return
val functionLiteral = element.getFunctionLiteralArguments().singleOrNull()
val messageIsFunction = messageIsFunction(element)
val functionLiteralArgument = element.functionLiteralArguments.singleOrNull()
val bindingContext = element.analyze(BodyResolveMode.PARTIAL)
val psiFactory = KtPsiFactory(element)
val messageExpr = when {
args.size() == 2 -> args[1]?.getArgumentExpression() ?: return
functionLiteral != null -> functionLiteral!!
else -> psiFactory.createExpression("\"Assertion failed\"")
val messageFunctionExpr = when {
args.size == 2 -> args[1]?.getArgumentExpression() ?: return
functionLiteralArgument != null -> functionLiteralArgument.getFunctionLiteral()
else -> null
}
val extractedMessageSingleExpr = (messageFunctionExpr as? KtFunctionLiteralExpression)?.let { extractMessageSingleExpression(it, bindingContext) }
val messageIsFunction = extractedMessageSingleExpr == null && messageIsFunction(element, bindingContext)
val messageExpr = extractedMessageSingleExpr ?: messageFunctionExpr ?: psiFactory.createExpression("\"Assertion failed\"")
val ifExpression = replaceWithIfThenThrowExpression(element)
// shorten java.lang.AssertionError
@@ -85,8 +93,14 @@ public class ConvertAssertToIfWithThrowIntention : SelfTargetingIntention<KtCall
simplifyConditionIfPossible(ifExpression)
}
private fun messageIsFunction(callExpr: KtCallExpression): Boolean {
val resolvedCall = callExpr.getResolvedCall(callExpr.analyze()) ?: return false
private fun extractMessageSingleExpression(functionLiteral: KtFunctionLiteralExpression, bindingContext: BindingContext): KtExpression? {
return functionLiteral.bodyExpression?.statements?.singleOrNull()?.let { singleStatement ->
singleStatement.check { it.isUsedAsExpression(bindingContext) }
}
}
private fun messageIsFunction(callExpr: KtCallExpression, bindingContext: BindingContext): Boolean {
val resolvedCall = callExpr.getResolvedCall(bindingContext) ?: return false
val valParameters = resolvedCall.getResultingDescriptor().getValueParameters()
return valParameters.size() > 1 && !KotlinBuiltIns.isAny(valParameters[1].type)
}

View File

@@ -72,6 +72,6 @@ public class IterateExpressionIntention : SelfTargetingIntention<KtExpression>(j
templateBuilder.replaceElement(bodyPlaceholder, ConstantNode(""), false)
templateBuilder.setEndVariableAfter(bodyPlaceholder)
templateBuilder.run(editor, true)
templateBuilder.run(editor, false)
}
}

View File

@@ -31,6 +31,8 @@ import org.jetbrains.kotlin.psi.KtSimpleNameExpression
import org.jetbrains.kotlin.psi.psiUtil.getQualifiedElement
import org.jetbrains.kotlin.psi.psiUtil.startOffset
/*
public object KotlinAddOrderEntryActionFactory : KotlinIntentionActionsFactory() {
override fun doCreateActions(diagnostic: Diagnostic): List<IntentionAction> {
val simpleExpression = diagnostic.psiElement as? KtSimpleNameExpression ?: return emptyList()
@@ -57,3 +59,5 @@ public object KotlinAddOrderEntryActionFactory : KotlinIntentionActionsFactory()
return OrderEntryFix.registerFixes(QuickFixActionRegistrarImpl(null), reference) as List<IntentionAction>? ?: emptyList()
}
}
*/

View File

@@ -315,6 +315,7 @@ public class QuickFixRegistrar : QuickFixContributor {
ReplaceObsoleteLabelSyntaxFix.createWholeProjectFixFactory())
DEPRECATION.registerFactory(DeprecatedSymbolUsageFix, DeprecatedSymbolUsageInWholeProjectFix)
DEPRECATION_ERROR.registerFactory(DeprecatedSymbolUsageFix, DeprecatedSymbolUsageInWholeProjectFix)
POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION.registerFactory(ReplaceJavaAnnotationPositionedArgumentsFix)
@@ -338,7 +339,7 @@ public class QuickFixRegistrar : QuickFixContributor {
DEPRECATED_TYPE_PARAMETER_SYNTAX.registerFactory(MigrateTypeParameterListFix)
UNRESOLVED_REFERENCE.registerFactory(KotlinAddOrderEntryActionFactory)
// UNRESOLVED_REFERENCE.registerFactory(KotlinAddOrderEntryActionFactory)
MISPLACED_TYPE_PARAMETER_CONSTRAINTS.registerFactory(MoveTypeParameterConstraintFix)

View File

@@ -227,7 +227,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
val receiverTypeCandidate: TypeCandidate?
val mandatoryTypeParametersAsCandidates: List<TypeCandidate>
val substitutions: List<KotlinTypeSubstitution>
var finished: Boolean = false
var released: Boolean = false
init {
// gather relevant information
@@ -1004,7 +1004,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
}
}
finally {
finished = true
release()
onFinish()
}
}
@@ -1020,10 +1020,18 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
}
fun showDialogIfNeeded() {
if (!ApplicationManager.getApplication().isUnitTestMode() && dialogWithEditor != null && !finished) {
if (!ApplicationManager.getApplication().isUnitTestMode() && dialogWithEditor != null && !released) {
dialogWithEditor.show()
}
}
private fun release() {
if (released) return
dialogWithEditor?.let {
jetFileToEdit.delete()
released = true
}
}
}
}

View File

@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.caches.resolve.resolveImportReference
import org.jetbrains.kotlin.idea.core.*
import org.jetbrains.kotlin.idea.intentions.OperatorToFunctionIntention
import org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeArgumentsIntention
import org.jetbrains.kotlin.idea.intentions.setType
import org.jetbrains.kotlin.idea.util.*
@@ -65,8 +66,14 @@ class CallableUsageReplacementStrategy(
if (!callTypeHandler.precheckReplacementPattern(replacement)) return null
return {
// copy replacement expression because it is modified by performCallReplacement
performCallReplacement(usage, bindingContext, resolvedCall, callElement, callTypeHandler, replacement.copy())
if (usage is KtOperationReferenceExpression && usage.getReferencedNameElementType() != KtTokens.IDENTIFIER) {
val nameExpression = OperatorToFunctionIntention.convert(usage.parent as KtExpression).second
createReplacer(nameExpression)!!.invoke()
}
else {
// copy replacement expression because it is modified by performCallReplacement
performCallReplacement(usage, bindingContext, resolvedCall, callElement, callTypeHandler, replacement.copy())
}
}
}

View File

@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.idea.core.OptionalParametersHelper
import org.jetbrains.kotlin.idea.quickfix.KotlinQuickFixAction
@@ -100,7 +101,7 @@ public abstract class DeprecatedSymbolUsageFixBase(
else
null) ?: return null
val descriptor = Errors.DEPRECATION.cast(deprecatedDiagnostic).a
val descriptor = DiagnosticFactory.cast(deprecatedDiagnostic, Errors.DEPRECATION, Errors.DEPRECATION_ERROR).a
val replacement = DeprecatedSymbolUsageFixBase.fetchReplaceWithPattern(descriptor, nameExpression.project) ?: return null
return Data(nameExpression, replacement, descriptor)
}

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