Compare commits

...

265 Commits

Author SHA1 Message Date
teamcity
1ff00a928c Auto-merge beta3 with <default> 2015-12-04 19:36:32 +03:00
Natalia Ukhorskaya
22add1ee89 Correct resource path for flavors in android-extensions-plugin
(cherry picked from commit 51abb021bc)
2015-12-04 17:25:02 +03:00
Natalia Ukhorskaya
2ecc21b440 Do not cache AndroidModule in IDEAndroidLayoutXmlManager
(cherry picked from commit c523817)
2015-12-04 17:22:50 +03:00
teamcity
14bcc5a523 Auto-merge beta3 with <default> 2015-12-03 19:37:39 +03:00
Dmitry Jemerov
0113ccaad1 fix compilation after changes in markdown library
(cherry picked from commit ce9012c)
2015-12-03 15:33:25 +01:00
Natalia Ukhorskaya
41141fbe23 Fix NoSuchMethod in android-extensions-plugin
#KT-10263 Fixed
(cherry picked from commit a197fc8)
2015-12-03 16:19:12 +03:00
Nikolay Krasko
1d076154b1 Exclude idl2k module from build in beta3 2015-12-02 17:46:43 +03:00
Nikolay Krasko
d1860c2dce Register inspection 2015-12-02 16:25:48 +03:00
Nikolay Krasko
39ae20b110 Mute "smap" test in br141 2015-12-02 16:12:23 +03:00
teamcity
58b507f44d Auto-merge beta3 with <default> 2015-12-02 01:01:55 +03:00
Mikhail Glukhikh
58d78011c0 Creating deep copy of local function declaration instructions in CFA, regression test #KT-10243 Fixed
(cherry picked from commit 60e457167d)
2015-12-01 23:50:02 +03:00
teamcity
1c3e5f01b4 Auto-merge beta3 with <default> 2015-12-01 23:12:03 +03:00
Nikolay Krasko
d95b156265 Fix smap test-data in br141 2015-12-01 21:48:45 +03:00
Zalim Bashorov
b33ad0c528 Minor: don't process changes for incremental build during rebuild 2015-12-01 21:27:45 +03:00
teamcity
323937a397 Auto-merge beta3 with <default> 2015-12-01 20:35:24 +03:00
Ilya Gorbunov
6dbec92bfe Remove replacement with upcast. Remove deprecation from *Raw methods until beta4. 2015-12-01 19:51:12 +03:00
Alexey Sedunov
bb57825d21 Introduce Variable: Forbid multi-declaration for collections and arrays
#KT-10242 Fixed
2015-12-01 19:39:56 +03:00
Alexey Sedunov
ddb50031d8 Introduce Variable: Suggest choosing between single variable and multi-declaration
#KT-10242 Fixed
2015-12-01 19:36:34 +03:00
Nikolay Krasko
c2f8386b02 Workaround failure in testInlineFunctionsCircularDependency tests
There's difference in bytecode produced with non-incremental and incremental compilers between br141 and master because of ASM version
2015-12-01 19:35:38 +03:00
Nikolay Krasko
aa1a99a6eb Fix testdata in br141
- old ASM can't read multiple line numbers
- impossible to place breakpoint inside lambda
2015-12-01 19:26:32 +03:00
Nikolay Krasko
51f0cebba3 Revert line number update because of old ASM in br141 2015-12-01 18:52:50 +03:00
Nikolay Krasko
d82ef969ac Merge branch 'beta3' into idea_continuous/br141 2015-12-01 17:52:46 +03:00
Nikolay Krasko
50dcd08cb5 Enable auto-increment 2015-12-01 15:27:00 +03:00
Pavel V. Talanov
df6298de39 Minor, getModuleInfo: improve on failure messages 2015-12-01 14:55:41 +03:00
Pavel V. Talanov
a9c1e57230 getModuleInfo: Provide utility to default to null instead of logging an error
Use it to workaround cases when java resolve references some unexpected classes/files, referencing non-physical Dummy.java in particular
2015-12-01 14:55:39 +03:00
Pavel V. Talanov
378a964c2f getModuleInfo: Correct module info for members of light classes for decompiled Kotlin classes 2015-12-01 14:55:38 +03:00
Stanislav Erokhin
170a0393f6 Revert "Original type is taken into account when intersecting possible types in resolve #KT-10232 Fixed"
This reverts commit fe04cc513b.
2015-12-01 13:02:45 +03:00
Nikolay Krasko
95d4dd4962 Enable bootstrapping in branch 2015-12-01 00:02:09 +03:00
Nikolay Krasko
288248c964 Remove android extension plugin from relay 2015-11-30 23:58:28 +03:00
Nikolay Krasko
8d271d3d4d Disable clearing handlers in br141 - no such method 2015-11-30 20:47:35 +03:00
Nikolay Krasko
6c898b4c3e Fix compile errors after merge 2015-11-30 20:47:08 +03:00
Nikolay Krasko
0c65310b9e Replace IdeModifiableModelsProvider -> MavenModifiableModelsProvider 2015-11-30 20:26:25 +03:00
Nikolay Krasko
1bc76d0753 Comment Gradle configurator in br141 2015-11-30 20:24:43 +03:00
Nikolay Krasko
0b49512ade Merge with beta3 2015-11-30 20:21:27 +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
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
409 changed files with 1171 additions and 3323 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

