2533 Commits

Author SHA1 Message Date
Tagir Valeev
ae7957d3c7 [java-refactoring] ChangeMethodSignatureFromUsageFix: remove external type annotations
Fixes IDEA-366962 Quick-fix for adding method parameter generates long jetbrains UnknownNullability annotation

GitOrigin-RevId: 03d9b8be45670e6a72696d740d7ca71d746c7267
2025-02-19 14:57:00 +00:00
Tagir Valeev
b58f63db9e [java-intentions] Test for IDEA-367517
GitOrigin-RevId: 629874907d950626a912c2fbd6c8bb9b50b93902
2025-02-17 12:04:21 +00:00
SirYwell
21a3a5d9eb Fix wrong intention when referencing parameters in static fields
#IDEA-366531 Fixed

GitOrigin-RevId: 1338ab4efdb16eeb9991a060653fa46ff169db3e
2025-02-04 15:18:14 +00:00
Bas Leijdekkers
b4544c7a42 Java: clearer name for inspection and quick-fix
GitOrigin-RevId: 0ee29991b00d4ac8341c031a4a111b23bb44b800
2025-02-04 14:01:33 +00:00
Bas Leijdekkers
9e54c0017f Java: create final local variable when configured (IDEA-366908)
for the "Convert to local" quick-fix of the "Field can be local" inspection

GitOrigin-RevId: f82f38ca4c6eda299519eef80e6a90aa8d4b2f68
2025-02-03 20:43:02 +00:00
Tagir Valeev
00ce24a9b2 [java-inspections] Avoid non-counter limits with joining terminal
Fixes IDEA-362807 Incorrect result from "Collapse loop with stream 'collect()'" action

GitOrigin-RevId: 61c75668bb85f662222f97026511c4f6f10176c1
2025-01-31 19:13:18 +00:00
Anna Kozlova
51efb04317 [java] don't suggest create enum from usage when types can't agree
^IDEA-366733 fixed

GitOrigin-RevId: 64f861eeff4c2e9f1439e5837c5f0477a4944bc6
2025-01-31 15:01:06 +00:00
Tagir Valeev
c449c341b7 [java-highlighting] test-data adjusted (mostly anchors) after recent updates
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 1e1b77009dc78de49c7cc5c44d4704937397bb23
2025-01-29 11:35:30 +00:00
Tagir Valeev
be747e6461 [java-highlighting] variable errors migrated; some improvements in incompatible type fixes
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: b8531f50c89b009e852e1fdcc9efce1c29dcf4e1
2025-01-29 11:35:29 +00:00
Tagir Valeev
79c582597a [java-highlighting] return statement errors migrated
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 4449ffc2458eeb73fa296453f6963a6eeed28a76
2025-01-27 18:52:56 +00:00
Bart van Helvert
341758ee1c [java] Don't set protected visibility for final classes in CreateConstructorMatchingSuperFix
#IDEA-365573 Fixed

GitOrigin-RevId: a64e01c13e919b9992aecd556bf0a2963c848114
2025-01-24 16:01:58 +00:00
Bas Leijdekkers
7cd75fdbe4 Java: fix false positive "Redundant suppression" on "CloneDoesntCallSuperClone" (IDEA-355945)
GitOrigin-RevId: a6a8dc2ace656f221b3de93ac17e522836baca51
2025-01-23 14:10:52 +00:00
Tagir Valeev
059a080ab3 [java-highlighting] Fix testdata, tooltips
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: ed0cf0daf5dbfb034882d49ad5e9c03f264b451e
2025-01-22 10:33:39 +00:00
Tagir Valeev
e4d0585b15 [java-intentions] Test for intention on guard type mismatch
GitOrigin-RevId: b34a0cd0671483151e4db2e0c14df115d471e108
2025-01-17 19:30:16 +00:00
Bas Leijdekkers
d85933d67d Java: don't warn about replacing type with diamond on nested annotation (IDEA-288000)
GitOrigin-RevId: 16c913b812b81538d5587432e9bed3af5b586545
2025-01-17 18:10:29 +00:00
Tagir Valeev
07960b2159 [java-intentions] AddTypeArgumentsConditionalFix: report the branch
After changes in highlighting, it's not possible anymore to attach a fix to the range. In general, it's good, because the user may have no idea that the fix is available at a specific offset. So instead, we allow invoking the fix at the whole error range but indicate which branch will be updated.
Also: parentheses supported; fix all option added, minor touch-ups

GitOrigin-RevId: d756252cd1d3c061f52bdb70d62bed3bedcb69e3
2025-01-15 19:19:41 +00:00
Tagir Valeev
41b2c21759 [java-highlighting] Implicit constructor call problems migrated
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: eb4befa6b9d6d9b5b8c968fed54abb11c419f578
2025-01-15 19:19:41 +00:00
Bas Leijdekkers
3c99de56be Java: create correct field from parameter with unbounded type parameter (IDEA-365468)
GitOrigin-RevId: 218b864c95d25b6ff47e9360e0eeef47308f0ae8
2025-01-08 13:55:47 +00:00
Tagir Valeev
8a84b67cb8 [java-inspections] AnonymousCanBeLambdaInspection: suggest conversion if annotation on sub-method duplicates the super-method
In this case, we can assume that annotation-processing code is smart enough to use super-annotation.
Fixes IDEA-158731 "Anonymous Foo can be replaced with lambda" is not suggested when method is annotated

