Commit Graph

1668 Commits

Author SHA1 Message Date
Tagir Valeev
fcd92a7fcd [java-refactoring] IDEA-235656 Automatically expand composite assignment when inlining variable
GitOrigin-RevId: 797f4121214eadfe1df74aadae0c2299dc178a02
2023-11-03 20:18:24 +00:00
Georgii Ustinov
8e3d29b3f9 [java-refactorings] Move Static Members produces red code when static import is present bug fix
IDEA-321620

GitOrigin-RevId: 78687728404da5953fd09c99066b8262583b8746
2023-11-03 09:14:08 +00:00
Tagir Valeev
c6fbff80c0 [java-refactoring] Inline variable: improve behavior in the presence of compilation errors
1. Properly forward the AnalysisCancelledException
2. Allow inlining of never overwritten variable in the presence of syntax errors

Fixes IDEA-336815 "Inline variable" misleading error message when compile-errors are present

GitOrigin-RevId: 7510d497fce2dcd4bef38482cfadf162d47cc2c0
2023-11-02 20:34:04 +00:00
Tagir Valeev
3fb3c93d3d [java-refactoring] Test for EA-882906 fix
GitOrigin-RevId: 085064379eed4ac2c1c0022724ac1fb4f71b5d15
2023-10-12 18:24:24 +00:00
Tagir Valeev
77d1d0ab2e [java-tests] Mock JDK 21 (downloaded from the repository); remove in-place mocks where possible
Part of IDEA-334171 Store MockJDK in artifact repository, rather than in Git

GitOrigin-RevId: 9c6214e3ead47cc164d20813f5a2b37136607213
2023-10-06 10:48:24 +00:00
Mikhail Pyltsin
cb328b8e61 [java-refactoring] IDEA-333185 rename to _ with unnamed class in scope
GitOrigin-RevId: f3c04977dce339d4c740f86f442fa078c2121a1f
2023-09-25 17:46:36 +00:00
Bas Leijdekkers
a4cb2b8f6f Java: fix extract method missing throws clause on string template and add test (IJ-CR-115108)
GitOrigin-RevId: 5fcbd8eb55a8f03f1db1ce67daa850964dae63a4
2023-09-21 14:33:12 +00:00
Bas Leijdekkers
34afca4ec6 [extract method] control flow analysis for string templates (IDEA-331198)
to generate correct code when extracting string templates to a new method

GitOrigin-RevId: e32aa33df1b5edd98aab34d424db2ad3e613f617
2023-09-14 14:07:30 +00:00
Roman Ivanov
3669af59d1 [java] remove caret marker after changing PSI
GitOrigin-RevId: 2598f06c2cb6ecd5fa6b72a8eaca875e992c6f75
2023-08-27 21:24:38 +00:00
Roman Ivanov
71e10c185b [java] fix failing tests
GitOrigin-RevId: d69a9585d6e3bd93cdcb8f69e94d38c71b67e2f7
2023-08-27 21:24:18 +00:00
Mikhail Pyltsin
4fb2e28c3e [java-intentions] IDEA-314730 Not propose to convert to factory for records
- there is no point as its constructor is always public

GitOrigin-RevId: fc071e9902ec9aff12874eb99a7aa5ca53b1b1be
2023-08-11 21:40:36 +00:00
Tagir Valeev
013651b75d [java-refactoring] Minor fixes in AnonymousToInnerHandler
1. Adapt messages to speak about local class when applicable
2. Fix when name is not changed, but we have type parameters

GitOrigin-RevId: bd3dbda21922473c9c4e52bccf840a35c55c9d59
2023-07-26 12:45:58 +00:00
Tagir Valeev
fb1eeff810 [java-inspections] IDEA-326289 Raw type when converting generic constructor method ref to lambda
GitOrigin-RevId: cd8f8d36f5ded99b168e8db0a00a06a82df4044f
2023-07-26 11:38:28 +00:00
Tagir Valeev
c718b21cc1 [java-refactoring] Convert local classes to inner ones
Fixes IDEA-218207 Move refactoring doesn't work for local classes
Also: Convert anonymous to inner -> do not create fields used in other field initializers only
Also: Convert anonymous to inner -> capture implicitly referred type parameters (mentioned in types of captured variables)

GitOrigin-RevId: 5d326e0b6fdff4de850ce48582cc3ca0fe003b43
2023-07-24 19:35:31 +00:00
Tagir Valeev
e4ace19a73 [mod-command] Global rename support; rename in ReplaceConstructorWithFactoryAction
GitOrigin-RevId: bbedae34c33cef997b6a984078de79ec6121e51d
2023-07-17 19:20:26 +00:00
Tagir Valeev
95f104864a [java-intentions] ReplaceConstructorWithFactoryAction: minor improvements
Do not suggest on non-static classes; fix suggestName when targetClass differs from containingClass