@@ -88,12 +88,5 @@
origin.version="${relay.origin.version}"
plugin.subdir="BareKotlin"
substituted.version="${relay.substitute.version}"/>
<substitudeVersionInPlugin
plugin.jar.name="kotlin-android-extensions"
plugin.path="${relay.plugins.dir}/kotlin-android-extensions-plugin-${relay.origin.version}.zip"
origin.version="${relay.origin.version}"
plugin.subdir="KotlinAndroidExtensions"
substituted.version="${relay.substitute.version}"/>
</target>
</project>

View File

@@ -485,7 +485,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

@@ -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

@@ -59,6 +59,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>())

View File

@@ -28,8 +28,8 @@ import com.intellij.mock.MockApplication
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.extensions.ExtensionsArea
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
@@ -41,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
@@ -336,10 +335,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>())
//
@@ -379,7 +380,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>())
}
}
@@ -401,7 +401,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

@@ -479,7 +479,7 @@ class CompileServiceImpl(
}
private fun clearJarCache() {
ZipHandler.clearFileAccessorCache()
// ZipHandler.clearFileAccessorCache()
val classloader = javaClass.classLoader
// TODO: replace the following code with direct call to CoreJarFileSystem.<clearCache> as soon as it will be available (hopefully in 15.02)
try {

View File

@@ -40,7 +40,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
import java.util.*
public class JvmPlatformParameters(
public val moduleByJavaClass: (JavaClass) -> ModuleInfo
public val moduleByJavaClass: (JavaClass) -> ModuleInfo?
) : PlatformAnalysisParameters
@@ -68,7 +68,10 @@ public object JvmAnalyzerFacade : AnalyzerFacade<JvmPlatformParameters>() {
// We don't have full control over idea resolve api so we allow for a situation which should not happen in Kotlin.
// For example, type in a java library can reference a class declared in a source root (is valid but rare case)
// Providing a fallback strategy in this case can hide future problems, so we should at least log to be able to diagnose those
val resolverForReferencedModule = resolverForProject.tryGetResolverForModule(referencedClassModule as M)
@Suppress("UNCHECKED_CAST")
val resolverForReferencedModule = referencedClassModule?.let { resolverForProject.tryGetResolverForModule(it as M) }
val resolverForModule = resolverForReferencedModule ?: run {
LOG.warn("Java referenced $referencedClassModule from $moduleInfo\nReferenced class was: $javaClass\n")
// in case referenced class lies outside of our resolver, resolve the class as if it is inside our module

View File

@@ -66,4 +66,6 @@ public interface Pseudocode {
List<? extends Instruction> getUsages(@Nullable PseudoValue value);
boolean isSideEffectFree(@NotNull Instruction instruction);
Pseudocode copy();
}

View File

@@ -458,6 +458,41 @@ public class PseudocodeImpl implements Pseudocode {
return mutableInstructionList.get(targetPosition);
}
@Override
public PseudocodeImpl copy() {
PseudocodeImpl result = new PseudocodeImpl(correspondingElement);
result.repeatWhole(this);
return result;
}
private void repeatWhole(PseudocodeImpl originalPseudocode) {
Map<Label, Label> originalToCopy = Maps.newLinkedHashMap();
Multimap<Instruction, Label> originalLabelsForInstruction = HashMultimap.create();
int labelCount = 0;
for (PseudocodeLabel label : originalPseudocode.labels) {
originalToCopy.put(label, label.copy(labelCount++));
originalLabelsForInstruction.put(getJumpTarget(label), label);
}
for (Label label : originalToCopy.values()) {
labels.add((PseudocodeLabel) label);
}
for (Instruction originalInstruction : originalPseudocode.mutableInstructionList) {
repeatLabelsBindingForInstruction(originalInstruction, originalToCopy, originalLabelsForInstruction);
Instruction copy = copyInstruction(originalInstruction, originalToCopy);
addInstruction(copy);
if (originalInstruction == originalPseudocode.errorInstruction && copy instanceof SubroutineExitInstruction) {
errorInstruction = (SubroutineExitInstruction) copy;
}
if (originalInstruction == originalPseudocode.exitInstruction && copy instanceof SubroutineExitInstruction) {
exitInstruction = (SubroutineExitInstruction) copy;
}
if (originalInstruction == originalPseudocode.sinkInstruction && copy instanceof SubroutineSinkInstruction) {
sinkInstruction = (SubroutineSinkInstruction) copy;
}
}
parent = originalPseudocode.parent;
}
public int repeatPart(@NotNull Label startLabel, @NotNull Label finishLabel, int labelCount) {
PseudocodeImpl originalPseudocode = ((PseudocodeLabel) startLabel).getPseudocode();

View File

@@ -57,5 +57,5 @@ public class LocalFunctionDeclarationInstruction(
override fun toString(): String = "d(${render(element)})"
override fun createCopy(): InstructionImpl =
LocalFunctionDeclarationInstruction(element, body, lexicalScope)
LocalFunctionDeclarationInstruction(element, body.copy(), lexicalScope)
}

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

@@ -197,7 +197,7 @@ class GenericCandidateResolver(private val argumentTypeResolver: ArgumentTypeRes
val possibleTypes = context.dataFlowInfo.getPossibleTypes(dataFlowValue)
if (possibleTypes.isEmpty()) return type
return TypeIntersector.intersectTypes(KotlinTypeChecker.DEFAULT, possibleTypes + type)
return TypeIntersector.intersectTypes(KotlinTypeChecker.DEFAULT, possibleTypes)
}
fun <D : CallableDescriptor> completeTypeInferenceDependentOnFunctionArgumentsForCall(context: CallCandidateResolutionContext<D>) {

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

@@ -38,7 +38,7 @@ fun <T : CharSequence?> foo(x: T) {
<!DEBUG_INFO_SMARTCAST!>x<!>.length
x<!UNNECESSARY_SAFE_CALL!>?.<!>length
x.bar1()
<!DEBUG_INFO_SMARTCAST!>x<!>.bar1()
x.bar2()
<!DEBUG_INFO_SMARTCAST!>x<!>.bar3()
}

View File

@@ -0,0 +1,16 @@
val f: Boolean = true
private fun doUpdateRegularTasks() {
try {
while (f) {
val xmlText = <!UNRESOLVED_REFERENCE!>getText<!>()
if (<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>xmlText<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>==<!> null) {}
else {
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>xmlText<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>value<!> = 0 // !!!
}
}
}
finally {
fun execute() {}
}
}

View File

@@ -0,0 +1,4 @@
package
public val f: kotlin.Boolean = true
private fun doUpdateRegularTasks(): kotlin.Unit

View File

@@ -1,15 +0,0 @@
// Type inference failed after smart cast
interface A<T>
interface B<T> : A<T>
fun <T> foo(b: A<T>) = b
fun <T> test(a: A<T>) {
if (a is Any) {
// Error:(9, 9) Kotlin: Type inference failed: fun <T> foo(b: A<T>): kotlin.Unit
// cannot be applied to (A<T>)
foo(a)
}
foo(a) // ok
}

View File

@@ -1,16 +0,0 @@
package
public fun </*0*/ T> foo(/*0*/ b: A<T>): A<T>
public fun </*0*/ T> test(/*0*/ a: A<T>): kotlin.Unit
public interface A</*0*/ T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface B</*0*/ T> : A<T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}

View File

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

View File

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

View File

@@ -3,4 +3,4 @@ fun foo() {
42
}
// 2 3 2 4
// 3 2 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 4 14 6 12 13 7 8 14 9 12 13 14
// 2 12 3 4 6 12 7 8 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

@@ -12546,6 +12546,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("kt10243.kt")
public void testKt10243() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt10243.kt");
doTest(fileName);
}
@TestMetadata("kt127.kt")
public void testKt127() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt127.kt");
@@ -14742,12 +14748,6 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("kt10232.kt")
public void testKt10232() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/kt10232.kt");
doTest(fileName);
}
@TestMetadata("kt1461.kt")
public void testKt1461() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/kt1461.kt");

View File

@@ -33,7 +33,10 @@ public abstract class AbstractCompileKotlinAgainstInlineKotlinTest : AbstractCom
try {
val sourceFiles = factory1.getInputFiles() + factory2.getInputFiles()
InlineTestUtil.checkNoCallsToInline(allGeneratedFiles.filterClassFiles(), sourceFiles)
checkSMAP(sourceFiles, allGeneratedFiles.filterClassFiles())
if (getTestName(true) != "smap") {
checkSMAP(sourceFiles, allGeneratedFiles.filterClassFiles())
}
}
catch (e: Throwable) {
System.out.println(factory1.createText() + "\n" + factory2.createText())

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

@@ -698,7 +698,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

@@ -59,7 +59,7 @@ fun createModuleResolverProvider(
val jvmPlatformParameters = JvmPlatformParameters {
javaClass: JavaClass ->
val psiClass = (javaClass as JavaClassImpl).getPsi()
psiClass.getModuleInfo()
psiClass.getNullableModuleInfo()
}
val resolverForProject = analyzerFacade.setupResolverForProject(

View File

@@ -28,13 +28,20 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.roots.ModuleRootManager
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.utils.sure
fun PsiElement.getModuleInfo(): IdeaModuleInfo {
fun logAndReturnDefault(message: String): IdeaModuleInfo {
LOG.error("Could not find correct module information.\nReason: $message")
return NotUnderContentRootModuleInfo
}
fun PsiElement.getModuleInfo(): IdeaModuleInfo = this.getModuleInfo { reason ->
LOG.error("Could not find correct module information.\nReason: $reason")
NotUnderContentRootModuleInfo
}.sure { "Defaulting to NotUnderContentRootModuleInfo so null is not possible" }
fun PsiElement.getNullableModuleInfo(): IdeaModuleInfo? = this.getModuleInfo { reason ->
LOG.warn("Could not find correct module information.\nReason: $reason")
null
}
private fun PsiElement.getModuleInfo(onFailure: (String) -> IdeaModuleInfo?): IdeaModuleInfo? {
if (this is KtLightElement<*, *>) return this.getModuleInfoForLightElement()
val containingJetFile = (this as? KtElement)?.getContainingFile() as? KtFile
@@ -43,7 +50,7 @@ fun PsiElement.getModuleInfo(): IdeaModuleInfo {
val doNotAnalyze = containingJetFile?.doNotAnalyze
if (doNotAnalyze != null) {
return logAndReturnDefault(
return onFailure(
"Should not analyze element: ${getText()} in file ${containingJetFile?.getName() ?: " <no file>"}\n$doNotAnalyze"
)
}
@@ -53,15 +60,13 @@ fun PsiElement.getModuleInfo(): IdeaModuleInfo {
if (containingJetFile is KtCodeFragment) {
return containingJetFile.getContext()?.getModuleInfo()
?: logAndReturnDefault("Analyzing code fragment of type ${containingJetFile.javaClass} with no context element\nText:\n${containingJetFile.getText()}")
?: onFailure("Analyzing code fragment of type ${containingJetFile.javaClass} with no context element\nText:\n${containingJetFile.getText()}")
}
val project = getProject()
val containingFile = getContainingFile()
?: return logAndReturnDefault("Analyzing element of type $javaClass with no containing file\nText:\n${getText()}")
val containingFile = containingFile ?: return onFailure("Analyzing element of type $javaClass with no containing file\nText:\n$text")
val virtualFile = containingFile.getOriginalFile().getVirtualFile()
?: return logAndReturnDefault("Analyzing non-physical file $containingFile of type ${containingFile.javaClass}")
val virtualFile = containingFile.originalFile.virtualFile
?: return onFailure("Analyzing element of type $javaClass in non-physical file $containingFile of type ${containingFile.javaClass}\nText:\n$text")
return getModuleInfoByVirtualFile(
project,
@@ -115,8 +120,13 @@ private fun getModuleInfoByVirtualFile(project: Project, virtualFile: VirtualFil
}
private fun KtLightElement<*, *>.getModuleInfoForLightElement(): IdeaModuleInfo {
if (this is KtLightClassForDecompiledDeclaration) {
return getModuleInfoByVirtualFile(getProject(), getContainingFile().getVirtualFile(), false)
val decompiledClass = this.getParentOfType<KtLightClassForDecompiledDeclaration>(strict = false)
if (decompiledClass != null) {
return getModuleInfoByVirtualFile(
project,
containingFile.virtualFile.sure { "Decompiled class should be build from physical file" },
false
)
}
val element = getOrigin() ?: when (this) {
is FakeLightClassForFileOfPackage -> this.getContainingFile()!!

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,76 +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.DebugUtil
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() ?: ""
DebugUtil.startPsiModification("Invalidating throw-away copy of file that was used for getting text")
try {
(psiFile as? PsiFileImpl)?.markInvalidated()
}
finally {
DebugUtil.finishPsiModification()
}
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 @@ 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

@@ -0,0 +1,70 @@
/*
* 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.js
import com.intellij.openapi.vfs.impl.ArchiveHandler
import com.intellij.openapi.vfs.impl.ArchiveHandler.EntryInfo
import com.intellij.util.ArrayUtil
import gnu.trove.THashMap
import org.jetbrains.kotlin.serialization.js.forEachFile
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils
public open class KotlinJavaScriptHandler(path: String) : ArchiveHandler(path) {
override fun createEntriesMap(): Map<String, EntryInfo> {
val map = THashMap<String, EntryInfo>()
map.put("", createRootEntry())
for(metadata in KotlinJavascriptMetadataUtils.loadMetadata(getFile())) {
val moduleName = metadata.moduleName
metadata.forEachFile {
filePath, fileContent -> getOrCreate(moduleName + "/" + filePath, false, map, fileContent)
}
}
return map
}
private fun getOrCreate(
entryPath: String,
isDirectory: Boolean,
map: MutableMap<String, EntryInfo>,
content: ByteArray = ArrayUtil.EMPTY_BYTE_ARRAY
): EntryInfo {
val info = map[entryPath]
if (info != null) return info
val path = splitPath(entryPath)
val parentInfo = getOrCreate(path.first, true, map)
val newInfo = JsMetaEntryInfo(parentInfo, path.second, isDirectory, content)
map[entryPath] = newInfo
return newInfo
}
override fun contentsToByteArray(relativePath: String): ByteArray {
val entryInfo = getEntryInfo(relativePath)
return if (entryInfo is JsMetaEntryInfo) entryInfo.content else ArrayUtil.EMPTY_BYTE_ARRAY
}
private class JsMetaEntryInfo(
parent: EntryInfo,
shortName: String,
isDirectory: Boolean,
val content: ByteArray
) : EntryInfo(shortName, isDirectory, ArchiveHandler.DEFAULT_LENGTH, ArchiveHandler.DEFAULT_TIMESTAMP, parent)
}

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

@@ -74,18 +74,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
@@ -97,11 +102,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

@@ -3,7 +3,9 @@
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinAndroidGradleModuleConfigurator"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
</extensions>
<!--
<extensions defaultExtensionNs="org.jetbrains.plugins.gradle">
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJavaFrameworkSupportProvider"/>
</extensions>
-->
</idea-plugin>

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>
@@ -503,16 +503,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"/>
@@ -1095,16 +1091,11 @@
<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"
enabledByDefault="true"
level="INFO"
displayName="Convert object literal to lambda"
groupName="Kotlin"
enabledByDefault="true"
level="INFO"
/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithInspection"

View File

@@ -79,7 +79,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

@@ -27,6 +27,7 @@ import org.jetbrains.plugins.gradle.frameworkSupport.BuildScriptDataBuilder
import org.jetbrains.plugins.gradle.frameworkSupport.GradleFrameworkSupportProvider
import javax.swing.Icon
/*
public class GradleKotlinJavaFrameworkSupportProvider() : GradleFrameworkSupportProvider() {
override fun getFrameworkType(): FrameworkTypeEx = object : FrameworkTypeEx("KOTLIN") {
override fun getIcon(): Icon = KotlinIcons.FILE
@@ -60,3 +61,4 @@ public class GradleKotlinJavaFrameworkSupportProvider() : GradleFrameworkSupport
.addBuildscriptDependencyNotation(KotlinWithGradleConfigurator.CLASSPATH.replace("\$kotlin_version", kotlinVersion))
}
}
*/

View File

@@ -16,11 +16,14 @@
package org.jetbrains.kotlin.idea.configuration
import com.intellij.openapi.components.*
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.openapi.components.StoragePathMacros
import com.intellij.openapi.module.Module
import org.jdom.Element
import org.jetbrains.idea.maven.importing.MavenImporter
import org.jetbrains.idea.maven.importing.MavenModifiableModelsProvider
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter
import org.jetbrains.idea.maven.model.MavenPlugin
import org.jetbrains.idea.maven.project.MavenProject
@@ -37,10 +40,10 @@ private val KotlinPluginArtifactId = "kotlin-maven-plugin"
private val KotlinPluginSourceDirsConfig = "sourceDirs"
class KotlinMavenImporter : MavenImporter(KotlinPluginGroupId, KotlinPluginArtifactId) {
override fun preProcess(module: Module, mavenProject: MavenProject, changes: MavenProjectChanges, modifiableModelsProvider: IdeModifiableModelsProvider) {
override fun preProcess(module: Module, mavenProject: MavenProject, changes: MavenProjectChanges, modifiableModelsProvider: MavenModifiableModelsProvider) {
}
override fun process(modifiableModelsProvider: IdeModifiableModelsProvider,
override fun process(modifiableModelsProvider: MavenModifiableModelsProvider,
module: Module,
rootModel: MavenRootModelAdapter,
mavenModel: MavenProjectsTree,

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
@@ -32,8 +29,6 @@ import com.intellij.psi.PsiFile
import com.intellij.psi.impl.compiled.ClsFileImpl
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
@@ -53,7 +48,6 @@ import org.jetbrains.kotlin.fileClasses.internalNameWithoutInnerClasses
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
@@ -64,27 +58,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? {
if (location.declaringType().containsKotlinStrata()) {
return KotlinStackFrame(frame)
}
return null
}
override fun getSourcePosition(location: Location?): SourcePosition? {
if (location == null) {
throw NoDataException.INSTANCE
@@ -139,7 +121,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
@@ -150,16 +135,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
}
}
@@ -233,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)
@@ -241,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.mapNotNull {
val typeMapper = if (!isInLibrary) prepareTypeMapper(file) else createTypeMapperForLibraryFile(it, file)
getInternalClassNameForElement(it, typeMapper, file, isInLibrary).className
}
}
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,162 +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 KotlinLambdaBreakpointVariant extends ExactJavaBreakpointVariant {
public KotlinLambdaBreakpointVariant(XSourcePosition position, KtFunction function, Integer lambdaOrdinal) {
super(position, function, lambdaOrdinal);
}
@Override
public Icon getIcon() {
return KotlinIcons.LAMBDA;
}
}
public class KotlinLineBreakpointVariant extends ExactJavaBreakpointVariant {
public KotlinLineBreakpointVariant(XSourcePosition position, PsiElement element) {
super(position, element, -1);
}
@Override
public Icon getIcon() {
return KotlinIcons.FUNCTION;
}
}
}

View File

@@ -70,12 +70,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
@@ -84,6 +84,7 @@ fun canPutAt(file: VirtualFile, line: Int, project: Project, breakpointTypeClass
return result == breakpointTypeClass
}
/*
fun computeVariants(
project: Project, position: XSourcePosition,
kotlinBreakpointType: KotlinLineBreakpointType
@@ -152,5 +153,5 @@ fun getLambdasAtLineIfAny(file: KtFile, line: Int): List<KtFunction> {
statement.getLineNumber() == line && statement.getLineNumber(false) == line
}
}
*/

View File

@@ -124,7 +124,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

@@ -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

@@ -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
@@ -132,8 +131,8 @@ class KotlinUnusedImportInspection : 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 KotlinUnusedImportInspection : 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

@@ -74,6 +74,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

@@ -179,7 +179,7 @@ object KDocRenderer {
}
}
MarkdownTokenTypes.TEXT,
MarkdownTokenTypes.CODE,
MarkdownTokenTypes.CODE_LINE,
MarkdownTokenTypes.WHITE_SPACE,
MarkdownTokenTypes.COLON,
MarkdownTokenTypes.SINGLE_QUOTE,

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

@@ -343,7 +343,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

@@ -228,7 +228,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

@@ -114,7 +114,7 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
else {
findSAMUsages(info, result)
//findConstructorDelegationUsages(info, result)
findKotlinOverrides(info, result)
//findKotlinOverrides(info, result)
if (info is JavaChangeInfo) {
findKotlinCallers(info, result)
}
@@ -418,6 +418,7 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
}
}
/*
private fun findKotlinOverrides(changeInfo: ChangeInfo, result: MutableSet<UsageInfo>) {
val method = changeInfo.method
if (!method.isTrueJavaMethod()) return
@@ -429,6 +430,7 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
findDeferredUsagesOfParameters(changeInfo, result, unwrappedElement, functionDescriptor)
}
}
*/
private fun findKotlinCallers(changeInfo: JavaChangeInfo, result: MutableSet<UsageInfo>) {
val method = changeInfo.method
@@ -492,6 +494,25 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
// Delete OverriderUsageInfo and CallerUsageInfo for Kotlin declarations since they can't be processed correctly
// TODO (OverriderUsageInfo only): Drop when OverriderUsageInfo.getElement() gets deleted
val usageInfos = refUsages.get()
for (usageInfo in usageInfos) {
if (usageInfo !is KotlinWrapperForJavaUsageInfos) continue
val infos = usageInfo.javaUsageInfos
for (i in infos.indices) {
val javaUsageInfo = infos[i]
if (javaUsageInfo !is OverriderUsageInfo) continue
val psiMethod = javaUsageInfo.overridingMethod
if (psiMethod !is KtLightMethod) continue
val origin = psiMethod.getOrigin()
if (origin != null) {
infos[i] = UsageInfo(origin)
}
}
}
val adjustedUsages = usageInfos.filterNot { getOverriderOrCaller(it) is KtLightMethod }
if (adjustedUsages.size < usageInfos.size) {
refUsages.set(adjustedUsages.toTypedArray())
@@ -777,6 +798,26 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
return null
}
private fun hasInvalidOldIndex(it: JavaParameterInfo, usageInfo: KotlinWrapperForJavaUsageInfos): Boolean {
return it.oldIndex >= usageInfo.javaChangeInfo.method.parameterList.parametersCount
}
// TODO: Get rid of this hack
private fun createJavaChangeInfoDelegate(javaChangeInfo: JavaChangeInfo, usageInfo: KotlinWrapperForJavaUsageInfos): JavaChangeInfo {
if (!javaChangeInfo.newParameters.any { hasInvalidOldIndex(it, usageInfo) }) return javaChangeInfo
return object : JavaChangeInfo by javaChangeInfo {
private val _newParameters = javaChangeInfo.newParameters.map {
if (hasInvalidOldIndex(it, usageInfo)) {
ParameterInfoImpl(-1, it.name, it.typeWrapper, it.defaultValue)
}
else it
}.toTypedArray()
override fun getNewParameters() = _newParameters
}
}
override fun processUsage(changeInfo: ChangeInfo, usageInfo: UsageInfo, beforeMethodChange: Boolean, usages: Array<UsageInfo>): Boolean {
val method = changeInfo.method
val isJavaMethodUsage = isJavaMethodUsage(usageInfo)
@@ -799,7 +840,8 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
if (isOverriderOrCaller(usage)) {
processor.processUsage(javaChangeInfo, usage, true, javaUsageInfos)
}
if (processor.processUsage(javaChangeInfo, usage, beforeMethodChange, javaUsageInfos)) break
val changeInfoDelegate = createJavaChangeInfoDelegate(javaChangeInfo, usageInfo)
if (processor.processUsage(changeInfoDelegate, usage, beforeMethodChange, javaUsageInfos)) break
}
if (usage is OverriderUsageInfo && usage.isOriginalOverrider) {
val overridingMethod = usage.overridingMethod

View File

@@ -24,7 +24,7 @@ import com.intellij.openapi.command.impl.FinishMarkAction
import com.intellij.openapi.command.impl.StartMarkAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.openapi.util.Key
import com.intellij.openapi.util.TextRange
import com.intellij.psi.*
@@ -32,6 +32,7 @@ import com.intellij.psi.util.PsiTreeUtil
import com.intellij.refactoring.HelpID
import com.intellij.refactoring.introduce.inplace.OccurrencesChooser
import com.intellij.refactoring.util.CommonRefactoringUtil
import com.intellij.ui.components.JBList
import com.intellij.util.SmartList
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
@@ -378,13 +379,29 @@ object KotlinIntroduceVariableHandler : KotlinIntroduceHandlerBase() {
CommonRefactoringUtil.showErrorHint(project, editor, message, INTRODUCE_VARIABLE, HelpID.INTRODUCE_VARIABLE)
}
private fun KtExpression.chooseApplicableComponentFunctions(haveOccurrencesToReplace: Boolean): List<FunctionDescriptor>? {
if (haveOccurrencesToReplace) return emptyList()
private fun KtExpression.chooseApplicableComponentFunctions(
haveOccurrencesToReplace: Boolean,
editor: Editor?,
callback: (List<FunctionDescriptor>) -> Unit
) {
if (haveOccurrencesToReplace) return callback(emptyList())
val functions = getApplicableComponentFunctions(this)
if (functions.size <= 1) return emptyList()
if (functions.size <= 1) return callback(emptyList())
return functions
if (ApplicationManager.getApplication().isUnitTestMode) return callback(functions)
if (editor == null) return callback(emptyList())
val list = JBList("Create single variable", "Create destructuring declaration")
JBPopupFactory.getInstance()
.createListPopupBuilder(list)
.setMovable(true)
.setResizable(false)
.setRequestFocus(true)
.setItemChoosenCallback { callback(if (list.selectedIndex == 0) emptyList() else functions) }
.createPopup()
.showInBestPositionFor(editor)
}
private fun executeMultiDeclarationTemplate(
@@ -517,67 +534,67 @@ object KotlinIntroduceVariableHandler : KotlinIntroduceHandlerBase() {
commonContainer = container
}
val componentFunctions = physicalExpression.chooseApplicableComponentFunctions(replaceOccurrence) ?: return@Pass
val validator = NewDeclarationNameValidator(
commonContainer,
calculateAnchor(commonParent, commonContainer, allReplaces),
NewDeclarationNameValidator.Target.VARIABLES
)
val suggestedNames = if (componentFunctions.isNotEmpty()) {
val collectingValidator = CollectingNameValidator(filter = validator)
componentFunctions.map { suggestNamesForComponent(it, project, collectingValidator) }
}
else {
KotlinNameSuggester.suggestNamesByExpressionAndType(expression,
substringInfo?.type,
bindingContext,
validator,
"value").singletonList()
}
val introduceVariableContext = IntroduceVariableContext(
expression, suggestedNames, allReplaces, commonContainer, commonParent,
replaceOccurrence, noTypeInference, expressionType, componentFunctions, bindingContext, resolutionFacade
)
project.executeCommand(INTRODUCE_VARIABLE, null) {
runWriteAction { introduceVariableContext.runRefactoring() }
val property = introduceVariableContext.propertyRef ?: return@executeCommand
if (editor == null) {
onNonInteractiveFinish?.invoke(property)
return@executeCommand
physicalExpression.chooseApplicableComponentFunctions(replaceOccurrence, editor) { componentFunctions ->
val validator = NewDeclarationNameValidator(
commonContainer,
calculateAnchor(commonParent, commonContainer, allReplaces),
NewDeclarationNameValidator.Target.VARIABLES
)
val suggestedNames = if (componentFunctions.isNotEmpty()) {
val collectingValidator = CollectingNameValidator(filter = validator)
componentFunctions.map { suggestNamesForComponent(it, project, collectingValidator) }
}
else {
KotlinNameSuggester.suggestNamesByExpressionAndType(expression,
substringInfo?.type,
bindingContext,
validator,
"value").singletonList()
}
val introduceVariableContext = IntroduceVariableContext(
expression, suggestedNames, allReplaces, commonContainer, commonParent,
replaceOccurrence, noTypeInference, expressionType, componentFunctions, bindingContext, resolutionFacade
)
project.executeCommand(INTRODUCE_VARIABLE, null) {
runWriteAction { introduceVariableContext.runRefactoring() }
editor.caretModel.moveToOffset(property.textOffset)
editor.selectionModel.removeSelection()
val property = introduceVariableContext.propertyRef ?: return@executeCommand
if (!isInplaceAvailable) return@executeCommand
PsiDocumentManager.getInstance(project).commitDocument(editor.document)
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.document)
when (property) {
is KtProperty -> {
KotlinVariableInplaceIntroducer(
property,
introduceVariableContext.reference,
introduceVariableContext.references.toTypedArray(),
suggestedNames.single(),
/*todo*/ false,
/*todo*/ false,
expressionType,
noTypeInference,
project,
editor
).startInplaceIntroduceTemplate()
if (editor == null) {
onNonInteractiveFinish?.invoke(property)
return@executeCommand
}
is KtMultiDeclaration -> {
executeMultiDeclarationTemplate(project, editor, property, suggestedNames)
}
editor.caretModel.moveToOffset(property.textOffset)
editor.selectionModel.removeSelection()
else -> throw AssertionError("Unexpected declaration: ${property.getElementTextWithContext()}")
if (!isInplaceAvailable) return@executeCommand
PsiDocumentManager.getInstance(project).commitDocument(editor.document)
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.document)
when (property) {
is KtProperty -> {
KotlinVariableInplaceIntroducer(
property,
introduceVariableContext.reference,
introduceVariableContext.references.toTypedArray(),
suggestedNames.single(),
/*todo*/ false,
/*todo*/ false,
expressionType,
noTypeInference,
project,
editor
).startInplaceIntroduceTemplate()
}
is KtMultiDeclaration -> {
executeMultiDeclarationTemplate(project, editor, property, suggestedNames)
}
else -> throw AssertionError("Unexpected declaration: ${property.getElementTextWithContext()}")
}
}
}
}

View File

@@ -16,19 +16,37 @@
package org.jetbrains.kotlin.idea.refactoring.introduce.introduceVariable
import org.jetbrains.kotlin.builtins.PrimitiveType
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.idea.analysis.analyzeInContext
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.imports.importableFqName
import org.jetbrains.kotlin.idea.util.getResolutionScope
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtPsiFactory
import org.jetbrains.kotlin.psi.createExpressionByPattern
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.types.typeUtil.supertypes
import org.jetbrains.kotlin.util.isValidOperator
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
fun getApplicableComponentFunctions(expression: KtExpression): List<FunctionDescriptor> {
val facade = expression.getResolutionFacade()
val scope = expression.getResolutionScope(facade.analyze(expression), facade)
val context = facade.analyze(expression)
val builtIns = facade.moduleDescriptor.builtIns
val forbiddenClasses = arrayListOf(builtIns.collection, builtIns.array)
PrimitiveType.values().mapTo(forbiddenClasses) { builtIns.getPrimitiveArrayClassDescriptor(it) }
context.getType(expression)?.let {
if ((it.singletonList() + it.supertypes()).any {
val fqName = it.constructor.declarationDescriptor?.importableFqName
forbiddenClasses.any { it.fqNameSafe == fqName }
}) return emptyList()
}
val scope = expression.getResolutionScope(context, facade)
val psiFactory = KtPsiFactory(expression)
@Suppress("UNCHECKED_CAST")

View File

@@ -36,11 +36,12 @@ import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import java.util.*
public class KotlinJUnitRunConfigurationProducer : RunConfigurationProducer<JUnitConfiguration>(JUnitConfigurationType.getInstance()) {
override fun isConfigurationFromContext(configuration: JUnitConfiguration,
context: ConfigurationContext): Boolean {
if (RunConfigurationProducer.getInstance(javaClass<PatternConfigurationProducer>()).isMultipleElementsSelected(context)) {
if (PatternConfigurationProducer.isMultipleElementsSelected(context)) {
return false
}
@@ -112,6 +113,7 @@ public class KotlinJUnitRunConfigurationProducer : RunConfigurationProducer<JUni
return false
}
/*
override fun onFirstRun(fromContext: ConfigurationFromContext, context: ConfigurationContext, performRunnable: Runnable) {
val leaf = fromContext.sourceElement
getTestClass(leaf)?.let { testClass ->
@@ -131,6 +133,7 @@ public class KotlinJUnitRunConfigurationProducer : RunConfigurationProducer<JUni
super.onFirstRun(fromContext, context, performRunnable)
}
*/
private fun getTestMethodLocation(leaf: PsiElement): Location<PsiMethod>? {
val function = leaf.getParentOfType<KtNamedFunction>(false) ?: return null

View File

@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.idea.stubindex.KotlinAnnotationsIndex
import org.jetbrains.kotlin.idea.util.application.runReadAction
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType
import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils

View File

@@ -1,49 +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.search.ideaExtensions
import com.intellij.psi.PsiClass
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.searches.ClassesWithAnnotatedMembersSearch
import com.intellij.psi.search.searches.ScopedQueryExecutor
import com.intellij.util.Processor
import org.jetbrains.kotlin.asJava.LightClassUtil
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.search.allScope
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
class KotlinClassesWithAnnotatedMembersSearcher : ScopedQueryExecutor<PsiClass, ClassesWithAnnotatedMembersSearch.Parameters> {
override fun getScope(param: ClassesWithAnnotatedMembersSearch.Parameters): GlobalSearchScope {
return GlobalSearchScope.getScopeRestrictedByFileTypes(param.annotationClass.project.allScope(), KotlinFileType.INSTANCE)
}
override fun execute(queryParameters: ClassesWithAnnotatedMembersSearch.Parameters, consumer: Processor<PsiClass>): Boolean {
val processed = hashSetOf<KtClassOrObject>()
return KotlinAnnotatedElementsSearcher.processAnnotatedMembers(queryParameters.annotationClass,
queryParameters.scope,
{ it.getNonStrictParentOfType<KtClassOrObject>() !in processed}) { declaration ->
val ktClass = declaration.getNonStrictParentOfType<KtClassOrObject>()
if (ktClass != null && processed.add(ktClass)) {
val lightClass = LightClassUtil.getPsiClass(ktClass)
if (lightClass != null) consumer.process(lightClass) else true
}
else
true
}
}
}

View File

@@ -41,7 +41,7 @@ public class KotlinOverridingMethodReferenceSearcher : MethodUsagesSearcher() {
super.processQuery(p, consumer)
val method = p.method
p.project.runReadActionInSmartMode {
method.project.runReadActionInSmartMode {
val containingClass = method.containingClass ?: return@runReadActionInSmartMode
val searchScope = p.effectiveSearchScope

View File

@@ -30,6 +30,7 @@ import com.intellij.openapi.util.TextRange
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.*
import com.intellij.psi.search.GlobalSearchScopesCore
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.testIntegration.createTest.CreateTestAction
import com.intellij.testIntegration.createTest.TestGenerators
import org.jetbrains.kotlin.asJava.KtLightClass
@@ -92,17 +93,17 @@ class KotlinCreateTestIntention : SelfTargetingRangeIntention<KtClassOrObject>(K
val propertiesComponent = PropertiesComponent.getInstance()
val testFolders = HashSet<VirtualFile>()
CreateTestAction.checkForTestRoots(srcModule, testFolders)
if (testFolders.isEmpty() && !propertiesComponent.getBoolean("create.test.in.the.same.root")) {
if (testFolders.isEmpty() && !propertiesComponent.getBoolean("create.test.in.the.same.root", false)) {
if (Messages.showOkCancelDialog(
project,
"Create test in the same source root?",
"No Test Roots Found",
Messages.getQuestionIcon()) != Messages.OK) return
propertiesComponent.setValue("create.test.in.the.same.root", true)
propertiesComponent.setValue("create.test.in.the.same.root", java.lang.Boolean.TRUE.toString())
}
val srcClass = CreateTestAction.getContainingClass(element) ?: return
val srcClass = getContainingClass(element) ?: return
val srcDir = element.containingFile.containingDirectory
val srcPackage = JavaDirectoryService.getInstance().getPackage(srcDir)
@@ -166,4 +167,18 @@ class KotlinCreateTestIntention : SelfTargetingRangeIntention<KtClassOrObject>(K
}
}.invoke(element.project, editor, element.toLightClass()!!)
}
private fun getContainingClass(element: PsiElement): PsiClass? {
val psiClass = PsiTreeUtil.getParentOfType(element, PsiClass::class.java, false)
if (psiClass == null) {
val containingFile = element.containingFile
if (containingFile is PsiClassOwner) {
val classes = containingFile.classes
if (classes.size() == 1) {
return classes[0]
}
}
}
return psiClass
}
}

View File

@@ -39,7 +39,7 @@ import java.util.regex.Pattern
// TODO: We can reuse JavaTestFinder if Kotlin classes have their isPhysical() return true
class KotlinTestFinder : JavaTestFinder() {
override fun findSourceElement(from: PsiElement): PsiClass? {
super.findSourceElement(from)?.let { return it }
// super.findSourceElement(from)?.let { return it }
val classOrObject = from.parentsWithSelf.filterIsInstance<KtClassOrObject>().firstOrNull { !it.isLocal() } ?: return null
if (classOrObject.resolveToDescriptorIfAny() == null) return null

View File

@@ -1,5 +1,5 @@
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$Data
// CONFIGURE_LIBRARY: JUnit@lib/junit-4.12.jar
// CONFIGURE_LIBRARY: JUnit@lib/junit-4.11.jar
class A {<caret>
}

View File

@@ -1,7 +1,7 @@
import org.junit.runners.Parameterized
// ACTION_CLASS: org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateTestSupportActionBase$Data
// CONFIGURE_LIBRARY: JUnit@lib/junit-4.12.jar
// CONFIGURE_LIBRARY: JUnit@lib/junit-4.11.jar
class A {
@Parameterized.Parameters
fun data(): Collection<Array<Any>> {

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