Commit Graph
2104 Commits
Author SHA1 Message Date
Tagir Valeev 60a8572183 [java-inspections] OptionalAssignedToNull: avoid warning when Optional is received from Map.get (IDEA-292883)
GitOrigin-RevId: f41b21fa9d6588247aff0b3b4c8335ddfe74e7e9
2022-04-25 22:42:06 +00:00
Tagir Valeev ebdeb0022a [java-inspections] OptionalAssignedToNull: use isEmpty() where possible (IDEA-292883)
GitOrigin-RevId: a172b73ecadc38331e448a5d7aa371b2780813ae
2022-04-25 11:44:17 +00:00
Tagir Valeev 35711da1d7 [java-inspections] RedundantCompareCall: insert cast when both operands are boxed
Fixes IDEA-291826 IntelliJ Suggest simplify Integer.compare method to `==`

GitOrigin-RevId: 71882cec49e2846f0b30ae626da6d07381e516e2
2022-04-22 10:57:04 +00:00
Andrey.Cherkasov 88a009e6be [java-inspections] JavadocLinkAsPlainText and JavaDocReference: extract and unify UrlToHtmlFix for both inspections
IJ-CR-21142

GitOrigin-RevId: 64d01c0308d19de5c2e22eaefa8e1d7772e3fca4
2022-04-13 10:09:41 +00:00
Andrey.Cherkasov 147471c14a [java-inspections] JavadocLinkAsPlainText: finalize the inspection
IDEA-261795
IDEA-290689
IDEA-290417
IJ-CR-21142

GitOrigin-RevId: 27f46f839e7062627aeee03045bf654e1e4eca4f
2022-04-11 16:14:40 +00:00
Olga Klisho 42615cdffd [java] (IDEA-227433) remove doc comment when Use existing implementation of method fix is applied + test added
GitOrigin-RevId: 742a0995a87056cfd71ae61c02fa280a02ea18d8
2022-04-11 12:32:38 +00:00
Anna Kozlova cc8c23727d [javadoc] suggest to remove inappropriate @throws tag (IDEA-211691)
GitOrigin-RevId: 70dce7bebcd06bd85560775efc1daec533dc12b1
2022-04-08 15:02:40 +00:00
Anna Kozlova 42d091571a [java] don't suggest 'var' for functional expressions (IDEA-291741)
GitOrigin-RevId: 63f09455cddca03d4c9f9870a6c60e68e334c010
2022-04-08 15:02:37 +00:00
Tagir Valeev 5f0fd1d8e1 [java-inspections] ReplaceWithConstantValueFix: substitute parameter types when necessary
Fixes IDEA-276811 Replace-with-null refactoring is incorrect when generics are involved

GitOrigin-RevId: 5783d19c4c5458ecb3c1e97ed11ff1d78a756793
2022-04-07 07:55:36 +00:00
Tagir Valeev c81981ee75 [java-intentions] Rename 'Wrap using' fixes with 'Adapt using'.
Not everything is actually wrapping. E.g., converting 'long' to 'int' via 'Math.toIntExact' is definitely not wrapping. The 'adapt' word looks more abstract and suitable for all the cases.

GitOrigin-RevId: 33e56b6e16a0362598ac8e3fc92ef2808a77dbe0
2022-04-06 15:56:09 +00:00
Tagir Valeev 2d6d319d1e [java-intentions] Adapt type using no-arg instance methods
Part of IDEA-242022 WrapWithAdapterMethodCallFix.Wrapper improvement

GitOrigin-RevId: 4e4bac1a4f3942589e45970a61478e71bf08482c
2022-04-06 15:56:06 +00:00
Tagir Valeev b091a76763 [java-intentions] IDEA-291610 No 'wrap using...' fix when calling generic method
GitOrigin-RevId: 09137a44af4719d3affe57f509b9be270ae5815a
2022-04-06 15:56:04 +00:00
Andrey.Cherkasov f21e730404 [java-highlighting] Illegal combination of modifiers:
if one of interface method modifiers in illegal combination is 'final' the quick-fix should suggest removing it