GitOrigin-RevId: d09285149eb6c40f82651cfb17ef688d24ee56ee
2023-07-13 12:05:32 +00:00
Tagir Valeev
4e73b61fc5 [java-intentions] ReplaceConstructorWithFactoryAction: fix reference when outer class is selected (IDEA-324475)
GitOrigin-RevId: be488adf9bf28eccb3f8a91f9527c23c7c120578
2023-07-10 12:12:00 +00:00
Tagir Valeev
0465829135 [java-refactoring] IDEA-324661 Convert Inline variable to ModCommand; replace conflict & inline dialogs with choosers
GitOrigin-RevId: d02496feb2ad7913ec4973d1ea16cba17cdeed79
2023-07-07 21:03:38 +00:00
Tagir Valeev
2754cb6d75 [java-refactorings] IDEA-324475 ReplaceConstructorWithFactoryAction: convert refactoring to ModCommandAction
GitOrigin-RevId: dd45e061f60ce6e018c2afb9b96462a84a7553cf
2023-07-07 15:50:49 +00:00
Jonas Ladner
76b4fd5016 IDEA-175196: add regression test for safeDelete'ing a field, which is only used once as a parameter of a constructor
GitOrigin-RevId: 9d8f1ea9d431d1e39afc077dbff21bd19d178a8a
2023-06-19 09:20:34 +00:00
Helena Klause
de86eccf7b [refactoring] IDEA-322173: add redo to RefactoringEventListener
Add a function to RefactoringEventListener that is fired whenever
a refactoring is redone.

GitOrigin-RevId: 0a7913f745d869dbce108f67565ad03e333adb21
2023-06-15 10:24:46 +00:00
Tagir Valeev
be6a068d76 [java-refactoring] Better vararg handling in change signature
1. Properly handle non-vararg call sites
2. Update callsites when vararg type was changed to non-vararg or vice versa (without reordering, etc.)
Fixes IDEA-318626 Change signature incorrectly wraps/unwraps arguments when changing between varargs and arrays

GitOrigin-RevId: 3372a144be4363fef2c40e8968a07d8ed6b916a6
2023-04-28 09:47:08 +00:00
Alexandr Suhinin
656b22fd2d [extract method] IDEA-269072 IDEA-188743: reuse 'declare var type' option from 'introduce variable' refactoring
GitOrigin-RevId: 7a8f7a9eba3c7277da7b54e30a03afbbf771f84e
2023-04-21 10:58:34 +00:00
Alexandr Suhinin
1d2c163976 Revert "[extract method] IDEA-269072 IDEA-188743: add option to declare extracted variable as 'var'"
This reverts commit 27b857ab3be3a76bc80417338ac34e691c64ebca.

GitOrigin-RevId: ba9ba9b3846f9dc56c3184f8e5a1ff7a59e1b072
2023-04-21 10:58:30 +00:00
Alexandr Suhinin
f0f3a59d2a [extract method] IDEA-269072 IDEA-188743: add option to declare extracted variable as 'var'
avoid unnecessary change in type element

