Commit Graph

14753 Commits

Author SHA1 Message Date
Pavel V. Talanov 21b32b9de5 IDE Performance: skip resolver construction for non-relevant modules
Querying non-existent packages does not trigger module resolver computation
2017-05-16 22:15:07 +03:00
Pavel V. Talanov 55721e4f16 Test not creating resolvers for modules that have no relevant packages 2017-05-16 22:15:06 +03:00
Pavel V. Talanov 77e611b2e7 Minor: refactor PerModulePackageCacheService 2017-05-16 22:15:05 +03:00
Pavel V. Talanov f750d08350 Light classes: test extending Number and CharSequence 2017-05-16 22:01:06 +03:00
Pavel V. Talanov 1c5e7c4726 Make sure java completion doesn't suggest classes from builtIns
Fix an undesirable sideeffect of previous changes
2017-05-16 22:01:05 +03:00
Pavel V. Talanov 798c80ed07 Use wrappers around java.util.* to emulate kotlin.collection.* behaviour
Backend: If kotlin class extends kotlin.collection.List
    write it as it's super interface (light class mode only)
IDE: Provide wrapper classes to java resolve
    that try to emulate backend behaviour

For example if kotlin class implements kotlin.collections.Map,
    we provide a superinterface that has abstract 'getEntries' method
    and 'entrySet' method that is considered default.
In reality all those methods are generated in the class itself.

In IDE supporting this case without hacks is not feasible performance-wise
    since kotlin.collection.* may not be an immediate supertype and we need
    to compute all supertypes just to calculate own methods of the class
2017-05-16 22:01:03 +03:00
Pavel V. Talanov 40561dabed J2K JavaToKotlinClassMap 2017-05-16 22:00:58 +03:00
Mikhail Glukhikh 51af18608f AbstractLocalInspectionTest: add LANGUAGE_VERSION support
Related to KT-17164
2017-05-16 20:44:12 +03:00
Mikhail Glukhikh 9990550429 Introduce inspection "replace arrayOf with literal" #KT-17164 Fixed 2017-05-16 20:44:11 +03:00
Zalim Bashorov fb9d88315a Don't print unnecessary empty line separators when generate tests 2017-05-16 19:42:47 +03:00
Dmitry Neverov bf4e69e17f Make semicolon in loop with empty body not redundant
So #KT-12805 Fixed
2017-05-16 16:43:28 +03:00
fitermay e30b9758f4 Introduce action to add missing when branches on sealed class
Made via diagnostics NON_EXHAUSTIVE_WHEN_FOR_SEALED_CLASS
with INFO severity and quick-fix
So #KT-17580 Fixed
2017-05-16 16:43:27 +03:00
Alexey Sedunov 1072495001 Copy: Support top-level declarations 2017-05-16 13:10:41 +03:00
Alexey Sedunov 4c1c1a989a Copy: Support multiple classes in the same file 2017-05-16 13:10:40 +03:00
Alexey Sedunov 92446df14a Copy: Support class copying
#KT-8180 Fixed
 #KT-9054 Fixed
2017-05-16 13:10:39 +03:00
Alexey Sedunov f2bb6e4dac Rename: Support import aliases
#KT-4379 Fixed
2017-05-16 13:10:36 +03:00
Alexey Sedunov 3c94184de9 Rename: Support labeled expressions
#KT-7107 Fixed
2017-05-16 13:10:34 +03:00
Dmitry Jemerov 63d32a524c Fix exception on new file creation when no file template is defined
#KT-17906 Fixed
2017-05-16 11:59:38 +02:00
Dmitry Jemerov f113a5ce99 Fix stdlib-jre7/8 configuration in new projects
#KT-17875 Fixed
 #KT-17876 Fixed
2017-05-16 11:45:35 +02:00
Dmitry Jemerov 675305fef3 Don't highlight 'this' references as deprecated
#KT-17613 Fixed
2017-05-15 14:57:52 +02:00
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00
Nikolay Krasko c5a8001aa4 Revert generated formatter tests 2017-05-12 20:16:22 +03:00
Simon Ogorodnik a0a6ef4f2e Use ModalityState.any() for J2K post processing
#KT-17870 fixed
2017-05-12 17:53:50 +03:00
Nikolay Krasko 861cac5b52 Better indent in multi-line strings (KT-17849)
Inspired by MultilineStringEnterHandler from https://github.com/JetBrains/intellij-scala
https://github.com/JetBrains/intellij-scala/blob/edb741f344afff063197b406ca0c7c266a26c436/src/org/jetbrains/plugins/scala/editor/enterHandler/MultilineStringEnterHandler.scala

 #KT-17849 Fixed