IDEA-290172

GitOrigin-RevId: 7264f47c76068c36b4aa4b33f2f796dc1c2c0312
2022-04-05 08:55:05 +00:00
Tagir Valeev 69f9f107a8 [java-inspections] Fix boxing in ternary branches when NPE is possible (IDEA-267511)
GitOrigin-RevId: 95bd6ad84ace485bca5699192c4dfc161397736b
2022-04-04 11:20:51 +00:00
Ilyas Selimov b014f71140 IDEA-290391 - quickfix for qualified enum constants inside switch + static import fix is available for enhanced switch
GitOrigin-RevId: dca0a0918832a1814473886f45edc31e8fa3e6f7
2022-03-30 15:23:11 +00:00
Tagir Valeev 7726f94f08 [java-inspections] Convert switch to if: respect precedence when generating .equals() call
Fixes EA-465575 - AE: JavaParserUtil.parseFragment

GitOrigin-RevId: 7a94ea5a231f0952d593e21857e8d89a27df2dd2
2022-03-09 14:15:19 +00:00
Tagir Valeev 4a9b9b3cc2 [java-dfa] Remove useless fixes when value is known to be always null
Fixes IDEA-289497 'NullPointerException' recommendations contradiction

GitOrigin-RevId: 07be3f2ee5ce03bd7380b563806fcad03fb2a0f5
2022-03-03 10:49:26 +00:00
Andrey.Cherkasov f7e2722351 [java-inspections] JavadocLinkAsPlainText: reports links specified as plain text in Javadoc comments
IDEA-261795

GitOrigin-RevId: 69eeeb1c9ee920d40ce85e1b282d113560943cc0
2022-02-21 22:55:32 +00:00
Andrey.Cherkasov e4f850f492 [java-inspections] Qualify a method call: provide a quick-fix when non-static class is nested within a static one
IDEA-255881
IJ-CR-21030

GitOrigin-RevId: 710d2c6e2aa096646ad7a4a96d9b75d3d87711ce
2022-02-21 19:37:25 +00:00
Andrey.Cherkasov 0ab3b77293 [java-inspections] JavadocBlankLines: Reduce the number of false positives
GitOrigin-RevId: 873419b519056a436b0a22a2e88fce7da412901d
2022-02-21 19:37:19 +00:00
Artemiy Sartakov d788a8343d MultiplePathConstructionsInspection: merged inspection into DuplicateExpressionsInspection (IJ-CR-20710)
GitOrigin-RevId: 3270642202a3b62c8e787143ee4b9bfcc72f30c5
2022-02-21 08:44:10 +00:00
Andrey.Cherkasov f0000950e6 [java-intentions] Qualify a method call with an outer class name: fixes after review
IJ-CR-21030
IDEA-255881

GitOrigin-RevId: 8e6b0c6acb9505e75356c4c23c80c5c66870cd41
2022-02-19 05:57:41 +00:00
Andrey.Cherkasov b20808f9b0 [java-inspections] JavadocBlankLines: reports blank lines in Javadoc comments
IDEA-281540

GitOrigin-RevId: 2b1937a1e78a82bcdbfbd54b45a509024bcf1f58
2022-02-18 15:27:15 +00:00
Anna Kozlova 9a6025f68d [java] suggest to upgrade jdk if language feature from newer version is used (IDEA-256074)
GitOrigin-RevId: 82cd81b54f9ba59def65a5639e683f2a29e6432c
2022-02-18 10:43:35 +00:00
Andrey.Cherkasov 5a384ba859 [java-highlighting] Provide quick-fix to qualify a method call with an outer class name
IDEA-255881

GitOrigin-RevId: 137ebb954ba91bbe726a7e478b7e75060cd3b7c7
2022-02-18 04:21:27 +00:00
Andrey.Cherkasov 76de5537bb [java-intentions] RemoveRedundantLambdaParameterTypesFix: change the text shown in the quick-fix popup
IJ-CR-20911
IDEA-256074