GitOrigin-RevId: de8c6f15e742b4ee4df02ecef5b230752d292114
2025-01-03 11:21:18 +00:00
Mikhail Pyltsin
9f03565ed9 [java-intentions] IDEA-365192 Use Object type for lambda type during creation field form usages
GitOrigin-RevId: f7532789d8aa7f3dcf17e1de3238a4a3847e5f42
2024-12-26 15:47:15 +00:00
Mikhail Pyltsin
5c02553dad IJ-CR-152155 [java-intentions] IDEA-365126 'BindFieldsFromParameters' shouldn't be offered when method has generic parameters
- more tests

GitOrigin-RevId: 8f580e7e8a32f51b1a8320fc82cdcec11dc4975f
2024-12-26 10:30:16 +00:00
Mikhail Pyltsin
0107304a90 [java-intentions] IDEA-365126 'BindFieldsFromParameters' shouldn't be offered when method has generic parameters
GitOrigin-RevId: 92052cdd9f27b6a43fc949badc88d4e8d1695c65
2024-12-23 18:12:33 +00:00
Mikhail Pyltsin
0a7c7800b7 [java-intention] IDEA-365124 don't propose BindFieldsFromParameters when there is chain constructors
GitOrigin-RevId: 495ed3f77ff6bdd2f57deac303359cef25aa2d8e
2024-12-23 18:12:33 +00:00
Tagir Valeev
0025dd535a [java-intentions] IDEA-363624 Create Class generates invalid and redundant annotation @NotNull @NotNull for constructor parameter
GitOrigin-RevId: 9c3c9c55517369e6715c65a9696c287514261a10
2024-12-06 14:57:38 +00:00
Bartek Pacia
5569a2965d [java-inspections] IDEA-14669 fixed: suggest adding specific non-null assertions from test frameworks
(cherry picked from commit 0d22d640ea4ee77a6bdfb5b4af504332e7456b68)

IJ-MR-150371

GitOrigin-RevId: 04a5fe47cf874ae78c5ad73282b55123f55e84cb
2024-12-05 12:35:38 +00:00
Tagir Valeev
37c03b015c [java-intentions] IDEA-363734 "Make Xxx impelent Yyy" quick fix inserts @NotNull
GitOrigin-RevId: 4e9a3f94cf1aedadd0b2c4699e168ccb3be0e405
2024-12-03 14:25:33 +00:00
Tagir Valeev
f19d9e91d8 [java-intentions] Reenable side-effect extraction for bare loop and if bodies (follow-up to IDEA-356722)
GitOrigin-RevId: 8fe8b5b70f19cf1cb3b268edbacc07abcb155f3d
2024-12-02 15:08:54 +00:00
Mikhail Pyltsin
d92d827067 [java-inspections] IDEA-364068 don't use PsiType as field in ChangeExtendsToImplementsFix
GitOrigin-RevId: 51cb044bc1a3bad93f2ea34504a3c8e3f5ee9916
2024-12-02 11:55:32 +00:00
Bartek Pacia
6682d9efc3 [java-inspections] Non functional style Optional.isPresent - missed opportunity
IDEA-360860 fixed

* split tests into individual methods, to make debugging easier
* add javadoc for VariableAccessUtils#isVariableTypeChangeSafeForReference


(cherry picked from commit f6b3468079959f7adec737e0b8ec3ad1d97e7ad2)

IJ-MR-150176

GitOrigin-RevId: 4b430e49819c7cba1e08ecee47b881f05be570d4
2024-11-28 23:23:40 +00:00
Tagir Valeev
734fecb1ac [java-intentions] IDEA-356722 "Extract side effects" action should not be offered in for loop increment
GitOrigin-RevId: 51d2d36362df6e5aa16c765cd7d089b8c5fc5c7e
2024-11-28 17:43:28 +00:00
Tagir Valeev
01dab26f64 [java-intentions] Remove external type annotations on ChangeMethodSignatureFromUsageFix
Follow-up for IDEA-363866 Remove redundant type annotations on 'Change variable type' fix

GitOrigin-RevId: fc52a66f6b7192ed6c111737619d9fd5dab6817d
2024-11-27 12:52:44 +00:00
Tagir Valeev
00af22705e [java-intentions] IDEA-363866 Remove redundant type annotations on 'Change variable type' fix
GitOrigin-RevId: 07cb03e013552ae9226b00072ca3f7218509d4ba
2024-11-26 14:32:10 +00:00
Tagir Valeev
6b829b44b5 [java-intentions] Create method from usage should skip external type annotation
Fixes (finally) IDEA-360115 Create method from List.of results in long jetbrains NotNull annotation

