Commit Graph

3221 Commits

Author SHA1 Message Date
Tagir Valeev c483ae9cd0 ControlFlowUtils#getInitializerUsageStatus fixed for do-while loops where var is declared just before the loop 2018-02-21 12:24:01 +07:00
Tagir Valeev 3b96a595b9 DeleteSideEffectsAwareFix: handle comments 2018-02-20 17:06:53 +07:00
Anna.Kozlova bca21ba8c6 inference: substitution for captures (IDEA-186844) 2018-02-19 18:36:42 +01:00
Tagir Valeev 413aca292b WrapWithAdapterMethodCallFix: correctly handle disjunction type
Fixes EA-116570 Cannot create expression for type class com.intellij.psi.PsiDisjunctionType
2018-02-18 07:54:47 +07:00
Tagir Valeev f5975ad8a2 Variable finality highlighting fixes
Unreachable branches are analyzed for twice assignment, but constants are evaluated.
Fixes IDEA-186321 Bad code green: non-iterating for-loop update
Fixes IDEA-186304 good code red: field might not have been initialized in unreachable branch
Fixes (mostly) IDEA-186305 good code red: variable might already have been assigned to
2018-02-17 12:35:03 +07:00
Anna.Kozlova 8703c07861 disable add on demand static import for method reference qualifiers
IDEA-186826
2018-02-16 16:01:55 +01:00
Daniil Ovchinnikov 872ddb5d0e [jvm-lang] rename create getter/setter actions
- _Create Getter_ -> _Create read-only property 'foo' in 'Bar'_
- _Create Setter_ -> _Create write-only property 'foo' in 'Bar'_

