410 Commits

Author SHA1 Message Date
Bas Leijdekkers
7fbe663b37 Java: don't add instance check when generating equals() (IDEA-357686)
GitOrigin-RevId: 21a0555c2fe6be705fe4d510c8d8d08238af4585
2024-09-25 21:53:25 +00:00
Mikhail Pyltsin
d72eba89a1 [java-completion] IDEA-357258 Java 23: .switch postfix completion is not supported for primitive data types
GitOrigin-RevId: ae848584ee81611bde2e1201c79923c2e170f6e6
2024-09-09 15:21:29 +00:00
Mikhail Pyltsin
2954ea71d0 [java-completion] Basic completion does not complete case keyword with default case
GitOrigin-RevId: 7e4f78bfb981202f90ae7d75302753a71055599c
2024-08-19 17:51:59 +00:00
Tagir Valeev
89e8955dc0 [java-completion] IDEA-355603 Do not suggest anonymous class creation for sealed interface
GitOrigin-RevId: 5d8bef4c624ec29338363e8120455010a4612ae0
2024-07-02 16:37:40 +00:00
Mikhail Pyltsin
5773e12754 [java-completion] EA-1232387 NPE: CatchLookupElement.lambda$getHardcodedExceptions$0
- skip a null type for a catch section

GitOrigin-RevId: aee2b376d5711e98a5f90926986b0f7343930f4b
2024-05-29 12:55:32 +00:00
Mikhail Pyltsin
55c9701fc8 [java-completion] IJ-CR-129761 IDEA-349764 Suggest a full catch section
- catch sections are added automatically

GitOrigin-RevId: 75aed0b2281ffa0e412b1eaecf90caf406ba0182
2024-04-03 20:02:54 +00:00
Mikhail Pyltsin
ab78cc0642 [java-completion] IJ-CR-129761 IDEA-349764 Suggest a full catch section
- catch sections are added automatically

GitOrigin-RevId: 7bb37aec0207d152d31b0c78cc91657f80036719
2024-04-03 13:32:55 +00:00
Mikhail Pyltsin
ba0a409500 [java-completion] IJ-CR-129761 IDEA-349764 Suggest a full catch section
- tests are extracted
- CatchLookupElement works in dumb-mode

GitOrigin-RevId: 75b5c34ce124a4315a8a73c020ac08f01ecd9487
2024-03-29 12:09:38 +00:00
Bas Leijdekkers
8c84138f29 [java] fix strange completion when trying to create vararg parameter (IDEA-346732)
GitOrigin-RevId: 7ba3612b1df542111163d635ae1fdd0ad8877fce
2024-02-22 18:38:34 +00:00
Bas Leijdekkers
cfc675690d Java: use Objects.hashCode() for single field JDK7+ hashCode() generation (IDEA-177907)
GitOrigin-RevId: 59011b448a85df06ef0b1a5960ab3bf7c77bc32f
2023-11-17 02:24:00 +00:00
Mikhail Pyltsin
58bd5a802a [java-completion] IJ-CR-118435 IDEA-335904 Completion in enhanced switch for enum
- fix tests

GitOrigin-RevId: 3aca2ccbd6b0fd15a8510174b7a23b19e6efc971
2023-11-03 12:40:06 +00:00
Mikhail Pyltsin
0939782a59 [java-completion] IDEA-335904 Completion in enhanced switch for enum
- offer classes and interfaces
- offer `default` after `case null,`

GitOrigin-RevId: f1d0567efeafcd5320db88089bab7eb1dbe17b9f
2023-11-01 10:23:53 +00:00
Tagir Valeev
000f447107 [java-completion] Insert comma automatically when completing a new annotation attribute
Fixes IDEA-336370 Autocompletion should be smarter for annotations

GitOrigin-RevId: aa6efeb2b35f6ea242ed43cc1cb05aeceefe6d5c
2023-10-27 18:20:12 +00:00
Tagir Valeev
093ca478fd [java-completion] Deduplicate chained items with different class qualifier
They are basically the same
Improvement for IDEA-334398

