Commit Graph

1696 Commits

Author SHA1 Message Date
Bas Leijdekkers
8051e35d6d [java] don't offer "This reference only" inline option when not applicable (IDEA-195246)
GitOrigin-RevId: fb74a4e5d07300c8c14bf40c76e205c983429d72
2024-03-06 19:03:25 +00:00
Bas Leijdekkers
6583f8ee65 [java] disallow extracting super expression (IDEA-340915)
GitOrigin-RevId: cb698e271e04767dead0a72d7a70cb3a537af614
2024-03-06 19:03:13 +00:00
Bas Leijdekkers
fb03f800df [java] Remove on-demand imports referring to old package name after package rename (IDEA-171422)
GitOrigin-RevId: c54007736ce960ad874f82819e88519766d92a0a
2024-03-04 12:03:50 +00:00
Aleksey Dobrynin
8b3d830ecd [java, groovy, import] fill in the 'module-info.java' with 'requires' on snippet pasted. IDEA-347999
GitOrigin-RevId: 0cae8730083dc7724026b6dca5da510f25820071
2024-03-01 22:56:24 +00:00
Tagir Valeev
d0cf7b359a [java] IDEA-345498 Remove explicit Java 20-preview support and parenthesized patterns
GitOrigin-RevId: 8d646035979e3ec0a7de3c6f58a4e6ec9967bdbd
2024-02-12 19:12:36 +00:00
Tagir Valeev
5bd02b55c3 [java-intentions] AddVariableInitializerFix: suggest more suitable initial values instead of null for some types
Fixes IDEA-344453 Intellij should not try to initialize an Optional var with null

GitOrigin-RevId: 8097988bf1335a282138e8d09e350c3a5f65204d
2024-02-02 19:17:55 +00:00
Tagir Valeev
bee9170893 [java-injection] Fix handling of empty lines in text blocks
GitOrigin-RevId: e3887bb5c7504d925dab62be8b7182a654b2cc0c
2024-01-26 10:22:51 +00:00
Tagir Valeev
2222d59fd8 [mod-command] Test for complex action (rename after PSI update) inside injection with guards
GitOrigin-RevId: c3fb9a1f2c03f859b02c49183e9547fbc9713d96
2024-01-25 19:15:43 +00:00
Anton Lobov
1bf43101d9 [java] FL-24196 Java: Inline local variable from its declaration throws NPE
GitOrigin-RevId: 8d7e4e03293e944e36fb3fd7dcd9b461c8ac2639
2024-01-18 14:06:32 +00:00
Bart van Helvert
dc11424f70 [kotlin] Run import optimizer when no usages are found
Fixes the issue in Kotlin, Java and Groovy. #KTIJ-28288 Fixed

GitOrigin-RevId: 7cd5942539a10f9ccdba386396f15546b0a9ac00
2024-01-17 13:18:01 +00:00
Mikhail Pyltsin
d72e824939 [java-refactoring] IDEA-343148 Introduce constant causes exception for implicit classes
- use `this`

GitOrigin-RevId: 77ba9f60586b4f16904220145567800082928a68
2024-01-16 14:03:23 +00:00
Alexandr Suhinin
d75d619ab9 [extract method] IDEA-251837 use type element to annotate method nullability
[extract method] IDEA-251837 fix texts

GitOrigin-RevId: 37da2e7e8f83a4d85a87c644788a66ce6ea1e05f
2024-01-12 16:42:18 +00:00
Bas Leijdekkers
0dbc31a8b6 Java: allow to introduce a constant as a field of an inner, local or anonymous class (IDEA-341923)
for Introduce Constant refactoring. Also fixes IDEABKL-3269 when introducing a compile-time constant from an expression.

