Commit Graph

106 Commits

Author SHA1 Message Date
Tagir Valeev 327e51962b IDEA-166814 Stream API migration: support more post-loop steps 2017-01-19 14:14:20 +07:00
Tagir Valeev cbd273dda8 StreamApiMigration: minor fixes in FindFirst scenarios 2017-01-18 13:52:12 +07:00
Tagir Valeev a363362459 StreamApiMigration: automatically simplify IntStream.range().mapXyz chains; IndexedContainer#getElementType: do not erase 2017-01-16 17:43:50 +07:00
Tagir Valeev 5b04785164 IDEA-166499 Stream API migration: support array filling in a loop 2017-01-12 17:37:10 +07:00
Tagir Valeev 5a599cdffd IDEA-166424 Guava create collections , nonsupport replace with stream API 2017-01-12 11:55:44 +07:00
Tagir Valeev 347bd66e81 StreamApiMigrationInspection: enable flatMap with primitive type change 2017-01-12 11:18:29 +07:00
Tagir Valeev 0957d52585 Convert for-loop with Collections.addAll: support primitive types; switch off when count expression is used; wrong contracts removed 2017-01-12 11:04:58 +07:00
Tagir Valeev 1ee8a1fbfe IDEA-166211 Convert for-loop with Collections.addAll inside into Java 8's stream API calls chain 2017-01-11 15:57:54 +07:00
Tagir Valeev b3a181a091 StreamApiMigrationInspection: refactoring of collect scenarios: CollectTerminal interface extracted and used; all forEach scenarios moved to ForEachMigration; cosmetics 2017-01-11 14:37:50 +07:00
Tagir Valeev 3738e54fee StreamApiMigration: add parentheses if necessary when .stream() can be omitted (fix for EA-93812). 2017-01-10 09:42:03 +06:00
Tagir Valeev 01d7ee7d3c IDEA-165942 Inspection to replace method call in a loop with bulk operation 2016-12-30 13:01:31 +07:00
Tagir Valeev 9cae3c25fa IDEA-165790 Stream API migration: support distinct() with collect(toList()) 2016-12-22 16:33:06 +07:00
Tagir Valeev e2b7d60680 StreamApiMigrationInspection: support limit count with separate variable 2016-12-22 12:33:15 +07:00
Tagir Valeev fb7790606c StreamApiMigrationInspection: try continue extracting operations when limit is successfully peeled off 2016-12-21 16:04:42 +07:00
Tagir Valeev 6341a52ccd StreamApiMigrationInspection: support postfix limit conversion (like if(count++ > 100) break; => limit(102)) (IDEA-CR-16910) 2016-12-21 13:45:42 +07:00
Tagir Valeev a15916ae24 IDEA-165063 Stream API migration: support simple limit conversions 2016-12-20 16:31:57 +07:00
Tagir Valeev e778bb8680 StreamApiMigrationInspection: chained computeIfAbsent generated incorrect code 2016-12-20 10:56:31 +07:00
Tagir Valeev 50223c222e Fix IDEA-165466 Stream API migration: automatically simplify emptyList().stream() to empty()
SimplifyStreamApiCallChainsInspection refactoring: simplifyCollectionStreamCalls extracted;
2016-12-15 17:13:14 +07:00
Tagir Valeev 54f7edf064 StreamApiMigrationInspection: use collect when computeIfAbsent is used; VariableAccessUtils#variableIsUsed instead of ReferenceSearch (IDEA-CR-16490) 2016-12-07 12:51:54 +07:00
Anna.Kozlova e55fbf3f1d isEffectivelyFinal: disallow effectively final variables to be initialized twice (IDEA-165060) 2016-12-06 17:54:19 +01:00
Tagir Valeev 203c11fca6 IDEA-164822 Migrate to Stream API: support toMap/groupingBy scenarios 2016-12-02 16:30:57 +07:00
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