GitOrigin-RevId: 1d29fed1c229ed3d41c89902dfe578ab1610f989
2023-10-20 19:12:59 +00:00
Tagir Valeev
db535a5a08 [java-completion] JavaNoVariantsDelegator: avoid redundant chains of nested classes
Fixes IDEA-334398 Code completion of nested types suggests confusing levels of nesting

GitOrigin-RevId: 206fc2b9f4a6501720b7bc95e79d981b20450823
2023-10-18 14:10:34 +00:00
Mikhail Pyltsin
299b7e468b [java-highlighting] IDEA-334683 (EA-921945) anonymous classes and local classes must not inherit sealed classes
- fix for completion
- fix for error highlighting

GitOrigin-RevId: 337131aab1bc7473711ffc078175b5adba34f30d
2023-10-12 11:53:56 +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
e698c46083 [java-completion] IDEA-333184 IJ-CR-115840 completion for patterns in switch
- added new tests
- filter cases after caret
- reuse constant

GitOrigin-RevId: 35065e3cdd795891bd20d9e7d5387de09cc48083
2023-10-02 17:32:27 +00:00
Mikhail Pyltsin
b52ed41214 [java-completion] IDEA-333184 completion for patterns in switch
- not show used patterns
- prioritize for rules
- support smart mode

GitOrigin-RevId: 647d1c3cbe51d46cf97c7c2ac95e9f0fd0dd4220
2023-09-29 09:19:25 +00:00
Tagir Valeev
3204f9d239 [java-completion] NormalCompletionTest: use Java 21; also fix case label completion with colon char
GitOrigin-RevId: 84169987b62cb0a1d8bac137f0044ff89e51a7d9
2023-08-04 16:44:05 +00:00
Tagir Valeev
e4aa26c19c [java-completion] Do not insert semicolon automatically into for-update statement
Fixes IDEA-326232 Suppress semicolon for the next iteration part in for-loop

GitOrigin-RevId: 4ceeb1c673fdbabf59f2e31610a1012f1fb07cc4
2023-07-31 15:35:31 +00:00
Mikhail Pyltsin
dcd9e3d954 [java-completion] IJ-CR-111599 IDEA-324653 Completion for objects with enums. Add test that it doesn't work for old Java
GitOrigin-RevId: 32b02cb0092b53093cf63dbea95df0c2e2e74724
2023-07-21 15:54:19 +00:00
Mikhail Pyltsin
dbb4b11cbe [java-completion] IDEA-324653 Completion for objects with enums. Fix tests
GitOrigin-RevId: ff1ca41e8ef385d6abae9c64eaf9177e549a73e6
2023-07-20 16:42:37 +00:00
Mikhail Pyltsin
4453543010 [java-completion] IDEA-324653 Completion for objects with enums
GitOrigin-RevId: e0d5b5dba3535ec70a2aa4eebf3094b45474ef11
2023-07-20 16:42:24 +00:00
Mikhail Pyltsin
af78d087f5 [java-completion] IDEA-324653 IJ-CR-111070 No completion for qualified Enum in switch
GitOrigin-RevId: f633fb8552cf65e718954c98325c1445ca433461
2023-07-17 11:27:38 +00:00
Mikhail Pyltsin
ab14666e4e [java-highlighting] 'case default' is the incorrect syntax, and it was replaced with the proper 'default' syntax.
GitOrigin-RevId: 72f8e7f6c9080db7cb0b89c0ed876eb949171e8f
2023-07-14 16:14:45 +00:00
Mikhail Pyltsin
b9abbe646c [java-completion] IDEA-324653 No completion for qualified Enum in switch
GitOrigin-RevId: 60392ce4c67348dfe05d558fc88f62884300f553
2023-07-13 19:06:20 +00:00
Mikhail Pyltsin
c50d84e703 [java-highlighting] IDEA-324445 IJ-CR-110332 offer when after TypePattern. Delete outdated tests for default
GitOrigin-RevId: 58854cd0e9c139bc0d21443d195f436f4ab24499
2023-07-08 13:45:06 +00:00
Mikhail Pyltsin
424001aef5 [java-highlighting] IDEA-324445 IJ-CR-110332 offer when after TypePattern
GitOrigin-RevId: e83a11865b073e51f26361121a739d4977abf17b
2023-07-08 13:44:56 +00:00
Mikhail Pyltsin
13774e83ac [java-highlighting] IDEA-324445 offer when after TypePattern
GitOrigin-RevId: 5ef95cd17be1a7c76e82438d84f46f96b515be2f
2023-07-06 12:58:29 +00:00
Tagir Valeev
21bce5d81d [java-completion] Suggest single constructor class parameter and null for Void
Improves IDEA-186918 Wrong code completion for new EnumMap

