Commit Graph

143 Commits

Author SHA1 Message Date
Mikhail Pyltsin
105b965377 [java-inspections] IDEA-365059 Support JEP 494: Fix expand module imports
- modules shouldn't add implicitly imported classes

(cherry picked from commit d18b9bc7783a478cec3e75f95542c410ae78acd8)

GitOrigin-RevId: 4929fcc6fa1bf67fa799e6feef175593f246d614
2025-02-13 14:23:52 +00:00
Mikhail Pyltsin
3348e7291f [java-inspection] IDEA-363979 Conflicts with on-demand and module imports
(cherry picked from commit 0857df90e3f9cc450b48b56186573a9a89b5b041)

GitOrigin-RevId: 8e1474a59c687561ba5f00a13fecd4d2a9057b7a
2025-02-13 14:23:52 +00:00
Tagir Valeev
d08daf82f5 [java-inspections] IDEA-364908 WhileLoopSpinsOnField doesn't recognize lock
(cherry picked from commit 7a9fb186e4c23bf81a57cf1766a22cd6f85b5097)

IJ-CR-152528

GitOrigin-RevId: 0c49f423e2043958a2b11a95244f58b8e7323085
2025-01-09 19:00:03 +00:00
Mikhail Pyltsin
52fe84a033 [java-inspections] IDEA-360291 'Make method constructor' fix shouldn't be shown for implicit classes
GitOrigin-RevId: ba571565430db01d06d37f2da5ab49a97b466db4
2024-10-08 14:02:23 +00:00
Mikhail Pyltsin
81fe531f88 [java-inspections] IDEA-360134 Support %n in format string
GitOrigin-RevId: c7d3b60eec4a72ded2132a3ab24e035baf2c1241
2024-10-07 13:08:21 +00:00
Mikhail Pyltsin
77ec6df673 [java-inspections] IDEA-360135 Non-constant string concatenation in logging call could be triggered with exception argument
GitOrigin-RevId: b9a08671660f1a3cb27e566e1a9ed6a05cd211d4
2024-10-07 13:08:20 +00:00
Mikhail Pyltsin
3288586fdf [java-inspections] IDEA-359749 StringConcatenationArgumentToLogCallInspection could also be triggered by concatenation
GitOrigin-RevId: bb5024a6be79582644fff96b72a8ceeff0fbf15e
2024-10-01 13:32:46 +00:00
Mikhail Pyltsin
f474d8047b IJ-CR-145218 [java-inspections] IDEA-201932 Provide inspection to highlight redundant creation operations in java date time api
- combine into one inspection
- fix messages

GitOrigin-RevId: d4e064948f8c730c4d68c58e6c9b1277c6b66b4d
2024-09-27 17:12:29 +00:00
Mikhail Pyltsin
9eb0e15e2c IJ-CR-145121 [java-inspections] IDEA-357009 new option to configure custom classes for IncorrectMessageFormatInspection
- fix table for `IncorrectMessageFormatInspection`

GitOrigin-RevId: 272d89fafaac63517e990b1d2808ec54d4c58e69
2024-09-27 09:33:50 +00:00
Daniil Ovchinnikov
f35d2c1c62 IJPL-453 add and use the ability to re-throw logged errors in particular tests
GitOrigin-RevId: 9707406b5a2290b81e28cb1f64bf4d3891f757ef
2024-09-25 19:42:36 +00:00
Mikhail Pyltsin
f73a4d96be [java-inspections] IDEA-201932 Provide inspection to highlight redundant creation operations in java date time api
GitOrigin-RevId: 6b246167dda52272122d356c3f6a787eab5a2542
2024-09-20 14:10:17 +00:00
Mikhail Pyltsin
abb1899900 [java-inspections] IDEA-357009 new option to configure custom classes for IncorrectMessageFormatInspection
GitOrigin-RevId: ab026ee405f78ff29519afb0db62449a682b5bd3
2024-09-19 12:20:53 +00:00
Mikhail Pyltsin
3001c41aed [java-inspections] IDEA-357938 try to infer logging type inside methods for StringConcatenationArgumentToLogCallInspection
GitOrigin-RevId: a09f433bdc1cbed3c81ee4fab6f4986b5ada4271
2024-09-18 14:42:24 +00:00
Mikhail Pyltsin
ae365f891c [java-inspection] IDEA-358668 Red code after "Replace 'if' with 'switch' statement" with Enum's
- support enums in patterns