GitOrigin-RevId: 3b80041a212f75d78438d448027038d6ab06c7ea
2022-02-18 04:21:24 +00:00
Andrey.Cherkasov 36709d3981 [java-intentions] ReceiverParameterNameFix: change the text shown in the quick-fix popup
IDEA-273225
IJ-CR-20529

GitOrigin-RevId: d3cfbb2b3b7c8f33974085c278d158a5c6a0bbba
2022-02-17 13:20:00 +00:00
Andrey.Cherkasov 22b6aff050 [java-highlighting] Provide quick-fix to remove 'var' for lambda parameters in language level smaller than Java 11
and don't suggest quick-fix to replace 'var' with explicit type for this case (IDEA-256074)

GitOrigin-RevId: e34af190c9bd86f200b26c153d27ce33750fd4df
2022-02-17 03:59:59 +00:00
Artemiy Sartakov a028df8220 IOStreamConstructorInspection: do not suggest fix in cases when FileNotFoundException is already handled (IDEA-288738)
GitOrigin-RevId: f55d0d899196a9db2fc9dfc2ab01fc7c5edb51bf
2022-02-16 15:37:05 +00:00
Andrey.Cherkasov 902218e74e [java-intentions] Don't suggest explicit type for uninitialized 'var' based on the first assignment for some cases
IDEA-287483

GitOrigin-RevId: dacfe4fa838c30e651f0244801b381b5fdb0df7f
2022-02-16 06:11:35 +00:00
Andrey.Cherkasov 22e275ba54 [java-highlighting] Provide quick-fix to replace 'var' with explicit type in language level smaller than Java 11
IDEA-256074

GitOrigin-RevId: 478ca1de890ec7c4346e4b2436c2b500c1489602
2022-02-16 06:11:34 +00:00
Andrey.Cherkasov 5adf08dab5 [java-intentions] SetVariableTypeFix: fix for C-style array declaration
IDEA-288831

GitOrigin-RevId: ba7ff0c8c823bf5e24da5b74a8c45315cc242cdb
2022-02-16 02:32:47 +00:00
Artemiy Sartakov 6633bef908 BulkFileAttributesReadInspection: clustering attribute calls by loops before reporting (IJ-CR-20279)
GitOrigin-RevId: 70cebc3298eea9feb57f7b4f1f4ca7b8b0535c66
2022-02-14 10:31:26 +00:00
Anna Kozlova 0a3d001b76 [java] avoid reformat inside psi operation (IDEA-287332)
GitOrigin-RevId: 387a7fe6e41da1f967b05dfa7da246e70e02b30f
2022-02-11 09:33:24 +00:00
Nikolay Chashnikov 9c66641799 [java] remove redundant import when "Remove annotation" quick fix is applied (IDEA-288488)
GitOrigin-RevId: 562cf18eafa636a761c75ae3e9630bdab3eff760
2022-02-11 09:25:51 +00:00
Artemiy Sartakov 9dcbd71cc6 MultiplePathConstructionsInspection: added inspection (IDEA-288529)
Reports multiple Path.of() or Paths.get() calls in a row with same expression

GitOrigin-RevId: 654825f7946243d0fd58ed2d2d4d577305ad0da5
2022-02-11 09:14:01 +00:00
Tagir Valeev 32442ebe48 [java-inspections] IDEA-288528 Add a quick-fix to correct typeuse nullability annotation
GitOrigin-RevId: ac4d271bc6e43306532d201e74fcf6e9f7b2e6ae
2022-02-11 08:30:20 +00:00
Artemiy Sartakov bcca6ef32f BulkFileAttributesReadInspection: cr fixes (IJ-CR-20279):
1. analyze all calls in method in one go
2. use UncheckedIOException instead of RuntimeException when wrapping into try catch
3. info level when try catch needed + no report in batch mode
4. updated description

GitOrigin-RevId: 0a2542b851fa32c5fde98725985f55079447b02b
2022-02-09 12:12:31 +00:00
Andrey.Cherkasov 7ce1003bd9 [java-highlighting] Provide fix for "The receiver name does not match the enclosing class type"
IDEA-273225