GitOrigin-RevId: 3235b254cc33f37933c72fb6b79ca1b9bdcf8eb6
2023-02-13 14:37:03 +00:00
Tagir Valeev
fc26ba2b00 [java-completion] Permits list: fix scope when modules aren't used
Fixes IDEA-310106 When using permits in a sealed class, the IDE does not suggest children classes

GitOrigin-RevId: 8f210942613aaf93b83ad7f81751d3181e079513
2023-01-19 11:38:28 +00:00
Tagir Valeev
bfcca2efde [java-completion] Extracted NormalSealedCompletionTest from NormalRecordsCompletionTest; one more test
GitOrigin-RevId: c550eb6ab73f35138a4aeb60b3ad5b4c5a0d71b3
2023-01-19 11:38:25 +00:00
Tagir Valeev
21180abb98 [java-completion] IDEA-307738 dummy "IntellijIdeaRulezzz" text in autocompletion
GitOrigin-RevId: bc4875d8a950aa8f32eefe3b18fc4940d28a5ef5
2022-12-07 12:41:24 +00:00
Tagir Valeev
2f83b31b86 [java-completion] Complete final and yield inside switch rule
GitOrigin-RevId: 643a7bf62a04c9eb35bf554f3f3f5cc648188cbe
2022-11-11 12:17:32 +00:00
Tagir Valeev
cf9be48742 [java-completion] Restore references in switch labels (IDEA-301950)
Likely, regression after IDEA-278622

GitOrigin-RevId: cc77068631608e388e95cb4f103b3d8155aa58e9
2022-09-21 10:52:20 +00:00
Tagir Valeev
269d17c850 [java-completion] IDEA-302003 Complete statement keywords after switch rule arrow
GitOrigin-RevId: 2a9f1b3deb68145bbe4fbfa42e45432e6281a41d
2022-09-19 16:43:17 +00:00
Tagir Valeev
df4d5e6486 [java-completion] IDEA-292773 autocomplete should expand also the ".class" automatically when requested argument type is a java.lang.Class
GitOrigin-RevId: 064de8edd56681c0ef9720199ae002eb12e4ca92
2022-05-05 18:11:18 +00:00
Tagir Valeev
dc3f7a9258 [java-completion] IDEA-283592 Method completion for toString() automatically invokes the toString generator - that should be optional
GitOrigin-RevId: 711dc0ded53119e338f844dcbcf6e78361e120fa
2021-12-02 09:16:38 +00:00
Tagir Valeev
6c91d14cfc [java-completion] Properly complete qualified references in permits list
Fixes IDEA-278867 Identifier completion does not work in permits clause of sealed class

GitOrigin-RevId: f69d17c2d74be59367db810a29f0504b98f501ac
2021-09-29 10:52:41 +00:00
Nikita Eshkeev
90db265d7a [java][switch completion] IDEA-278622 Fix completion variants in switch case label
Use the `inheritorsFilter` when the element that is being filtered is of the PsiClass type regardless if the selector class of a switch block is sealed or not. All the inheritors of the sealed class get added in JavaCompletionProcessor.