2017-05-12 17:34:05 +03:00
Nikolay Krasko 30639b0a5e Allow injection in strings with interpolation (KT-6610)
#KT-6610 In Progress
2017-05-12 17:33:37 +03:00
Dmitry Jemerov f53b9aa419 Improve diagnostics for EA-100849
KNPE: DeserializerForClassfileDecompilerKt.DeserializerForClassfileDecompiler
2017-05-12 12:34:54 +02:00
Dmitry Jemerov db1f8c7541 EA-100074 - SOE: ExpressionsOfTypeProcessor.containsTypeOrDerivedInside 2017-05-12 12:33:46 +02:00
Dmitry Jemerov ddcde3f688 EA-101095 NSEE: KotlinUsageToPsiElementProvider.getAppropriateParentFrom) 2017-05-12 12:33:45 +02:00
Dmitry Jemerov 4e58319d1b Revert "Deprecated setting was used for import optimization on the fly. (#1049)"
This reverts commit 75d231cc37.
The added API is available only in IDEA 2017.1.1, not in the original 2017.1 build.
2017-05-12 12:33:45 +02:00
Mikhail Glukhikh a1e00ed9f1 Don't suggest "if to ?." without else when used in expression position 2017-05-11 20:47:16 +03:00
Mikhail Glukhikh 326d850760 Use "if-then to" even for 'if (arg != null) arg' removing 'if' 2017-05-11 20:47:10 +03:00
Mikhail Glukhikh 977d8e1cd7 If to safe access: fix message when no dot calls are available
Now "Replace 'if' with safe cast" is suggested
2017-05-11 20:47:04 +03:00
Mikhail Glukhikh a77390ccd6 Change both IfThenTo... inspections highlight level
Retain WEAK WARNING for null checks, one-liners,
and is checks without dot calls in main branch.
Set INFORMATION (no highlighting, just fix) for other cases.

Switch off both bound intentions.
So #KT-15076 Fixed
2017-05-11 20:46:51 +03:00
Mikhail Glukhikh 2d9a5afb15 Refactoring: convert problemHighlightType to function with parameter 2017-05-11 20:46:37 +03:00
Mikhail Glukhikh d9a33af61e Reduce range of IfThenTo... inspections to just 'if' 2017-05-11 20:46:31 +03:00
Mikhail Glukhikh 781a45c747 Minor refactoring: IfThenToSelectData.clausesReplaceableByElvis 2017-05-11 20:46:24 +03:00
Mikhail Glukhikh f3ee5ea45f IfThenToDoubleBang: fix AWT from writeAction problem 2017-05-11 20:46:17 +03:00
Mikhail Glukhikh 66c5717adc Refactoring of IfThen: ToDoubleBang / ToElvis / ToSafeAccess
Some common actions were extracted to IfThenUtils.kt
Use consistent logic in all three intentions
Also fixes potential PSI consistency problems in conversions dot->safe calls
2017-05-11 20:46:11 +03:00
Dmitry Neverov fd6d1520c7 Convert 'if' with 'is' check to 'as?' with safe call #KT-17054 Fixed 2017-05-11 20:46:05 +03:00
Mikhail Glukhikh 0361ed8c68 Refactoring: SelfTargetingIntention / IntentionBasedInspection
Remove complex logic which disables intention when bound inspection on
Add much simpler logic in SelfTargetingIntention.equals
2017-05-11 20:45:59 +03:00
Mikhail Glukhikh 6523f237a6 Test fix (I hope so) from parameter info group 2017-05-11 16:38:51 +03:00
Anton Bannykh 503891846f Updated some tests to expect the new '-Xfoo=bar' advanced options syntax 2017-05-10 19:32:52 +03:00
Mikhail Glukhikh f0543439f4 Use InfixCallToOrdinaryIntention directly for INFIX_MODIFIER_REQUIRED
So #KT-10211 Fixed
2017-05-10 17:43:46 +03:00
Mikhail Glukhikh 967c01f0ba Override 'equals' in SelfTargetingIntention
This prevents suggestion of duplicating intentions
2017-05-10 17:43:45 +03:00
Kirill Rakhman a8b2d3b4e8 Add inspection to detect copy() calls in a data class without named arguments
So #KT-17660 Fixed
2017-05-10 17:43:44 +03:00
Dmitry Jemerov 9c4f897d31 Index properties defined in primary constructor
#KT-15029 Fixed
2017-05-10 14:27:28 +02:00
Dmitry Jemerov ec53a6dbe7 Return non-default lexer state for unmatched backtick
When a document is changed, the editor highlighter restarts the lexer
at the last point where it was in the default state. Previously, if
a matching backtick was deleted and then reinserted, the lexer was
resumed just before the reinsertion point, and as the result the two
backticks were parsed not as two delimiters of a single token but as
two BAD_CHARACTER tokens. With this change, all tokens after the
unmatched backtick will be in a non-default state, so the lexer will
restart at the first backtick and will correctly see the two backticks
as a single token.

 #KT-9091 Fixed
2017-05-10 14:27:27 +02:00
Dmitry Jemerov 66877c138d Correctly handle editor selection in "Show expression type"
To avoid showing a large list, the previous logic returned only the
element directly at caret and other elements with the same start
offset. When selection is present, the platform logic looks only at
elements which have a larger range than the selection, so our elements
could be completely filtered out. Now we look at the selection
ourselves and adjust the returned elements accordingly.

 #KT-16423 Fixed
2017-05-10 14:27:26 +02:00
Dmitry Jemerov c3c0bcb1be Better caret position for new Kotlin file/class
#KT-15255 Fixed
2017-05-10 14:27:26 +02:00
Dmitry Jemerov d1893cfa5f Don't highlight entire complex callee expression as call
If an expression returns something that has invoke() defined on it,
this entire expression can act as a callee. If we highlight it, this
will suppress more useful highlighting such as string literals.

 #KT-16159 Fixed
2017-05-10 14:27:25 +02:00