GitOrigin-RevId: 169e7ee8e14306a265948537b62746d9a26c0298
2023-12-28 17:40:25 +00:00
Bas Leijdekkers
cf79dfa709 Java: cleanup test
GitOrigin-RevId: d5679c33a9ae8501227f38d23679e653ace4d591
2023-12-28 17:40:22 +00:00
Bas Leijdekkers
82c1552e82 Java: make "Inline method" refactoring "statements before super()" aware (IDEA-340403)
GitOrigin-RevId: da7491d85473d64bbf9525adcfd6021274b6e35c
2023-12-28 17:39:44 +00:00
Bas Leijdekkers
8f2386e1d4 Java: make "Introduce variable" refactoring "statements before super()" aware (IDEA-340403)
GitOrigin-RevId: 5b961c4baf967175428cb594e0f6d534d9824eb3
2023-12-28 17:39:41 +00:00
Bas Leijdekkers
b2cf7e2e4b Java: Introduce field - disallow field with local class types that do not compile (IDEA-198440)
GitOrigin-RevId: 52e0dfc48276061214da0b2ad0ef68a512bdf2ee
2023-12-28 17:39:38 +00:00
Bas Leijdekkers
c0997ef509 Java: Introduce field - always allow introducing static field in records (IDEA-312819)
GitOrigin-RevId: 2b73cef07f61c1f9a80b9598e9b6a162990f1417
2023-12-28 17:39:31 +00:00
Bas Leijdekkers
a650d056d4 Java: make "Introduce field" refactoring "statements before super()" aware (IDEA-340403)
GitOrigin-RevId: 60ef523fedfa5065c591acedfb646d7718717489
2023-12-28 17:39:28 +00:00
Mikhail Pyltsin
52cdedefa7 [java-refactoring] IDEA-340785 Unable to rename file with implicit class
GitOrigin-RevId: 177acc65158b318dd74fd9a3644bd6470f36c7bf
2023-12-15 18:58:41 +00:00
Mikhail Pyltsin
8cc5fcc764 [java-refactoring] IDEA-340096 fix moving or adding files with implicit classes
- not change package for implicit classes

GitOrigin-RevId: 16de67179dd55f809f7ade9d18a576f095a6486b
2023-12-11 21:06:11 +00:00
Mikhail Pyltsin
7ed93305c1 [java-refactoring] IDEA-340087 produce accurate PsiType for implicit classes
- fix Introduce variable throws exception in implicit classes

GitOrigin-RevId: c3489b1c6df3669f01b6e5defbf8a2208a7b441d
2023-12-11 21:06:07 +00:00
Mikhail Pyltsin
91cf1947e4 [java-highlighting] IDEA-340063 Don't offer import from implicitly declared classes
GitOrigin-RevId: 7cda6a2eaa67c0c557ce53f61bfd345d5d773694
2023-12-11 21:06:00 +00:00
Anna Kozlova
18dc9f30e8 [copy] enable copy classes/files refactoring in dumb mode
IDEA-180388

GitOrigin-RevId: e3368c25f61561ffaee3ac4d8428a8cd7fe70a5c
2023-12-01 21:53:35 +00:00
Tagir Valeev
8e57917700 [mod-commands] Rename: clear selection before the rename. Otherwise, renamer tries to rename the selected symbol instead
Fixes IDEA-335357 Replace constructor with factory method renames also constructor

GitOrigin-RevId: 93b5b9a8bcaabdb99796222b29449780dab7558a
2023-11-29 11:44:41 +00:00
Tagir Valeev
fd00898d32 [java-refactoring] Inline variable: fix CompilationError test; support inline at ref in the presence of compilation error
Improves IDEA-336815 "Inline variable" misleading error message when compile-errors are present

GitOrigin-RevId: 6e443a44c4ccf8a65d10f4f83665cfe2641282b0
2023-11-28 12:44:11 +00:00
Tagir Valeev
853a7a46fc [mod-commands] Use RenamerFactory when executing rename to make it more similar to normal rename
Provide an interface to specify suggested names from outside
Still part of IDEA-338334

GitOrigin-RevId: 7bb09b7150b463ed8a0c24453c968d60d9e716fa
2023-11-27 19:09:17 +00:00
Tagir Valeev
fc4f8118d2 [java-refactoring] IDEA-338428 Inline pattern variable doesn't work when it's located in nested condition
GitOrigin-RevId: 158e71c18441ffd56eebabe107899b95ac4ac15d
2023-11-17 18:11:02 +00:00
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