GitOrigin-RevId: 8e1657ad1d3af686e50c048eea1f7c439ec7365b
2024-11-14 18:47:30 +00:00
Georgii Ustinov
05dd389907 [Java. Intention Actions] Do braces error handling in create field action only when there is implicit class
IDEA-361230

GitOrigin-RevId: 7526d43c90f7d3ebc4edad95d8b31f2e6b42c1fc
2024-11-13 12:16:35 +00:00
Georgii Ustinov
7cce113eb2 [Java. Intention Actions] Disable extracting field when there are incomplete braces in the class
IDEA-361230

GitOrigin-RevId: 97fb3d5a71aa0f1d327f79fcf8789803ab5e5497
2024-11-07 16:48:55 +00:00
Georgii Ustinov
9efc9ad767 [Java. Intention Actions] Disable extract field for cases when there is a error element in parent
IDEA-361230

GitOrigin-RevId: bf7042ba4d3361a674dabc99352a53a3ee34b4af
2024-10-31 09:52:51 +00:00
Georgii Ustinov
f27f78a79c [Java. Intention Actions] Add tests for extracting field from incorrect code
IDEA-361230

GitOrigin-RevId: 40d3ad55dbdb3c26bfaac95d7b6842b2cba66af0
2024-10-23 14:59:56 +00:00
Georgii Ustinov
29caccb845 [Java. Intention Actions] Fix invalid handling of statements with missing semicolon in Collapse into loop action
IDEA-357036

GitOrigin-RevId: 12972fe04b845c930f7aed33cdcd324d64d6c0c4
2024-10-23 12:16:29 +00:00
Tagir Valeev
9e1742e86a [java-inspections] Do not suggest a fix which breaks the compilation (removing used pattern var)
Fixes IDEA-360403 Quick-fix for always-true pattern breaks the code

GitOrigin-RevId: eb71b14424e628c6b9ea9ca115bc904447e9e7f6
2024-10-17 14:08:04 +00:00
Bas Leijdekkers
dfae4a26c2 Java: "Generate overloaded constructor with default parameter values" for records (IDEA-360071)
GitOrigin-RevId: a20fd5478241de404df3243f1b8b9a7d1a73829e
2024-10-02 20:13:41 +00:00
Bas Leijdekkers
95ed423db6 Java: don't create final fields from parameters when this does not compile (IDEA-359981)
GitOrigin-RevId: 3a85c9310c8928cf65459ae1ff1825fabf31ec03
2024-10-02 20:13:41 +00:00
Bas Leijdekkers
14096f0f03 java: don't create final field from parameter when this does not compile (IDEA-359980)
GitOrigin-RevId: d7ce31fbb607a409afa0e2b988eed424440cc336
2024-10-02 20:13:41 +00:00
Tagir Valeev
5905b6f62a [java-inspections] TrivialFunctionalExpressionUsageInspection: more accurate side-effect handling
IDEA-355026 "Trivial usage of functional expression" breaks semantics if one argument updates the variable used in another

GitOrigin-RevId: e3d9374ecc427d62cee0d821473e9119ae240fc5
2024-10-01 14:50:18 +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
Bart van Helvert
690f1167ff [java] Don't suggest generating broken overload constructors
In implicit and anonymous classes, constructors can't be declared. #IDEA-359731 Fixed

GitOrigin-RevId: 76e978d04052dffd955bfac6c1016fa707201b29
2024-09-27 16:07:34 +00:00
Tagir Valeev
be4f6cd282 [java-inspections] Redundant keySet()/values(): support entrySet(); avoid warning inside Map implementations (IDEA-346005)
GitOrigin-RevId: ebf925ab3ff7c1357248a65201fe654aada0f4e8
2024-09-19 19:06:26 +00:00
Tagir Valeev
ac0c57748b [java-inspections] IDEA-346005 Add new inspection: Unnecessary keySet() call
GitOrigin-RevId: d1f1db0ae939017a8550b91cd8742dc222a8db99
2024-09-17 07:28:39 +00:00
Yuriy Artamonov
47f1c44a90 [java] IJPL-158521 Actions: fix ellipsis in messages for Java actions
GitOrigin-RevId: bfce0d6efa8747660c4b9af3d8defbfa47e4509a
2024-09-15 14:50:09 +00:00
Tagir Valeev
9092a09789 [java-intentions] BindFieldsFromParameters: disable for existing field if static or type doesn't match
GitOrigin-RevId: ad1d93533626f5e76a3f53c5ab25b06a5aa07f1e
2024-09-10 23:44:56 +00:00
Tagir Valeev
0f2865b919 [java-intentions] DefineParamsDefaultValueAction: better check of possible signature conflicts
GitOrigin-RevId: 5eb26ee62852e2e5e6188e740b807c775ded0277
2024-09-10 23:44:55 +00:00