GitOrigin-RevId: 27b857ab3be3a76bc80417338ac34e691c64ebca
2023-04-19 12:03:23 +00:00
Alexandr Suhinin
6b3d57627c [extract method] IDEA-315449 fix regression: don't suggest bad signatures when parameter number is not changed
GitOrigin-RevId: bde662ca1d248af84a69f60713c6ab6aa836d275
2023-04-14 16:02:22 +00:00
Alexandr Suhinin
f2ff1ff151 [extract method] IDEA-318013: check explicit parent of identifier instead of search
GitOrigin-RevId: d632f6dfffdbfe8912882f30c9bd203e95362a54
2023-04-14 09:46:34 +00:00
Alexandr Suhinin
23ff859664 [extract method] IDEA-317499: infer type arguments for class usage parameters ('this')
GitOrigin-RevId: 7e1b558415ac7a7d381287e99bf54ce87eeef6cb
2023-04-07 13:13:30 +00:00
Alexandr Suhinin
26bae9e549 [extract method] IDEA-317497: search static context until target class only
GitOrigin-RevId: 1e5c8e3319a9a45506e0785d4e7912d71f0233c6
2023-04-07 13:13:27 +00:00
Alexandr Suhinin
41a158d131 IDEA-316766: fold array accesses after duplicate analysis
GitOrigin-RevId: f839cc3b2ab3443ca7a95a8e8f116e72b8b943f7
2023-04-05 10:50:08 +00:00
Alexandr Suhinin
0139d316d5 IDEA-316766: sort parameters by usage positions
GitOrigin-RevId: 764d8b822a655876f5d5a36545449792208c82f3
2023-04-05 10:50:04 +00:00
Alexandr Suhinin
ca161902dc [extract method] IDEA-316471: enable when there is no parent code block (class context)
GitOrigin-RevId: b7a37f10cc2249b640e086c28102187578ae9971
2023-03-29 15:13:37 +00:00
Bas Leijdekkers
7bf6f673f7 Java: allow to move static class initializers to another class (IDEA-13046)
GitOrigin-RevId: f911c35c37dc9e09b3c526a5fd8a00a67f646afb
2023-03-22 19:40:05 +00:00
Bas Leijdekkers
011f403a4c Java: improve and add warnings to Move Static Member refactoring
GitOrigin-RevId: 139c2be08a2e1a60a205a7d012d9505549943a3d
2023-03-22 19:39:57 +00:00
Alexandr Suhinin
b5b3ceda3d [extract method] IDEA-315737: enable extract method on virtual expressions
GitOrigin-RevId: a6ca3dea5d3ab7ec8237c21a06e366e3e5c68a89
2023-03-20 17:18:51 +00:00
Bas Leijdekkers
d86a8f97da Java: basic class initializer support for Pull Members Up refactoring (IDEA-315629)
GitOrigin-RevId: 75dd479b8ff332776bb238fe964cc9cf715b2404
2023-03-18 01:16:38 +00:00
Alexandr Suhinin
f7bef79b1b [extract method] IDEA-315225: pass all type parameters in static methods
GitOrigin-RevId: d4bc466d3df5935404485ab95635894acb9aa448
2023-03-17 13:19:56 +00:00
Alexandr Suhinin
a580c212c5 [extract method] IDEA-315575: test extract to interface
GitOrigin-RevId: b6a0879ba137c4a375c2b3258d7afc9217d4d153
2023-03-17 10:21:07 +00:00
Bas Leijdekkers
fd5d7ebeeb Java: extracted enum should have final value field and constructor sorted before method
GitOrigin-RevId: daaf348e0b0905a4cc200d5816a7e0310246eef8
2023-03-15 18:44:12 +00:00
Bas Leijdekkers
f823422cb6 Java: don't break enhanced switches when extracting enum delegate
GitOrigin-RevId: 0860d99b8983d9d6443f82dcc3e92e596b07e96a
2023-03-14 15:25:23 +00:00
Bas Leijdekkers
779f0ecebc Java: avoid uncompilable code when extracting nested delegate enum (IDEA-274500)
GitOrigin-RevId: 7175d4abc9c1f88c612305c517a30051b1218352
2023-03-14 15:25:20 +00:00
Alexandr Suhinin
91eb1a3c22 IDEA-314428: enable 'introduce field' on incomplete elements with class context
GitOrigin-RevId: 1d8189f692928ef7b9d30ed1404abd8f45fd9d81
2023-03-13 17:54:41 +00:00
Bas Leijdekkers
0b3369e70d Java: correct check if string concatenation parentheses are required (IJ-CR-104315)
GitOrigin-RevId: 68ac64ef4da0e10051a4df6b9c11f2779d351f8b
2023-03-10 09:55:00 +00:00
Bas Leijdekkers
6a09b77b61 Java: don't add unnecessary parentheses when inlining string concatenation into a string concatenation (IDEA-314882)
GitOrigin-RevId: d13d5bf7670009a4d26f09b4838828b5adeb4bde
2023-03-08 00:32:43 +00:00
Tagir Valeev
ae09e7920c [java-refactoring] InlineToAnonymousClass: better support of arrays
GitOrigin-RevId: ddb42b302f70a8b44aca06fc9c643f009ea1c3da
2023-03-02 14:22:33 +00:00
Alexandr Suhinin
72af44b14d [extract method] IDEA-313664: allow 'make static' for methods inside inner classes if language level supports this
GitOrigin-RevId: 3eba22a8685ecb6905a867ff68b9f96f7438140d
2023-03-02 09:12:52 +00:00
Alexandr Suhinin
7a80c0d0ed [extract method] IDEA-313673: don't suggest to make method static if there is a non-static class usage
GitOrigin-RevId: 5b2c6e7a16b730c1fc563b295509e1439b03fc97
2023-03-01 18:25:19 +00:00
Alexandr Suhinin
6ed0762529 [extract method with object] fix: check class conflicts inside nested classes
GitOrigin-RevId: 6648c003ae7030c371b83fd68550e81ad1debdf9
2023-02-27 13:03:57 +00:00
Tagir Valeev
d9da9a93bc [java-refactoring] IDEA-314127 Unbundle 'Generify' refactoring to 'Additional Java Refactorings'
GitOrigin-RevId: 029f86a736760325c27f1a79a993f35db375bfdb
2023-02-25 12:25:04 +00:00
Roman Ivanov
b437ff2aa9 wait for non-blocking read action in test, fix test data (formatting is different in file, but same in IDE)
GitOrigin-RevId: 0e2d2cb5bc01c2e0bb2e0f749fbc2b1da1ae107b
2023-02-20 11:08:42 +00:00