Commit Graph

844 Commits

Author SHA1 Message Date
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
Pavel Dolgov 6b7992b4ce Java: When generating return statement where the returned type is an array suggest Collection.toArray() if there's no better option (IDEA-163341) 2017-01-10 12:37:42 +03: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 38db92f734 UseBulkOperationInspection: register BulkMethodInfo via extension points; JPA classes extracted 2016-12-30 17:48:49 +07:00
Tagir Valeev 5e742cdfac StreamToLoopInspection: reuse final variable as non-final (removing "final" keyword) (IDEA-CR-17006) 2016-12-30 15:09:55 +07:00
Tagir Valeev a613a9253d UseBulkOperationInspection: qualifier expression checked; arrays support fixed for CrudRepository.save 2016-12-30 14:02:55 +07: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 2c57d04054 StringConcatenationInLoopsInspectionFix: fixed parenthesized append (IDEA-165968), fix renamed to "Convert variable ''{0}'' from String to {1}" 2016-12-28 13:40:03 +07:00
Tagir Valeev d707262f9d StreamToLoop: merge sorted().toArray() and sorted().collect(Collectors.toList()) into single step 2016-12-27 17:47:44 +07:00
Tagir Valeev 54eb6ce6af StreamToLoop: support condition inside flatMap 2016-12-27 14:40:01 +07:00
Tagir Valeev 96cf01152f StreamToLoop/ToPrimitiveArrayTerminalOperation: reassign final array making it possible to reuse existing variable 2016-12-27 13:58:09 +07:00
Tagir Valeev ae5d133904 StreamToLoopInspection: sorted() operation (currently for non-primitive streams only) 2016-12-27 13:13:53 +07:00
Tagir Valeev fb12495825 StreamToLoopInspection: unwrap && and || chains; copy return statement in found/not found places; do not eagerly evaluate non-trivial ternary branch 2016-12-27 12:38:05 +07:00
Tagir Valeev c9c574e428 StreamToLoopInspection: preserve comments; CommentTracker: now possible to delete element first and only after that register unchanged parts. 2016-12-23 18:09:43 +07:00
Tagir Valeev 1e33755e09 StreamToLoopInspection: reuse existing variable if we should reassign it in loop, but it's possible to use it as non-final 2016-12-23 13:30:08 +07:00
peter 66b8d67f53 IDEA-165067 Unwrapping 'if' leads to non-compilable code 2016-12-22 14:06:29 +01: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 7ebe6f583d StreamToLoop: fixed comparator parentheses wrapping; ParenthesesUtils changes reverted (unnecessary) 2016-12-20 09:48:30 +07:00
Tagir Valeev a94e87e968 StreamToLoop: inline simple common method references 2016-12-19 18:43:21 +07:00
Tagir Valeev 437d89ac15 StreamToLoop comparator support: insert parentheses if necessary 2016-12-19 16:50:08 +07:00
Tagir Valeev 204a045f0a StreamToLoop: min/max: Comparators as lambdas/method references supported; Comparator.naturalOrder() and reverseOrder() inlined. 2016-12-19 16:35:41 +07:00
Anna.Kozlova d7f10b93e1 retrieve type from binary comparisons to detect applicable constants (IDEA-165557) 2016-12-19 09:40:53 +01:00
Tagir Valeev 4b066b1b90 StreamToLoopInspection fixed when collection result is non-trivial generic type involving ? extends wildcards 2016-12-16 16:43:58 +07:00
Tagir Valeev 9c78db8af0 FunctionHelper: fix renaming in lambdas if autogenerated name conflicts with the existing one 2016-12-16 11:12:15 +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 3741495801 LambdaGenerationUtil: disable if expression is accessed for writing
Fixes IDEA-165482 Optional.isPresent suggests to replace the code which assigns the variable defined outside
2016-12-15 11:51:58 +07:00
Tagir Valeev f04e5ecef5 IDEA-165397 Replace stream API with loop: support lambdas as toArray argument 2016-12-15 09:52:13 +07:00
Tagir Valeev 81e951bf90 StreamToLoopInspection#ensureCodeBlock refactored to use PsiTreeUtil.mark/releaseMark (IDEA-CR-16755)
RefactoringUtil#expandExpressionLambdaToCodeBlock reverted (now changes there unnecessary)
void single-expression lambda support
2016-12-14 17:57:02 +07:00
Tagir Valeev dddfd5d7b6 LambdaGenerationUtil#canBeUncheckedLambda: supports statements; checks control-flow breaks;
Fix for IDEA-165369 Replace Optional.isPresent() should be disabled if the thenBranch contains non-local control flow
2016-12-14 15:44:59 +07:00
Tagir Valeev 215dabf2ae IDEA-163062 [Java8][Feature] Function.identity() inspection 2016-12-13 16:17:43 +07:00
Tagir Valeev e4f40bf51f StreamToLoopInspection: fix when stream is inside multi-line expression lambda 2016-12-13 12:35:16 +07:00
Tagir Valeev 7b65a6919d StreamToLoopInspection: handle some if/ifPresent cases 2016-12-13 12:33:43 +07:00
Tagir Valeev f25764d72f StreamToLoop: disable in this()/super() constructor invocation as we cannot generate statements before this/super call. 2016-12-12 19:12:02 +07:00
Tagir Valeev e87c551445 StreamToLoop: reuse variable if possible when the stream is used in the declaration 2016-12-12 17:27:54 +07:00
Tagir Valeev 810445f21d StreamToLoop: unwrap negation and ternary; minor refactoring 2016-12-12 17:27:53 +07:00
Tagir Valeev 8e128b7f32 StreamToLoop: support Optional unwrap if possible 2016-12-09 15:17:26 +07:00
Tagir Valeev f99940c8e3 StreamToLoop: add finisher parentheses automatically if necessary 2016-12-09 11:04:29 +07:00
Tagir Valeev c7ccea5186 StreamToLoop: add variable name suggestions from method reference output variable 2016-12-09 10:33:49 +07:00
Tagir Valeev e7e0982841 IDEA-165193 Provide a quick-fix to replace String concatenation in loop with StringBuilder 2016-12-08 15:56:55 +07:00
Dmitry Batkovich 4ac9d4360e create constructor parameter should consider context (e.g.: type parameter name == some class name from java.lang) 2016-12-07 18:23:14 +03: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
Tagir Valeev 95fac58f03 ExcessiveLambdaUsageInspection: support JUnit5 assertions; regex as lambdaMethod, minor improvements (IDEA-CR-16398) 2016-12-07 12:13:02 +07:00
Anna.Kozlova e55fbf3f1d isEffectivelyFinal: disallow effectively final variables to be initialized twice (IDEA-165060) 2016-12-06 17:54:19 +01:00
Pavel Dolgov 05744d1ffd Java: Merged ConfusingElseInspection and RemoveRedundantElseAction into RedundantElseInspection, made it an INFORMATION-level inspection (IDEA-162191) 2016-12-06 17:42:37 +03:00