GitOrigin-RevId: 28e70b44444edad329f086a9dca0557baea03bec
2021-09-27 13:36:08 +00:00
Nikita Eshkeev
f35bee468f [switch completion] IDEA-277375 Can't complete default label in switch case
Add the `default` keyword to the completions after `case`.

GitOrigin-RevId: 8e1e05d230a43a11a47d9b55ab89548530ab68b2
2021-09-13 19:04:31 +00:00
Nikita Eshkeev
a4da031bdf [postfix completion] IDEA-277334 Java 17 support: Postfix .switch doesn't work when selector expression is Object
The switch statement postfix completion template used to be applied to either elements of the Object type or of a sealed class. This restriction was just a result of a mistake. This patch lifts this restriction and makes SwitchStatementPostfixTemplate truly DumbAware by resolving an expression's type with DumbModeAccessType bypassing the dumb mode if necessary.

GitOrigin-RevId: c2f82834ff4e6842d6d825f9ff994c288196291b
2021-09-10 16:46:29 +00:00
Nikita Eshkeev
8df26f2b6f [postfix completion] IDEA-277334 Java 17 support: Postfix .switch doesn't work when selector expression is Object
Add tests for the switch postfix completion

GitOrigin-RevId: b1221d428e78221c3a2c3e128d24eefa4bd2bc0e
2021-09-09 10:03:29 +00:00
Nikita Eshkeev
5ecc0aec9c [java][switch completion] IDEA-270439 Code completion for pattern matching in switch
Reuse the SealedUtils#findSameFileInheritorsClasses method in order to eliminate the duplicating code and reduce the searching scope. Enable "return" when there is a lambda in a switch label

GitOrigin-RevId: 6e6dbcb8d9b1b16828fcdd29c1e59b2f47a71bb5
2021-08-08 20:45:50 +00:00
Tagir Valeev
ec2238e7c8 [java-completion] Avoid fixing missing comma for methods without parameters
Fixes IDEA-274311 Applying the completion adds a redundant comma on the next line

GitOrigin-RevId: 3f4a55aff4a640e9e40e7a9c242611f0bb95475d
2021-08-06 09:36:31 +00:00
Nikita Eshkeev
94956088c3 [java][switch completion] IDEA-271902 Fix the completion tail in case labels
Make SwitchUtils#isRuleFormatSwitch return true regardless if the passed switch block is used in a statement or an expression context.

GitOrigin-RevId: fce50d7a2e2936e6653b2eae1509e6c1fe76d7ad
2021-08-05 09:51:07 +00:00
Nikita Eshkeev
6d4330c337 [java][switch completion] IDEA-270439 Code completion for pattern matching in switch
Add sealed hierarchy completion in switch case labels and exclude "case null" and "case default" from selectors of the primitive types.

GitOrigin-RevId: 9108465d0f9f2462fa8b9f355c3366cdd1d2c4ab
2021-07-18 21:16:58 +00:00
Nikita Eshkeev
afc2a8cd37 [java][switch completion] IDEA-270439 Code completion for pattern matching in switch
Adjust the completion variants for switch statements and expressions

GitOrigin-RevId: 05119897b0eb72bb875097cd197f376534d15db9
2021-07-13 19:51:15 +00:00
Nikita Eshkeev
be5828b0ce [java][switch completion] IDEA-271902 Fix the completion tail in case labels
Eliminate the insertion handler for JavaPsiClassReferenceElement because it might be confusing to the users not to be able to set the variable name themselves.

In addition to that the patch also reverts the test data that was changed earlier because it was a perfectly fine piece of code and should not have been modified in the first place

GitOrigin-RevId: 7046e638ed8f4c1cae72aca600fdfd06eaa3a502
2021-07-12 19:10:45 +00:00