Action names are now consistent with _Create property 'foo' in 'Bar'_.
2018-02-15 16:00:36 +03:00
Anna.Kozlova 8d8a443512 enum, abstract and final should be an error somewhere (IDEA-186642) 2018-02-14 18:37:36 +01:00
Daniil Ovchinnikov 544ee7980f [jvm-lang] java: port _Create getter/setter from usage_ actions
- extract PropertyRenderer for reusing;
- make them work with type parameter guesser.
2018-02-13 01:15:09 +03:00
Daniil Ovchinnikov 3151924a52 [jvm-lang] java: don't create private abstract methods (IDEA-186499) 2018-02-12 19:25:20 +03:00
Daniil Ovchinnikov fbe959bf47 [jvm-lang] java: port _Create property from usage_ action
- make it create template for both getter and setter;
- make it work with type parameter guesser;
- add tests!
2018-02-12 17:45:12 +03:00
Tagir Valeev 63231c630d IDEA-186381 bad code green: variable might already have been assigned
Fixed parentheses handling on the left-side of assignment and in unary operations
Fixed error message priority
2018-02-09 12:45:18 +07:00
Tagir Valeev c8f3d1e20c ControlFlowUtil#isVariableAssignedInLoop: evaluate constant conditions
Fixes IDEA-186306 good code red: variable might be assigned in loop
2018-02-08 13:29:49 +07:00
Tagir Valeev 4234f0d140 EffectiveFinal tests reported in IDEA-154224, IDEA-163280, IDEA-171790 2018-02-08 13:21:31 +07:00
Tagir Valeev b9630248cd FinalVariableMightNotHaveBeenInitializedInsideLambda: added separate initializer test 2018-02-08 12:31:34 +07:00
Tagir Valeev bf640e78a9 ControlFlowAnalyzer: fix control flow for assert (IDEA-186305) 2018-02-08 11:57:02 +07:00
Anna.Kozlova 55d26d0c27 inherit with different parameterization: fix for raw types (IDEA-186271) 2018-02-07 18:36:34 +01:00
Anna.Kozlova be6d0a2981 false positive in redundant cast: applicable method with inference error (IDEA-186224) 2018-02-07 09:44:28 +01:00
Tagir Valeev 7e915181dc RedundantCollectionOperationInspection: fix redundant asList type 2018-02-07 11:10:20 +07:00
Tagir Valeev 8d8dce807a RedundantCollectionOperationInspection: simplify Collections.sort(asList(arr)) to Arrays.sort(arr)
Fixes IDEA-93038 Inspection: Replace Collections.sort() with Arrays.sort()
2018-02-06 13:05:29 +07:00
Tagir Valeev d5f9284f2e ExpressionUtils#isSimpleExpression: disable for non-final fields 2018-02-05 15:53:39 +07:00
Tagir Valeev 818b20eff3 RedundantComparatorComparing: cosmetic changes, internationalization
Review ID: IDEA-CR-28770
2018-02-05 12:33:55 +07:00
Tagir Valeev e21d6c984e IDEA-126310 Unnecessary toString() call fix breaks code 2018-02-04 18:10:11 +07:00
Tagir Valeev 4be91bbc65 Fixed imports in testdata. 2018-02-04 17:21:33 +07:00
Tagir Valeev 5bfb15ec8c CommentTracker: do not add comments at the beginning of reference qualifier: add it to the parent element instead 2018-02-04 16:34:23 +07:00
Daniil Ovchinnikov 6e0f6897c9 [jvm-lang] group 'Create method' and 'Create field' actions 2018-02-02 17:07:57 +03:00
Anna Kozlova e6e51584ef unqualified getClass() type fixed (IDEA-186043) 2018-02-02 15:52:51 +03:00
Tagir Valeev b477b32395 IDEA-186034 Lambda can be method call inspection should not generate code with inference failures 2018-02-02 12:09:53 +07:00
Anna Kozlova 30464d6b08 disable fixes when target types depend on unresolved type params (IDEA-185967) 2018-02-01 13:40:04 +03:00
Tagir Valeev f06e8ca2f0 IDEA-185812 Allow to force explicit toCollection(ArrayList::new) instead of toList() in "Subsequent steps can be fused into Stream API" 2018-02-01 17:16:04 +07:00
Tagir Valeev dde611b8f4 IDEA-185819 Operator ! cannot be applied to void: add a quick-fix 2018-02-01 10:37:29 +07:00
Roman Ivanov 465f4124a2 SortContentAction: support generic types in vararg: IDEA-185852 2018-01-31 16:23:10 +07:00
Anna Kozlova f1536bb969 use lambda to avoid context remapping (IDEA-185448)
for anonymous class this expressions have to be encoded to point to outer class, for lambda expressions there is no need for that. Leave unchanged (array initializer) for old java versions
2018-01-30 19:38:53 +03:00
Anna Kozlova ca1d8a348c postpone highlighting on conditions when errors occur on containing call
poly conditional expression receives type from context, if context contains errors, it's better to highlight those first (IDEA-185540)
2018-01-30 11:33:49 +03:00
Roman Ivanov 798fea215a SortContentAction: fix warping in the middle of initializer: IDEA-185786 2018-01-30 13:58:05 +07:00
Roman Ivanov c71ae7e4f1 SortContentAction: consistent count of expr to be available: IDEA-185785 2018-01-30 13:58:05 +07:00
Tagir Valeev 3210510c96 CollectionUtils#isCollectionOrMapSize
Used in ToArrayCallWithZeroLengthArrayArgumentInspection and StreamApiMigrationInspection
2018-01-30 11:01:38 +07:00
Roman Ivanov abd1458307 SortContentAction: fix IOOBE, check if expr is literal: IDEA-185784 2018-01-30 10:39:30 +07:00
Roman Ivanov d5d06483fe RedundantExplicitCloseInspection created: IDEA-176630 2018-01-30 10:39:29 +07:00
Tagir Valeev 2f547ca38f RedundantStringOperationInspection: warn about append(s.substring(x, y))
Replaceable with append(s, x, y)
Fixes IDEA-185652 Improve StringBulder.append(s.substring(1,2)) intention
Also optimization of new expression resolution
2018-01-29 13:34:55 +07:00
Tagir Valeev 97300d73f1 IDEA-185548 Inspection to remove excessive Comparator.comparing call 2018-01-26 12:27:12 +07:00
Tagir Valeev b3a46c4960 AddOnDemandStaticImport: test-case with nested calls and comments
Review ID: IDEA-CR-28752
2018-01-25 16:33:34 +07:00
Roman Ivanov 6b81e567cc MoveConditionToLoopInspection: change name : IDEA-185134 2018-01-25 16:02:05 +07:00
Tagir Valeev 6cc8936598 Compute constant expression as an inspection; minor improvements
Works for unary operation
Do not suggested if replacement is the same as the original code
Replacement is displayed in the quick-fix name
2018-01-25 15:43:48 +07:00
Tagir Valeev eeb1483ed0 AddOnDemandStaticImportAction: handle comments 2018-01-25 12:05:05 +07:00
Roman Shevchenko ab283f3cec [java] adds language level 10 2018-01-24 15:43:12 +03:00
Tagir Valeev e2d5de3528 ExpressionUtils#isEvaluatedAtCompileTime: fixed for casts to String (operand was not checked) 2018-01-24 14:36:20 +07:00
Tagir Valeev d828baf6e3 LambdaAndExplicitMethodPair: Arrays.setAll -> Arrays.fill pair added
Allows to make IDEA-185394 in two steps
2018-01-24 13:37:55 +07:00
Anna Kozlova 04b7efb5cd don't calculate substitution for overload resolution applicability checks 2018-01-22 17:07:38 +03:00
Alexey Kudravtsev 5f67dd2d84 quick fix to convert empty anonymous class to the plain new expression 2018-01-22 15:10:16 +03:00