Commit Graph

2546 Commits

Author SHA1 Message Date
Tagir Valeev
6cb3ca0045 [java-inspections] CreateLocalFromUsageFix: remove external annotations
Fixes IDEA-367190 NotNull annotation when creating local variable references library which is not in the project
Also: do not resolve reference for writing to a package

GitOrigin-RevId: 31f996515323e250d487bf9b7d343f101d788907
2025-06-12 16:51:42 +00:00
Bas Leijdekkers
0a60753921 Java: don't report casts of constants (IDEA-373869)
in "Constant expression can be evaluated" inspection

GitOrigin-RevId: aa1bac4aef1e306c5c9671b9cdf3aca638feb95b
2025-06-05 20:37:31 +00:00
Bas Leijdekkers
7a0ce59678 Java: generate correct code for native methods (IDEA-373315)
for the "Generate overloaded method with default parameter values" intention

GitOrigin-RevId: d595a7b1f736cdb60549c0a872da367a1ffe1a92
2025-05-26 13:23:28 +00:00
Mikhail Pyltsin
bb218c792d [java-inspections] IDEA-371955 delete covered cases after deleting guards
GitOrigin-RevId: 712396793650bb88555cb67e116db96ad72fc148
2025-05-15 16:07:01 +00:00
Bas Leijdekkers
f93991ab92 Java: fix implicit class' use scope (IDEA-371297)
GitOrigin-RevId: 1165c265bbb527d6474b5c10888ad8c7a683706f
2025-04-28 11:12:48 +00:00
Mikhail Pyltsin
ef8332f0fb [java-inspections] IDEA-370073 incorrect field type
GitOrigin-RevId: 0c256aef706e7674d123ee2fd00278a7e17a2ccb
2025-04-03 10:17:49 +00:00
Louis Vignier
d82a6a1d1a [java] Preserve comments in ReturnReplacementContext#stripUnnecessaryBlocks
#IDEA-369976 Fixed

GitOrigin-RevId: d20a4a7d92ffb5fc7bda36c879868a2d3e2e8413
2025-04-02 22:05:33 +00:00
Tagir Valeev
cb2bafc26f [java-intentions] IDEA-365579 Extend class quick-fix shouldn't be shown, leads to a red code if executed
GitOrigin-RevId: 49fd47d8848d2241274262d926a967c14d900013
2025-04-02 17:24:07 +00:00
Mikhail Pyltsin
9cfd575fec [uast-inspections] IDEA-370038 incorrect field type
GitOrigin-RevId: 20f8c4000322b05d090b0009688068f31c4e4947
2025-04-01 16:21:48 +00:00
Tagir Valeev
1b0fcea7e2 [java-intentions] IDEA-368928 Unnecessary cast fix for lambdas
GitOrigin-RevId: dec2f6e7bedca3686532264db331371119146527
2025-03-20 11:41:31 +00:00
Bas Leijdekkers
c1cbbc96f1 Java: make suppress intention insert annotation in scratches and injections (IDEA-368668)
GitOrigin-RevId: 5a336e0ffaab8b530458dba3bba689e6eea70ace
2025-03-06 10:26:37 +00:00
Alexey Kudravtsev
be9dc3e624 remove syntax errors from test data to avoid highlighting the same range twice to get rid of duplicating errors
GitOrigin-RevId: 13db442a342a7ba8dec73715bde479f8a062dba3
2025-02-26 20:33:42 +00:00
Bas Leijdekkers
abf7dd20c2 Java: compute constant value shouldn't be available on parentheses (IDEA-367924)
GitOrigin-RevId: bc1540b49e395db9385ba3e87bb3930014907dd1
2025-02-20 18:48:19 +00:00
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