Commit Graph
85 Commits
Author SHA1 Message Date
Tagir Valeev 9fe8c96b78 OptionalUtil#getMapTypeArgument: check nulls; remove 0-arg check 2016-11-11 12:02:36 +07:00
Tagir Valeev 7e574d661c IDEA-163764 "Replace Optional.isPresent() checks with functional-style expressions" create uncompilable code
IDEA-163463 Stream API migration: type argument before map appears sometimes when it's unnecessary
2016-11-11 11:28:44 +07:00
Tagir Valeev ff8a32476a StreamApiMigrationInspection: NPE fixed (EA-91387) 2016-11-09 12:27:15 +07:00
Tagir Valeev 21564bba7b IDEA-163627 Simplify optional.isPresent() inspection could better handle some specific cases
IDEA-163462 Simplify Optional.isPresent() ? Optional.get() : ...
2016-11-07 17:23:00 +07:00
Tagir Valeev 6e3d0c6c0e IDEA-163082 "can be replaced with addAll" inspection suggests a recursive call; support "this" qualifier for collect/addAll conversion 2016-10-25 11:38:24 +07:00
Tagir Valeev 4ce59ee865 Stream API Migration: do not add type arguments if a type is a wildcard type 2016-10-25 11:10:08 +07:00
Tagir Valeev d51f09d0d5 Stream API Migration: fix cases when boxed collection is iterated with primitive parameter (inspired by PR https://github.com/JetBrains/intellij-community/pull/455 by FHannes) 2016-10-24 17:44:45 +07:00
Tagir Valeev 7620508bc3 Stream API migration: ignore mutable variables in nested lambdas/anonymous classes; add type argument to map/mapToObj calls where necessary 2016-10-24 11:01:06 +07:00
Tagir Valeev aff7104a99 Stream API migration: add narrowing cast if necessary when replacing += with sum() 2016-10-24 10:28:29 +07:00
Tagir Valeev 3df2d1925d IDEA-162945 Stream API migration: support cases where variable is modified and reassigned 2016-10-21 15:09:35 +07:00
Tagir Valeev 8c6088647b IDEA-162875 Stream API migration: support conversion to BufferedReader.lines() 2016-10-21 12:10:10 +07:00
Tagir Valeev d807cd3b24 add missing StreamApiMigration test 2016-10-18 10:54:33 +07:00
Tagir Valeev ebf320b288 Stream API migration various fixes
1. findFirst() scenario can pull previous assignment (not declaration) now
2. anyMatch() fix did not work if there's single assignment to non-variable (e.g. array element)
3. if non-adjacent return becomes unreachable after findFirst()/anyMatch(), it returned automatically now
2016-10-07 11:59:52 +07:00
Tagir Valeev 0ad3891e96 IDEA-162157 Stream API migration: support counted for loop (both outer and flatMapped) 2016-10-06 17:59:25 +07:00
Tagir Valeev 46f9ce3e03 fix cast introduction in LambdaCanBeMethodReferenceInspection#replaceLambdaWithMethodReference 2016-10-05 12:24:55 +07:00
Tagir Valeev a53a0f3d61 StreamAPI migration: limited sorting support 2016-10-04 15:55:00 +07:00
Tagir Valeev 10c8616d19 StreamAPI migration: propose to use any/all/noneMatch if next return is not true/false (using || or &&) 2016-10-04 15:32:19 +07:00
Tagir Valeev 6723bcc1ea ExpressionUtils#getAssignment now returns simple assignments only (not compound assignments) 2016-10-04 14:16:08 +07:00
Tagir Valeev c6cf323132 ControlFlowUtils#statementBreaksLoop; StreamApiMigrationInspection#getInitializerUsageStatus simplified 2016-10-04 09:49:28 +07:00
Tagir Valeev 3c07adbe09 Stream API migration: replace with findFirst().ifPresent() chain 2016-10-03 12:43:45 +07:00
Tagir Valeev b53646340b Stream API migration: support nested anyMatch 2016-10-03 12:43:44 +07:00
Tagir Valeev df36bfcf5f IDEA-CR-14049 missing getType() added; support array initializers in Optional map 2016-09-30 16:53:43 +07:00
Tagir Valeev 738994f1c0 IDEA-161925 Stream API migration: support toArray conversion, fixed mapping to initialized array, fixed final variable status, clean up in RefactoringUtil 2016-09-30 16:12:57 +07:00
Tagir Valeev 7cb4480fd1 StreamApiMigrationInspection: references to non-final variables in intermediate operations were incorrectly handled sometimes 2016-09-30 10:23:12 +07:00
Tagir Valeev 5cbf3d5a9b StreamApiMigrationInspection: correctly handle anonymous classes/lambdas (IDEA-CR-14138) 2016-09-30 10:04:58 +07:00
Tagir Valeev b9a06d65b9 IDEA-161861 Stream API migration should handle cases where result variable is not declared just before the for loop 2016-09-29 15:54:08 +07:00
Tagir Valeev b141891dc1 StreamApiMigrationInspection: fix noneMatch()/allMatch() quick-fix name when continue is used; prettier Optional code generated in some cases 2016-09-27 11:21:17 +07:00
Tagir Valeev e69109e521 StreamApiMigrationInspection improvements: expression+break conversion to anyMatch; pull out cast of stream.findFirst().map(x -> (T)x).orElse(null) to (T) stream.findFirst().orElse(null) 2016-09-26 15:52:55 +07:00
Tagir Valeev 16e8ad126e IDEA-161706 Migration to Stream API: support primitive types int/long/double 2016-09-26 13:05:05 +07:00
Tagir Valeev 70ab891daf move StreamApiMigrationInspection to separate package, extract inner classes, add "suggest foreach" option, restore comments in anyMatch/findFirst/etc., fix trivial replacements with anyMatch/findFirst 2016-09-20 13:37:14 +07:00
Tagir Valeev 2e1c8b6067 IDEA-161260 convert to findFirst() if assignment is followed by break 2016-09-19 14:33:14 +07:00
Tagir Valeev 6919b5ddd6 IDEA-161002 More anyMatch cases supported with if statement 2016-09-19 12:19:21 +07:00
Tagir Valeev 8c3bbd3b2c IDEA-161260 Migration to findFirst(): Support more expression kinds in the last return statement 2016-09-15 16:30:49 +07:00
Tagir Valeev 5a5929c43f IDEA-161260 Stream API Migration: support findFirst() patterns 2016-09-15 12:13:11 +07:00
Tagir Valeev c29dc4e3a4 IDEA-161002 Support cases like if(...) { for(...) {...} } return false; 2016-09-13 12:21:27 +07:00
Tagir Valeev 9540aeb8c2 IDEA-CR-13640 Suggest variable name based on type 2016-09-13 11:35:14 +07:00
Tagir Valeev 6da7838df4 IDEA-161002 anyMatch/noneMatch disabled for non-final vars; allMatch is supported 2016-09-12 14:28:24 +07:00
Tagir Valeev 821b6c83f0 IDEA-CR-13651 BoolUtils.getNegatedExpressionText() used and fixed for float/double (to preserve semantics for NaNs) 2016-09-12 11:36:31 +07:00
Tagir Valeev 884043aacc IDEA-161002 Migration to Stream API: convert return true/return false to anyMatch/noneMatch 2016-09-09 17:41:19 +07:00
Tagir Valeev 610a2a914b IDEA-151523 Method reference is not created unconditionally now (for complex qualifier or non-final field it could be incorrect) 2016-09-09 13:58:56 +07:00
Tagir Valeev 6d5901be86 IDEA-160946 Labeled continue is excluded; understand if(..) continue else {...}; more tests 2016-09-09 11:22:00 +07:00
Tagir Valeev 29097076aa IDEA-160946 Stream API migration: understand if(...) continue at the beginning of the loop 2016-09-08 18:19:27 +07:00
Tagir Valeev c4b6464524 IDEA-160802 fixed case with collection summing 2016-09-08 16:53:51 +07:00
Tagir Valeev 55c8f0cf46 IDEA-151523 Replace with collect when working with an existing collection 2016-09-08 15:22:06 +07:00
Tagir Valeev 8015562c2d IDEA-160898 Inspection to convert several commonly-used lambdas to method references 2016-09-08 12:25:37 +07:00
Tagir Valeev 838d8a7146 IDEA-160789 Migration to Stream API: replace with mapToInt/Long/Double().sum() when possible 2016-09-06 15:50:03 +07:00
Tagir Valeev b0b62211d6 IDEA-160784 Migration to Stream API: replace with Stream.count() when possible (now i+=1 and i=i+1 also supported) 2016-09-06 12:37:05 +07:00
Tagir Valeev 7214316544 IDEA-160778 Buggy replacement with collect when several variables are declared in the same statement 2016-09-06 12:08:23 +07:00
Tagir Valeev f0276b724d StreamApiMigrationInspection: use toList()/toSet() collector if target variable type is Collection 2016-09-06 11:56:13 +07:00
Tagir Valeev e72f6656f8 IDEA-160784 Migration to Stream API: replace with Stream.count() when possible 2016-09-05 17:47:41 +07:00