GitOrigin-RevId: aac09cbfcb60a1757c7b142ac888979148d4e7cc
2022-02-08 04:33:49 +00:00
Andrey.Cherkasov 475eaf4754 [java-highlighting] Use 'SetVariableTypeFix' for the "The receiver type does not match the enclosing class type" error
GitOrigin-RevId: f60f37d148c81dfe0fb86d56a385c2561ad9bb07
2022-02-08 01:01:43 +00:00
Alexandr Suhinin dee2a83524 [javadoc inspection] test: fix old quickfix tests
GitOrigin-RevId: 97acecc139826abd3750cbe9c08d5c42878abf70
2022-02-07 09:48:57 +00:00
Anna Kozlova 02c569b58d [java] keep existing type annotations when new param is added to the constructor (IDEA-287983)
GitOrigin-RevId: 9a22583cf9333be8855545c87443484bce62a19c
2022-02-04 10:41:45 +00:00
Artemiy Sartakov dd2943e081 SourceToSinkFlowInspection: tests for adding checker-qual dependency (IJ-CR-17164)
GitOrigin-RevId: 64c606a55f93cfe5a1f780508fcc71db1552d045
2022-02-04 09:41:14 +00:00
Artemiy Sartakov c699fe0e24 IOStreamConstructorInspection: cr fixes (IJ-CR-20017):
1. report for arbitrary expressions that expect OutputStream / InputStream
2. report for arbitrary file creation arguments
3. check recursively if file creation argument is effectively final
4. reuse effectively final path variables if possible
5. use Paths.get() instead of Path.of() since 'of' method appeared only in java 11
6. info level for java 10 and higher

GitOrigin-RevId: 0a778328fe938faa0fe7eb2f199064f90b7a6d1b
2022-02-02 08:24:36 +00:00
Bas Leijdekkers d73341c619 show method calls with () in "Inline stream mapping method" intention messages
GitOrigin-RevId: 2602d4e06902450e197232450c86d79ebc5203f7
2022-01-31 10:13:18 +00:00
Bas Leijdekkers ea834397dc show method calls with () in "Replace with bulk method call" inspection messages
GitOrigin-RevId: cc40c33ea4729b0faaecefe3e67287ece06090bd
2022-01-31 10:13:13 +00:00
Artemiy Sartakov 51b6c30a78 BulkFileAttributesReadInspection: added inspection
Inspection reports multiple java.io.File attribute calls in a row. Attribute calls:
- lastModified
- isFile
- isDirectory
- length
It suggests replacing them with a single attributes extraction using java.nio.file.Files.readAttributes method

GitOrigin-RevId: cd2f93645aab9a4cba2e1f87e05b431f0d21ee50
2022-01-31 06:31:09 +00:00
Tagir Valeev 453a00c310 [java-inspections] IDEA-287483 Suggest explicit type for uninitialized 'var', based on the first assignment
GitOrigin-RevId: 80fa9ecf09130d04c41d27ad40897ef24183e4e1
2022-01-28 10:05:00 +00:00
Tagir Valeev c7ed6477fb [java-inspections] IDEA-287311 Bug: Inspection 'bring variable into scope' introduces Compilation error when used with 'var'
GitOrigin-RevId: 85f7f526ec1cee6533f441bf42bc43b1b0bb8be1
2022-01-28 10:04:59 +00:00
Artemiy Sartakov 67e36d74a5 IOStreamConstructorInspection: added inspection (IDEA-171230)
Inspection suggests conversions:
1. FileInputStream -> Files.newInputStream
2. FileOutputStream -> Files.newOutputStream
in cases when FileInputStream can be replaced with InputStream.
Also, it reuses path variable after conversion when possible (path variable should be effectively final).

GitOrigin-RevId: 474dcaeeb5336fcc8330b4b3ed65d443042ecf2f
2022-01-25 07:01:39 +00:00