GitOrigin-RevId: b00182c5f77bda03552fb9750e960f74c75582a5
2024-09-05 16:13:13 +00:00
Bas Leijdekkers
028d526405 Java: fix false positive when using java 21 pattern matching (IDEA-357175)
in "'equals()' should check the class of its parameter" inspection

GitOrigin-RevId: f84071ea339bf690eadcba60d491eebe4cb21a7e
2024-09-05 15:02:58 +00:00
Mikhail Pyltsin
7a9b0a636a [java] IDEA-358431 Support MessageFormat specifier-to-argument navigation, similar to String.format
- fix place for formatted index (without style)

GitOrigin-RevId: aa82d7312bab57ce7b2dc736456574746da5fd9d
2024-09-05 12:57:16 +00:00
Tagir Valeev
49f0880f57 [java] IDEA-358431 Support MessageFormat specifier-to-argument navigation, similar to String.format
GitOrigin-RevId: 5bfb87b48e714f92f5c469d4110426ff76f8c14b
2024-09-02 21:01:25 +00:00
Mikhail Pyltsin
dd822c1bc7 IJ-CR-142710 [java-inspections] IDEA-357725 LoggerInitializedWithForeignClassInspection should skip when the logger is not the final field
- fix texts

GitOrigin-RevId: 85d86f362ce860118d2a047321bf4916e01757da
2024-09-02 18:36:41 +00:00
Mathias Boulay
d4e45d6061 tweak(JavaDoc): Disable some inspections on older javadoc
Some inspections are pointless to check, related to javadoc tags.

GitOrigin-RevId: b7bb8bba4b51f1d90678705af3da8e5e5c4a4907
2024-09-02 16:39:21 +00:00
Mikhail Pyltsin
4aa99fd33a IJ-CR-143396 [java-inspection] IDEA-356207 incorrect work with typeUseWithType option
- more tests

GitOrigin-RevId: 14fc2ab77a0659541423741c704437c7fba446b6
2024-08-27 14:43:05 +00:00
Georgii Ustinov
c15dd29151 [Java. Inspections] Add test to ForwardCompatibilityInspection to check qualified yield call
IDEA-358316

GitOrigin-RevId: 9b1633787a92b719606c31f09499cad9bde8dcfb
2024-08-27 10:05:40 +00:00
Mikhail Pyltsin
76e51824bf [java-inspection] IDEA-356207 incorrect work with typeUseWithType option
GitOrigin-RevId: b4affe09ebbf3269881bf00d48f75cca3fd27a59
2024-08-27 09:13:47 +00:00
Bas Leijdekkers
7db980cfcf Java: remove unneeded ':' from inspection problem report
GitOrigin-RevId: 9b0c070c8ca2a883d0d07f0064b67f22594cbced
2024-08-21 09:12:08 +00:00
Mikhail Pyltsin
46c33c46e3 [java-intention] IDEA-357879 "Replace catch sections with throw" intention doesn't check ancestors
- fix test's flakiness

GitOrigin-RevId: ce2d52a107441215c5c8f953916e2203196fbc25
2024-08-19 23:46:04 +00:00
Mikhail Pyltsin
6d84f1e4df [java-intention] IDEA-357879 "Replace catch sections with throw" intention doesn't check ancestors
GitOrigin-RevId: ab1f6d8c13b76850481b38c3fe0137f22fc11071
2024-08-19 20:00:05 +00:00
Mikhail Pyltsin
c56e5e7313 [java-inspections] IDEA-357725 LoggerInitializedWithForeignClassInspection should skip when the logger is the final field
GitOrigin-RevId: e910d9bb094f058c363148a3d08b695276bcc2c6
2024-08-15 18:02:00 +00:00
Mikhail Pyltsin
0f5aa949cb [java-inspections] IDEA-357190 Support JEP477 - Remove unnecessary qualification is not suggested when it can be
- check if class is already imported

