Commit Graph

313 Commits

Author SHA1 Message Date
Ilya Kirillov 02c8e4cede New J2K: Do not remove semicolon after if expression when then branch is empty in RedundantSemicolonInspection 2019-04-03 11:24:14 +03:00
Dmitry Gridin 0237dc3f4b Fix inspections test 'Unused symbol' for enum entry 2019-03-27 12:27:48 +07:00
Toshiaki Kameyama 0f45e3d238 Fix false positive for HasPlatformType with member extension on 'dynamic'
#KT-29812 Fixed
2019-03-11 19:28:08 +03:00
Toshiaki Kameyama 7cba11ff28 Can be private: don't report if it's used in inline property
#KT-29085 Fixed
2019-02-05 11:34:08 +03:00
Nikolay Krasko 64b2527e31 Revert allowing upper case letters in packages (KT-27900) 2019-01-31 13:40:37 +03:00
Mikhail Glukhikh 04bd5139d5 Don't suggest "return type is..." inspections for anonymous functions
#KT-29290 Fixed
2019-01-28 16:03:55 +03:00
Denis Zharkov 37614254d7 Fix test on unused import suppression
Before the fix for KT-7185, the file looked like:
package suppression
@file:Suppress("UnusedImport")

import java.io.* // unused

And it was parsed incorrectly, because @file: annotations
should come before package directive
But after fix, import directives started being parsed that lead
to wrong unused import (because suppression wasn't parsed still)
2019-01-17 14:56:42 +03:00
Nikolay Krasko 2373c9d838 Allow underscore in packages and forbid uppercase letters (KT-27900) 2018-12-07 18:32:09 +03:00
Nikita Katkov 297054037c Dispatchers IO is now considered non-blocking context
See BlockingMethodInNonBlockingContextInspection
2018-12-07 15:19:12 +03:00
Vyacheslav Gerasimov d84c5b1608 Switch to 183 platform 2018-12-06 20:16:58 +03:00
Mikhail Glukhikh d909162a89 Rename "Result is Result" inspection to "Direct use of result type" 2018-11-30 15:14:26 +03:00
Toshiaki Kameyama c49770d9a7 Unused symbol: don't report for type parameter in open class #KT-23639 Fixed 2018-11-20 11:18:18 +03:00
Toshiaki Kameyama bc4d353134 Unused symbol: fix message for interface #KT-28286 Fixed 2018-11-20 11:14:45 +03:00
Toshiaki Kameyama e903b2f92a Unused symbol: don't report for finalize() method #KT-13311 Fixed 2018-11-13 10:26:06 +03:00
Toshiaki Kameyama 0bfcfb5716 ProtectedInFinalInspection: don't report for finalize() method #KT-13311 Fixed 2018-11-08 10:37:36 +03:00
Mikhail Glukhikh 9bc1dbb5bc Fix testCleanup 2018-10-31 19:00:29 +03:00
Yan Zhulanow 9dd6efeb46 Fix sporadic false-positive "Receiver parameter is never used" for local functions (KT-26481) 2018-10-24 20:12:42 +03:00
Mikhail Glukhikh a5e508a083 Unused symbol: handle functions with inline class parameters correctly
#KT-27357 Fixed
2018-10-19 19:07:59 +03:00
Mikhail Zarechenskiy d0ed76ebc8 183: Fix exception about unmapped lambda argument from IDE inspection
Intention: obtain lambda argument for some parent call,
 then get that call (for the lambda argument) and map
 the argument to the parameter.

 Before the fix, we were getting call for inner element,
 not for the lambda argument and as a result, there were exceptions.

 #KT-26873 Fixed
2018-09-26 18:03:34 +03:00
NikitaKatkov d2536f207c 183: CoroutineNonBlockingContextChecker for warning on blocking calls in coroutines (KT-15525) 2018-09-13 19:36:51 +03:00
Denis Zharkov aa74511378 Fix UnusedSymbolInspection for parameterless and suspend main functions
#KT-26574 Fixed
2018-09-12 09:49:25 +03:00
Roman Elizarov e2713501ce Rename SuccessOrFailure to Result and hide Failure from ABI
* The members of Result are isSuccess, isFailure, exceptionOrNull, getOrNull
* The rest of API is implemented via inline-only extensions
* There are two internal functions to hide detailed mechanics of an internal
  Result.Failure class: createFailure and throwOnFailure
* Result.toString is explicit: either Success(v) or Failure(x)

See KT-26538
2018-09-09 11:34:31 +03:00
Mikhail Glukhikh c12f29ae30 Enhance inspection about SuccessOrFailure (related to KT-25621)
Increase performance by searching first SuccessOrFailure/runCatching/etc
in text of functions without return type.
Remove stdlib false positives, like success() & failure().
For catching extension, check also non-catching members.
Add "rename to *Catching" fix.
2018-08-24 18:00:46 +03:00
Mikhail Glukhikh 87d750aa1c Add inspection to detect functions with SuccessOrFailure return type
Partial implementation of KT-25621 (no quick-fixes yet)
2018-08-24 18:00:41 +03:00
Mikhail Glukhikh af17a4e961 For each parameter unused: do not report with explicit parameter
In this case we are duplicating compiler warning.
Related to KT-22068
2018-08-13 19:03:00 +03:00
Dennis Cornwell f3b0378918 "ForEach parameter unused": don't report destructured parameters
Related to KT-22068
2018-08-13 19:02:56 +03:00
Dennis Cornwell e81eee4cc1 Introduce inspection for determining if a forEach parameter is unused
#KT-22068 Fixed
2018-08-13 19:02:53 +03:00
Mikhail Glukhikh e15fc7da15 Fix two inspection tests (bunch file -> original file) 2018-08-06 19:04:07 +03:00
Vyacheslav Gerasimov 0103c0d2fd Switch to 182 platform 2018-08-02 18:17:06 +03:00
Toshiaki Kameyama 4c34ced1fa Introduct "Redundant 'with' call" inspection #KT-6633 Fixed 2018-08-02 09:23:27 +03:00
Toshiaki Kameyama 4d1b8405cb "Suspicious ==/===": do not report when comparison with null is included
So #KT-24001 Fixed
2018-07-25 16:15:59 +03:00
Nikolay Krasko 7b6df0a7cc Don't delete unresolved imports in cleanup inspection (KT-25678)
It looks like they were deleted because of the bug in search for deprecated
imports search.

 #KT-25678 Fixed
2018-07-24 17:09:14 +03:00
Mikhail Glukhikh cc1d9e88d5 1.3 migration: make inspections working for non-experimental coroutines 2018-07-24 10:24:18 +03:00
Nikolay Krasko 5b34498162 Do not report code style warnings on overridden declarations (KT-25416)
#KT-25416 Fixed
2018-07-17 02:22:14 +03:00
Nikolay Krasko b51880332e Migration inspection for fromClosedRange() call (KT-17176)
#KT-17176 Open
2018-07-11 14:25:24 +03:00
Mikhail Glukhikh 7e0e7dc983 Unused symbol: remove forced "used" from actual declarations
Now we really check whether actual declaration has usages
(in expect or actual code) or not
Related to KT-17512
Related to KT-15666
2018-06-26 15:36:07 +03:00
Dmitry Petrov f956e8d85d Record special descriptor in REFERENCE_TARGET for type alias object
If a type alias is used to reference an object (companion object) as a
qualifier, record FakeCallableDescriptorForTypeAliasObject in
REFERENCE_TARGET. This tells IDE that type alias was used in the file,
thus, if it's imported, such import isn't redundant.
REFERENCE_TARGET is used mostly by IDE and by ClassifierUsageChecker,
which we also have to update to handle qualifiers with
FakeCallableDescriptorForTypeAliasObject in REFERENCE_TARGET.

Rewrite some parts of ClassifierUsageChecker for cleaner interaction.

 #KT-21863 Fixed Target versions 1.2.40
2018-06-20 17:16:25 +03:00
Mikhail Glukhikh 9ef89447b3 Sealed sub-class -> object: handle equals, suggest "add equals"
Before this commit, sealed sub-class without state was considered
a style issue.
After this commit, sealed sub-class without state AND custom equals
is considered a probable bug,
because comparison of its instances is very fragile.
Alternative fix (generate equals & hashCode by identity) is added.
2018-06-19 11:20:26 +03:00
Mikhail Glukhikh b235af0656 Can be private: correct detection of calls inside inline accessors 2018-06-13 19:17:50 +03:00
Mikhail Glukhikh faa8d92560 Unused receiver: do not report on actual declarations #KT-24562 Fixed 2018-06-13 18:12:36 +03:00
Mikhail Glukhikh 38632c2937 Can be private: correct detection of calls inside inline function
So #KT-22180 Fixed
So #KT-22094 Fixed
2018-06-13 18:12:34 +03:00
Mikhail Glukhikh a8737a1278 Can be private -> could be private (violation of naming convention) 2018-06-13 18:12:33 +03:00
Mikhail Glukhikh 6c8276b701 Do not report "can be private" on annotated declarations #KT-24422 Fixed 2018-06-13 18:12:28 +03:00
Mikhail Glukhikh d1155070a7 Do not report "can be private" on expect or actual declarations
So #KT-24374 Fixed
So #KT-24537 Fixed
2018-06-13 18:12:27 +03:00
Mikhail Glukhikh c95ed9fd20 Result unused: a few enhancements for PSI checks
Related to KT-15063, KT-24433
2018-05-22 17:13:48 +03:00
Mikhail Glukhikh b8375d4864 Extend "async result unused" to "Deferred result unused" #KT-15063 Fixed 2018-05-22 17:07:05 +03:00
Mikhail Glukhikh ffcfa51fbf Introduce inspection "async result unused" #KT-24433 Fixed 2018-05-22 16:39:14 +03:00
Nikolay Krasko 3ef67e1d9d Inspection for highlighting problem API usage
It's planned to use this inspection for show patchset branches problems
during development process.
2018-05-17 12:27:29 +03:00
Mikhail Glukhikh e933bb8220 Unused symbol suppression: get annotation descriptors via entries
Otherwise we miss use-site targeted annotations,
and getUseSiteTargetedAnnotations does not help
So #KT-20332 Fixed
2018-05-08 18:37:09 +03:00
Mikhail Glukhikh df59af8ee8 Move sort modifiers test to inspection local group
This should fix test in 181 branch
2018-04-27 17:26:56 +03:00