Commit Graph

715 Commits

Author SHA1 Message Date
Tagir Valeev
0a7dce9cba [java-refactoring] Avoid local ref cache during inline refactoring
Useless anyway, as the files are constantly updated; does many unrelated computations
IDEA-364541 Inline method spends a lot of time inside getVariableReferences


(cherry picked from commit 1814ada8815641cb9159bbe10bc28c719d2bbf44)

IJ-CR-151330

GitOrigin-RevId: 406d056a261e17cf8d34d5b4edfa4a7a9e592d1a
2024-12-11 18:52:24 +00:00
Tagir Valeev
d2b1f518c8 [java-refactoring] IDEA-360614 Replace with single implementation: no downcast when 'this' is used
(cherry picked from commit f2ea406a5cf229cf9e63b6c2b53b9d86f245a6d9)

IJ-CR-150207

GitOrigin-RevId: 0eec797e7e9d105bf594aabd85533bd5c5395dd1
2024-11-26 19:12:59 +00:00
Tagir Valeev
b0321520e6 [java-refactoring] Refactoring dialog: avoid updating var-type state on every updateControls()
It should be updated only on type change (which happens rarely, especially because in many cases, we do not allow to change the type at all)
Fixes IDEA-360822 Introduce Variable: "Replace all occurrences" (Alt+A) triggers flood of exceptions
Slow operations are still possible but should not cause 'flood'. Given that dialog mode in refactorings is rarely used (it's non-default), current fix looks good enough


(cherry picked from commit 6ad7e2826b11e1f39598e991201ba05620acae84)

IJ-CR-149663

GitOrigin-RevId: 39bd201313a72d262d03283fd93ae5a6a64cecd0
2024-11-19 17:39:30 +00:00
Bas Leijdekkers
fbdc27f1eb Java: keep "Inline this usage, keep the method" option enabled when inline is invoked on the only usage (IDEA-362625)
(cherry picked from commit df1e13ff01ce46b415e9466667bfe19ee67145f9)

IJ-CR-149100

GitOrigin-RevId: 04cc035315593d4a8b1950d7d961c41cd838f118
2024-11-13 15:13:23 +00:00
Tagir Valeev
5e26c44314 [java-refactoring] isFirstUse: handle static method qualifier
Fixes IDEA-356148 Inlining method creates undesirable temporary variable


(cherry picked from commit 34091cb3a6c6388b2086d92e8cd4b206b9250202)

IJ-CR-149087

GitOrigin-RevId: 5d38476c8ff706eb180c628d7b481d0f7b00c7ff
2024-11-12 11:38:15 +00:00
Tagir Valeev
6fe3ec50ef [java-refactoring] isFirstUse: take PsiAssignmentExpression into account
Fixes IDEA-361852 Java Inline Method refactor introduces intermediate variables


(cherry picked from commit 680fbb62f3440b7ae29f4de1793260fe5be0ab36)

IJ-CR-149087

GitOrigin-RevId: c9ede4356696412b656b0295f21f534cce04bc30
2024-11-12 11:38:15 +00:00
Tagir Valeev
360772f05f [java-refactoring] InlineMethodHandler: clarifying comment added
GitOrigin-RevId: c5649ed1349897dd13c5ac726440f72b06ab4fd4
2024-10-14 15:13:57 +00:00
Bas Leijdekkers
d2f7d55a95 Java: update Inline dialog texts (IJPL-10853)
GitOrigin-RevId: bf16bed93bb6fa83ec6c9e626bc2d30b76e05e5b
2024-10-11 20:57:59 +00:00
Bas Leijdekkers
a247adfa8f Java: InlineConstantFieldProcessor pattern variables
GitOrigin-RevId: 51d9a524cf42f56b19729b411e46292c01028d56
2024-10-11 20:57:59 +00:00
Bas Leijdekkers
beb35f4a2c Java: allow inlining library field from the field (IDEA-360539)
GitOrigin-RevId: 968d07c992b673ffed1a67e7963de5d2ee36584c
2024-10-11 20:57:59 +00:00
Bas Leijdekkers
b8c89d8e2b Java: make sure to not try to modify library files when inlining method/field (IDEA-359779)
GitOrigin-RevId: 612d9eed89fe75da9ce5abab4fb0c05bc5145266
2024-10-11 20:57:58 +00:00
Anna Kozlova
81ffdbb0c0 [rename] don't search for test methods for classes with names which occur too often
not only the class with the function is checked, but also all overridings

^KTIJ-31589 fixed

GitOrigin-RevId: 3fb21fa787e80656abb706bdc964ea64e179bf89
2024-10-11 09:59:27 +00:00
Tagir Valeev
09bd11efd8 [java-refactoring] IDEA-71792 Support inlining of abstract methods having one implementation
GitOrigin-RevId: 00491acff53aff96705a866e0d799dfe22873d23
2024-10-11 08:10:27 +00:00
Tagir Valeev
f382d9421e [java-refactoring] Remove external type annotations on extracting
Fixes IDEA-360115 Create method from List.of results in long jetbrains NotNull annotation

GitOrigin-RevId: 8469180f82ac9c74edc7494778499daf409666f9
2024-10-11 08:10:27 +00:00
Nikolay Chashnikov
dbd47232c7 [java] API cleanup: mark deprecated unused API for removal (IJPL-156972)
GitOrigin-RevId: 5c2121d84e0d0517b6ef056bb0de6e78a468b760
2024-10-10 23:55:42 +00:00
Bas Leijdekkers
481fab7d13 Java: allow to "Inline to Anonymous Class" classes with static members (IDEA-360451)
GitOrigin-RevId: 835f91a1d35db9b78041da36c3bd147fa4e52ba3
2024-10-09 18:25:23 +00:00
Bas Leijdekkers
81a6c7d02c Java: support safe delete for record components (IDEA-245145)
GitOrigin-RevId: 5eccf46c5e0cce0d63c5ac480ad8d180b1ef0fed
2024-10-07 17:17:27 +00:00
Bas Leijdekkers
00eb168de9 Java: safe delete cleanup
GitOrigin-RevId: 6a92cc62db80835c7cad04dfcb6fde32d776dcb8
2024-10-07 17:17:27 +00:00
Anna Kozlova
ca10f3c066 [kotlin] disable inplace rename if name is invalid in the context language
^KTIJ-28346 fixed

GitOrigin-RevId: 8c12ad354c842b1cf9939614ebee4eac056b01fd
2024-10-03 09:50:20 +00:00
Bas Leijdekkers
7be0072137 Java: disallow inlining record to anonymous class (IDEA-359857)
GitOrigin-RevId: f477736ff39ea95cf9c9c5088c2dd0af9399f605
2024-10-01 09:31:57 +00:00
Bas Leijdekkers
1c4ecd3c3c Java: always shorten reference when inlining method (IDEA-167551)
GitOrigin-RevId: 6bb0e8765b796b9f9f99ad1f41ab08d9ae6de809
2024-10-01 09:31:57 +00:00
Bas Leijdekkers
7eab69be22 Java: clarify refactoring warning message (IDEA-359779)
GitOrigin-RevId: 8666270b887ebdce6c639a6deee40dd5273fff0d
2024-10-01 09:31:57 +00:00
Bas Leijdekkers
c0ca8d8600 Java: fix inlining of library methods (IDEA-359779)
- only check method body for inaccessible elements
- don't try to optimize imports in method file when method is not modified

GitOrigin-RevId: 27216e8db2306650f638387d6adac6d90099326b
2024-10-01 09:31:57 +00:00
Anna Kozlova
922ae1e042 [kotlin] don't search for companion name to rename tests inside
^KTIJ-31445 fixed

GitOrigin-RevId: e5803a68d77e119a8a51a4ea551c0866d21d90ef
2024-09-30 16:22:46 +00:00
Tagir Valeev
9d989b2b7f [java-refactoring] Inline Parameter: do not erroneously report top-level non-static class references
Fixes IDEA-356746 Confusing warning when I inline array method parameter

GitOrigin-RevId: 1964db1b4a09ec7eb1bcbbcd05fcb445862f06b4
2024-09-26 13:53:17 +00:00
Bas Leijdekkers
ba54dfd721 Java: care about generic class when replacing constructor with builder (IDEA-359490)
GitOrigin-RevId: 7aab29e572eb6da07d2fec202c886500fd944f6a
2024-09-24 10:04:30 +00:00
Bas Leijdekkers
84a8688289 Java: don't forget import when replacing constructor with builder (IDEA-359490)
GitOrigin-RevId: d013e469de340783918cbb4a3909a701594f683d
2024-09-24 10:04:30 +00:00
Egor Ushakov
574869f3ea IDEA-358233 Evaluate expression with Stream.map when using a protected field under a lambda expression throws $GeneratedEvaluationClass tried to access protected field, is in unnamed module of loader java.security.SecureClassLoader
GitOrigin-RevId: 6532c4a65dde0edf8a091b32b735f1724599fef7
2024-09-19 14:52:36 +00:00
Tagir Valeev
a1eecbd0ae [java] External type annotations (IDEA-231901): remove them on variable introduction
Also bumped test project descriptor

GitOrigin-RevId: fd519a34b01abbb9de135f1c39fc1cb02c8de891
2024-09-18 20:27:35 +00:00
Tagir Valeev
1d83886b74 [java] ExternalAnnotationsManager.findExternalAnnotations: NotNull
GitOrigin-RevId: cbd3821a7d6d43d7a0c77039312b612ee0137b73
2024-09-18 12:08:08 +00:00
Tagir Valeev
33a3a3d3d9 [java] Less raw types
GitOrigin-RevId: 0bb21ea1ab22c45d79e74e8c839c6b8495a9036a
2024-09-18 12:08:08 +00:00
Egor Ushakov
d4f875f8c3 IDEA-357785 Internal error when I use stream debugger
GitOrigin-RevId: 4e7c840c21ffe317b94f3e0dde49ec8fa66a3521
2024-09-16 18:27:12 +00:00
Tagir Valeev
037c7339b0 Make DocCommentPolicy non-generic; type parameter is not very useful here
GitOrigin-RevId: e5c1e431e67c1aeb24a237172aaee85b37433cd3
2024-09-16 11:23:15 +00:00
Tagir Valeev
05de6a6bdb Less raw types
GitOrigin-RevId: 2a6e712b4017cf1ead7870543e562acb654fbeaf
2024-09-16 11:23:15 +00:00
Tagir Valeev
3f3f8d8279 [lang-api] ClassMembersRefactoringSupport: eliminate raw types
GitOrigin-RevId: 7dc10df237e349cdb82d085ba67f66b780e9f595
2024-09-16 11:23:15 +00:00
Bas Leijdekkers
624ffd24a6 Java: cleanup in rename refactoring
GitOrigin-RevId: 0e3fda922844a73577d126a38f8d7f62a2ea7ffe
2024-09-13 16:40:26 +00:00
Bas Leijdekkers
c40e983f98 Java: rename method correctly if the name conflicts with javadoc reference (IDEA-355643)
GitOrigin-RevId: c1ae53780e8ec3a56834dd32ecd9bc19cfd222fb
2024-09-12 18:27:21 +00:00
Bas Leijdekkers
7e0038ce14 Java: "Open in editor" checkbox for Replace constructor with builder (IDEA-358746)
GitOrigin-RevId: 72f2bf32432a2b623ab562cefac5568904fb5cee
2024-09-06 13:43:06 +00:00
Bas Leijdekkers
4d537236e4 Java: cleanup ReplaceConstructorWithBuilderPanel.form (remove unused rows and colums)
GitOrigin-RevId: f030e72eb34f73c0dcaa4410aecb5b0bd75d3dc9
2024-09-06 13:43:06 +00:00
Bas Leijdekkers
2870f49e0a Java: disallow making builder class from the constructor class itself (IDEA-254858)
GitOrigin-RevId: 071a0fd3c45f2b28b73b811e0d844a0f1b911372
2024-09-05 15:02:58 +00:00
Egor Ushakov
adbf260361 EA-266837 - AIOOBE: PsiReflectionAccessUtil.nearestAccessibleType - more logging
GitOrigin-RevId: c9420cc9a66ec0d69a305aacc4af0fe58bacecf1
2024-09-05 12:28:02 +00:00
Max Medvedev
3f27a3edf1 cleanup: introduce LanguageRefactoringSupport#getInstance
GitOrigin-RevId: 832c2688ee1976e8e353291c645b676c77ecd2ce
2024-09-04 19:37:00 +00:00
Tagir Valeev
b01ac55564 [java-refactoring] Inline variable on non-initialized declaration
Could be available if there's only one write visible for all the reads
Fixes IDEA-354157 Inline variable not working when staying on uninitialized declaration

GitOrigin-RevId: e257b2b493a3902e901699efa4eac90f62e3108b
2024-09-02 21:01:25 +00:00
Tagir Valeev
f7976fa52c [java-refactoring] ReplaceConstructorWithBuilderProcessor: use anchor instead of null, as new conflict dialog requires it
Fixes IDEA-354549 Creating builder from constructor not working

GitOrigin-RevId: e793d9fff9af4125a5b442069e70e7bc314b6912
2024-08-29 14:08:22 +00:00
Gregory.Shrago
bc3b7f8235 drop allowSlowOperations usages
GitOrigin-RevId: b60b929f767c5fdac1e63ce8cfabb97c43c189c1
2024-08-20 16:56:17 +00:00
Alexandr Suhinin
6efb57a0f7 [extract method] setup settings change listener one time for all templates
GitOrigin-RevId: 545a61d305fae24e52a8d754f21ac2d162523688
2024-08-12 09:29:26 +00:00
Alexandr Suhinin
61a69b3efb [extract method] simplify InplaceMethodExtractor
GitOrigin-RevId: 39e2774c4d57327bb483faf87b1a75a39bd90e20
2024-08-12 09:29:26 +00:00
Alexandr Suhinin
13a49ea232 [extract method] decouple settings from the extract template
GitOrigin-RevId: a628ca0ecfa302e9920c315e7adacc14471b6053
2024-08-12 09:29:26 +00:00
Alexandr Suhinin
1c8daa89b7 [extract method] do not run analysis both on an original file and virtual copy
GitOrigin-RevId: fe0433dbc0673cac6554c3710b03e180046df1fc
2024-08-12 09:29:26 +00:00
Alexandr Suhinin
c89c0bb036 [extract method] cleanup: use range marker to track extracted range
GitOrigin-RevId: cf23863e723b305a0024015ab060bb70071f614b
2024-08-12 09:29:26 +00:00