GitOrigin-RevId: 11a43bf80302194a4f8b34125de2bb741f1f3bac
2024-08-09 11:00:42 +00:00
Bas Leijdekkers
91cff4a4f1 Java: inspection for migration to Markdown documentation comments (IDEA-357191)
GitOrigin-RevId: 94d6c21d713073df58e2f6fb2bbd348a7039b9ce
2024-08-08 20:19:46 +00:00
Mikhail Pyltsin
6b7ef5d3e1 [java-intentions] IDEA-357080 Convert switch to if with boolean selector: omit second condition
GitOrigin-RevId: 77851a64e022155488fcc45b2fc15791c61fedce
2024-08-02 22:53:47 +00:00
Mikhail Pyltsin
4a9f1b4fee [java-inspections] IDEA-356945 'insert default branch' suggests uncompilable code
GitOrigin-RevId: 44f277da31601775e3ce75021155bf7c37a6311c
2024-08-01 12:29:33 +00:00
Tagir Valeev
90543d0e24 [java-inspections] InlineVariableFix: avoid PSI writes after highlighting
Highlighting causes PSI commit and reformatting. It looks like modifying PSI after that may cause problems. Probably we can fix it later in ModCommand API, but for now we can just reorder things.
Fixes IDEA-355992 "Inline variable" quick-fix doesn't work if the variable initializer is on the next line

GitOrigin-RevId: f0a2418ac5618f91291b1f74ad2168d26c612447
2024-07-31 11:41:55 +00:00
jocelynluizzi13
0e11a2c3d7 [java-inspections] Extract some methods to reuse from j2k
PR#2795
Reviewed-by: Tagir Valeev <tagir.valeev@jetbrains.com>

GitOrigin-RevId: 46a62d8839160286ad8fe15c41dee30a923b545c
2024-07-30 16:34:11 +00:00
Mikhail Pyltsin
d186699847 [java-inspection] IDEA-355916 update implicit<->explicit classes inspections
- tests
- optimize imports
- ReplaceOnDemandImportIntention supports module imports

GitOrigin-RevId: 228135179fc26f44064dd196ae70326fd91fb3ee
2024-07-26 12:44:48 +00:00
Mikhail Pyltsin
6d101f8467 [java-inspection] IDEA-356699 Support JEP 477. UnusedImportInspection doesn't support implicit imports and modules
GitOrigin-RevId: b3fbb9aea04067e704e3ef3dba9e16262e33b0c6
2024-07-25 09:33:08 +00:00
Mikhail Pyltsin
ee4964a9a9 [java] UnusedImportGlobalInspectionTest convert to string block
GitOrigin-RevId: cfa22e2d932d1dad579e907d2a7e018a8e277587
2024-07-25 09:33:08 +00:00
Mikhail Pyltsin
8f3e75e7db [java-inspections] IDEA-356672 Support JEP 477. Incorrect intentions and actions with implicit imports
- improve ImplicitImportChecker to support modules
- check conflict for modules
- new method `PsiImportModuleStatement.findImportedPackage` is added

GitOrigin-RevId: 0d0f61916bdda17b8c9d9146a13aa8d6d0876bb1
2024-07-25 09:33:07 +00:00
Mikhail Pyltsin
8ce06c83bb [java-inspection] IJ-CR-135317 IDEA-352587 Support JEP 455: Improve conversion from if to switch
- fix naming
- add more tests
- check cases when variables can be assigned
- track primitive variables when new cases are created

GitOrigin-RevId: 84a77676a627cc0fffce8e7219daa2b1fd13949d
2024-07-17 18:18:57 +00:00
Mikhail Pyltsin
6a7daf2867 [java-inspection] additional wait until indexes are ready
- should fix flakiness of StaticCallOnSubclassTest.testMethodReference

GitOrigin-RevId: 4caa0715de7425a781ed1337e8462618a643848e
2024-07-15 17:47:50 +00:00
Mikhail Pyltsin
61eda5ef9f [java-inspections] IDEA-356142 Support several unconditional cases in "Replace if with switch"
GitOrigin-RevId: 55d493b34da246aa205be0fab09bf538d25b49fa
2024-07-10 18:15:49 +00:00
Mikhail Pyltsin
092062f856 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- extract tests, which require old annotations
- return old name to method to add annotations

GitOrigin-RevId: c559cea10f942f72d5a19176d3ee808d46ad5dd2
2024-06-27 13:29:33 +00:00
Tagir Valeev
e9c60004b1 [java-inspections] Result of call ignored: Avoid false-positives in fragments (like debugger evaluation)
Fixes IDEA-355461 "Result is ignored" inspection triggered in evaluate and log

GitOrigin-RevId: e3870ff2b90d9297896caceb3b566098ee324c6d
2024-06-27 11:21:13 +00:00
Mikhail Pyltsin
638393e895 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
GitOrigin-RevId: d13187d41d214bd2ccadecb4cadc925f7d787d60
2024-06-26 20:34:48 +00:00
Tagir Valeev
2c31e99a77 [java-inspections] Use latest mockJDK instead of mocking individual classes
GitOrigin-RevId: 5bdde04b83f4a66e373724bc40ea5d129467bf25
2024-06-25 16:42:40 +00:00
Mikhail Pyltsin
fc86f137ca [java-inspections] EA-1288620 record deconstruction can be broken in inspections
- check that record deconstructions have correct numbers of components
- optimize `unwrapSealedTypes` a bit

GitOrigin-RevId: 167dabb1a5e6dd156e8d5772373c6f059e209257
2024-06-20 17:53:33 +00:00
Mikhail Pyltsin
2023228d8c [java-generation] IDEA-344399 generate annotation based on type_use option
- extracted new option
- reuse this option in MissortedModifiersInspection
- override uses this option too

GitOrigin-RevId: 39f3f72991240753c86c7f80df865728aa9743ad
2024-06-17 21:14:57 +00:00
Tagir Valeev
8b5e8b8f6d [java-intentions] Deep check for error elements
Fixes EA-1247288 - IOE: BasicJavaParserUtil.parseFragment

GitOrigin-RevId: a3c8d95bee1f4dbe724511e1eb1c6ef7e0cc7493
2024-06-11 18:03:38 +00:00
Mikhail Pyltsin
0dad9dd658 [java-inspection] IDEA-352587 Support JEP 455: Improve conversion from if to switch
- add more tests
- fix corner cases with doubled values

GitOrigin-RevId: 205a03a05a25282f41dad199a31fcba9c8141433
2024-05-27 11:27:15 +00:00
Mikhail Pyltsin
5cdb566ad8 [java-inspection] IDEA-352587 Support JEP 455: Improve conversion from if to switch
GitOrigin-RevId: 30a1ee985af322459781882e4e792ecb6478ea67
2024-05-24 21:18:43 +00:00
Mikhail Pyltsin
7e047434f3 IJ-CR-130369 [java-inspections] IDEA-197280 Non-constant string concatenation as argument" could also be triggered for String.format
- change description

GitOrigin-RevId: 0924d1165a47e2d40f3b245adfdc8252f2768f25
2024-05-24 21:18:23 +00:00
Tagir Valeev
3b688121d2 [java] IDEA-353981 'Rename to ignored' fix: ModCommand, allow 'fix all' action
GitOrigin-RevId: 83676caca1d4a0f6308d649efd92d6f58845b57e
2024-05-23 19:00:36 +00:00