Commit Graph

5349 Commits

Author SHA1 Message Date
Mikhail Pyltsin
330ba98e01 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- fix NullableManager, when it can't find annotation in type

GitOrigin-RevId: 121927429534971abb4a50d1f670afbed9384045
2024-06-26 20:34:48 +00:00
Tagir Valeev
15bb3eb9f4 [java-incomplete-model] Support declared but unresolved exceptions
GitOrigin-RevId: 2e493f1820ce2e676708e191c0ff0b72b4ecaa59
2024-06-25 16:42:40 +00:00
Tagir Valeev
c93d4b68d2 [java-incomplete-model] Support unknown exceptions thrown from try block
GitOrigin-RevId: f968327e98f7f9804973c8ff9adf6366a5aec490
2024-06-25 13:54:11 +00:00
Tagir Valeev
838cf2d73c [java-incomplete-model] Assume that any unresolved class-type is assignable to java.lang.Object
Partially improves inference in incomplete mode

GitOrigin-RevId: 1d9c7c75afd524ea02980be8f96c19fba1eaaf54
2024-06-25 13:54:11 +00:00
Tagir Valeev
e377c6f30c [java-incomplete-model] Support concatenation with null-type expressions
GitOrigin-RevId: 19cdff4368ec690fb291f5eb25c381dbbba3cdd4
2024-06-25 09:23:05 +00:00
Tagir Valeev
7b5b0bd4e4 [java-incomplete-model] Support known constructors with unresolved components
GitOrigin-RevId: 12f529c3eae1abba306c6318f189d08c877f9aa7
2024-06-25 09:23:05 +00:00
Tagir Valeev
b6771f471e [java-incomplete-model] Fix unresolved method call with qualifier and incomplete hierarchy
GitOrigin-RevId: 94881c672bb3c1a5c3ea9dde381c6223a4996fca
2024-06-25 09:23:05 +00:00
Tagir Valeev
acf8109a0f [java-incomplete-model] Support 'var' declarations
GitOrigin-RevId: 1d35868639192661ad6d1f8bafbcbda188b547b2
2024-06-25 09:23:05 +00:00
Georgii Ustinov
bea3fefda2 [Java. Code Formatting] Restore caret in files for AnnotateMethodTest#testAfterDoNotAnnoI
IDEA-353192

GitOrigin-RevId: 5f930ffb06158c40e786cd948c8f8d0982e61814
2024-06-21 15:13:57 +00:00
Georgii Ustinov
41cf8f6fe3 [Java. Code Formatting] Add check to TypeAnnotationUtil that language level is at least 8
IDEA-353192

GitOrigin-RevId: e8d2d8270dbc1c39300d5a2d55ef993e433ccdbc
2024-06-21 15:13:57 +00:00
Mikhail Pyltsin
73bbc5d00d [java-completion] IDEA-355252 Don't suggest deconstruction with incorrect name
GitOrigin-RevId: 9bdb1273f507054c479eaa86597eadaf4568a9dd
2024-06-20 17:53:33 +00:00
Mikhail Pyltsin
fc86f137ca [java-inspections] EA-1288620 record deconstruction can be broken in inspections
- check that record deconstructions have correct numbers of components
- optimize `unwrapSealedTypes` a bit

GitOrigin-RevId: 167dabb1a5e6dd156e8d5772373c6f059e209257
2024-06-20 17:53:33 +00:00
Tagir Valeev
f3a9cdfdab [java-psi] Static interface method accessible through inheritance should not shadow static import
Fixes IDEA-355152 Good code red when static import collides with static interface method from the hierarchy

GitOrigin-RevId: f6f68cc372928d98bb1f66f2c3ddfaaf63d69702
2024-06-19 15:08:14 +00:00
Tagir Valeev
567e0b0d05 [java-intentions] IDEA-270206 Nullability annotation at type parameter/wildcard: add a quick-fix to move it to the bound
GitOrigin-RevId: e8e56c2d27a77414045064c784f48ff712ad0d2d
2024-06-14 16:05:02 +00:00
Tagir Valeev
636172d7db [java-intentions] UnimplementInterfaceAction: do not try to remove synthetic methods
Fixes IDEA-354044 Error in Unimplement Interface when invoked on record

GitOrigin-RevId: 9c07e03d1f86ded0aeea3bd0f373dfc263e72eb4
2024-06-14 16:05:02 +00:00
Bas Leijdekkers
3b9377a54b Java: better error message on duplicate reference in extends/implements list (IDEA-354856)
GitOrigin-RevId: 0ba4eed5966c273f94552d7fe623a69bb6eb6c95
2024-06-14 13:20:40 +00:00
Mikhail Pyltsin
ce5a0d65c2 IJ-CR-135655 [java-highlighting] S IDEA-286130 annotations are not allowed in permitted list
- fix text
- fix test

GitOrigin-RevId: 87072c9561528bd04a27c03293f926a33a2519f9
2024-06-13 10:54:53 +00:00
Tagir Valeev
77ec9855d8 [java-inspections] AddFinallyFix: handle end comments
GitOrigin-RevId: b8dbc546122362e256c92be5a3a696275639f2a5
2024-06-11 18:03:36 +00:00
Tagir Valeev
49ed49dc2d [java-inspections] EA-1160494 - IOE: BasicJavaParserUtil.parseFragment
GitOrigin-RevId: 5a13ceb97f8105766928d67336fe9a87df62053a
2024-06-11 13:01:56 +00:00
Tagir Valeev
bbbda8b6af [incomplete-project-model] Better processing of overloaded methods
GitOrigin-RevId: b5348e9a75486c5bb75b49fd3e415743cb026952
2024-06-07 18:19:54 +00:00
Tagir Valeev
6f754cceb9 [incomplete-project-model] Illegal initializer for an array: do not report on pending refs
GitOrigin-RevId: f4dc862ce95589b32ff1bd36092a187e1c43a4a3
2024-06-07 18:19:49 +00:00
Tagir Valeev
2e03408f96 [incomplete-project-model] Attribute value must be constant: do not report on pending refs
GitOrigin-RevId: 3ea9a300b731280c6778ebcee2c858ab8b3e6534
2024-06-07 18:19:44 +00:00
Tagir Valeev
49a5baff95 [incomplete-project-model] Lambda parameter type is potentially convertible to anything
GitOrigin-RevId: 7f20f6011defbdbf8e3a6ce956c2d7f058f25738
2024-06-07 18:19:39 +00:00
Tagir Valeev
d7e82eae56 [java-incomplete-model] Suppress 'Variable expected' for pending references
GitOrigin-RevId: 04453a4a5947b024df4387f6ea42b903be703b1d
2024-06-07 16:43:27 +00:00
Tagir Valeev
36e1bb72de [java-incomplete-model] Basic support of unresolved functional interfaces
GitOrigin-RevId: b1a79f1a77911485011b011e09105fdadc887e58
2024-06-07 16:43:22 +00:00
Tagir Valeev
0037baab23 [java-incomplete-model] Do not report potentially convertible ==/!= comparisons
GitOrigin-RevId: 71b3f3c3edda0ffd112c314f6a5b5b0e2cb29ee6
2024-06-07 16:43:16 +00:00
Tagir Valeev
7fe1b165a4 [java-psi] Do not resolve super() call to Object() constructor when superclass is not resolved
Needed for incomplete project model.

GitOrigin-RevId: 2acbba54f4fd50fb3261601f1cb66175d7f19da6
2024-06-07 16:43:12 +00:00
Tagir Valeev
78d4bd2c8b [java-intentions] Quick-fixes to change method/var return type when inference fails
Fixes IDEA-354184 Quick-fix for generic types

GitOrigin-RevId: 65d513f5303a082c26283e09275470840df90d30
2024-06-06 18:15:52 +00:00
Tagir Valeev
2d3ed0f730 [java-intentions] CreateConstructorParameterFromFieldFix: fill variables before modifying constructors
When chain target constructor is already updated, it affected other constructors from the same chain
Fixes IDEA-345876 Unable to add constructor parameter via quick-fix

GitOrigin-RevId: e13d1d24ad16dbd32281b7f13be6d656871acef2
2024-06-05 15:08:25 +00:00
Tagir Valeev
a8788fa3b8 [java-highlighting] Do not try to resolve star-import if existing explicit import fails to resolve
Otherwise, wrong class may be resolved in incomplete project model
AnonymousHashCode.java changed, because java.lang.Object import was unresolved (no JDK configured) and we now refuse to resolve to same-package class if there's a suitable explicit import
beforeHierarchy.java/afterHierarchy.java changed, because the import was incorrect, and it prevented importing implicit java.lang.Exception
predicates2.java changed: incorrect import removed (now prevents importing java.lang.String)
MoveInnerProcessor changes: import refs should be rebound first; otherwise they disallow to rebind normal refs
SpringDataMongoDbQueryCompletionTest changed: erroneous import removed

GitOrigin-RevId: f380409c445306bb9b8aceb5fe4dce1351511283
2024-06-04 20:27:13 +00:00
Georgii Ustinov
a4d5e41d7f [Java. Code Formatting] Rewrite the way of detection type annotation in JavaFormatterUtil
IDEA-353192

GitOrigin-RevId: 34e375e4e1e059be03aad12c2839911b8315ed06
2024-06-04 06:46:24 +00:00
Tagir Valeev
c85a3375f5 [java-highlighting] Test for bad inference
GitOrigin-RevId: a7a84f0b3cedcdcb7f41238a7747ff085140430e
2024-06-03 16:18:34 +00:00
Mikhail Pyltsin
7327bf910a [java-highlighting] IDEA-353876 Support intersection type for switch selectors
GitOrigin-RevId: 075363ad27e93718b10b79234904eed7ac919436
2024-06-03 10:46:00 +00:00
Georgii Ustinov
3b50806cf1 Revert formatting type annotations on the same line before the type in method
IDEA-353192 IDEA-354026

GitOrigin-RevId: cbf3e0b332517194f35d979a631cbbb0121893b4
2024-06-01 09:59:49 +00:00
Mikhail Pyltsin
687ea8c03c [java-highlighting] IDEA-286130 annotations are not allowed in permitted list
GitOrigin-RevId: 921ad24be3586a17a6e393d73687ddc36ce539ac
2024-05-30 17:07:51 +00:00
Mikhail Pyltsin
717a44934b [java-highlighting] IDEA-354239 support exhaustiveness for record patterns with cross-section
GitOrigin-RevId: 3a5ce8c4aeb88270fc750f1b671d02e0e3a9b7a7
2024-05-30 11:57:36 +00:00
Mikhail Pyltsin
122bc7ffc3 [java-highlighting] IDEA-353117 Error highlighting in the incomplete project model
- prevent infinite recursion with parameters.
`com.intellij.codeInsight.daemon.impl.analysis.IncompleteModelUtil.hasUnresolvedComponent` can be called infinitely with parameters for ClassA<T extends ClassA<T>>, where T is captured `?`

GitOrigin-RevId: 60e44f537f04a3bf817493ff40eb227851bf1821
2024-05-27 15:13:42 +00:00
Bas Leijdekkers
2b4e8631ef [java] consider enum constants used in editor when valueOf() is called (IDEA-293797)
GitOrigin-RevId: 6a494c11f8e658f6bebef2f97623a0ab4801a672
2024-05-27 10:30:37 +00:00
Bas Leijdekkers
a37b504489 [java] consider value() method used in the editor when likely @Repeatable annotation (IDEA-232566)
GitOrigin-RevId: 249dc859a3db5ee9a079be3c598816e834ad7f94
2024-05-24 20:34:32 +00:00
Tagir Valeev
26ecc4e294 [java-highlighting] Precise member tracking for unresolved reference
Also: support method ref highlighting in incomplete project model
Part of IDEA-353117 Error highlighting in incomplete project model

GitOrigin-RevId: b081ddcbaa4e54403a20bac0a2cdb37db421ceca
2024-05-23 00:20:40 +00:00
Tagir Valeev
caad5f1cb1 [java-inspections] Properly track multiple potential imports for unresolved reference
Part of IDEA-353117 Error highlighting in incomplete project model

GitOrigin-RevId: 06ac6ae2759e5ff0935bf39f750bfb9dad1fd235
2024-05-23 00:20:35 +00:00
Alexey Kudravtsev
12fe9dde02 handle one other type of PSI change (part of KTIJ-27988 K2 IDE: used/unused declaration highlighting is not updated in Kotlin source on editing Java source)
GitOrigin-RevId: d2e7d4c9801d50df41cffa33eedb22a1db1ac7cf
2024-05-21 16:23:10 +00:00
Tagir Valeev
c26fabffef [java-highlighting] Do not mark potential imports for unresolved references as unused
Improves IDEA-353117 Error highlighting in incomplete project model

GitOrigin-RevId: d6419b900fc817c28b7d1b942b28857a14b44141
2024-05-21 14:09:47 +00:00
Alexey Kudravtsev
c84e273956 rehighlight the entire file whenever the reference was changed in some other place, even inside codeblock, to correctly update unused declarations, to fix KTIJ-27988 K2 IDE: used/unused declaration highlighting is not updated in Kotlin source on editing Java source
GitOrigin-RevId: d4025dde88ed3a997a515cb859077fb2a4348d5d
2024-05-17 13:50:18 +00:00
Georgii Ustinov
77bfbe1b39 [Java. Code Formatting] Fix tests which relied on old version of Nullable/NotNull annotations
IDEA-353192

GitOrigin-RevId: f913b37c8fb9c7c754d7c6fcd5c1cdd215a7f295
2024-05-17 11:16:41 +00:00
Bas Leijdekkers
106130b6f8 [java] better quick fix text (IDEA-353386)
GitOrigin-RevId: ebc64c441f2140181ad4e996005a45b19936b7d3
2024-05-14 10:29:57 +00:00
Bas Leijdekkers
0a8f0ae1c8 [java] better error message for type parameter outside bounds when the type parameter is not a concrete class (IDEA-353386)
GitOrigin-RevId: 6fcb1f8c2180ed319cdf7030de9c38b302e8e2d4
2024-05-14 10:29:53 +00:00
Georgii Ustinov
f762b8fa7b [Java. Code Formatting] Change tests after adding support to format last line
IDEA-351758

GitOrigin-RevId: 11bb2e2298d371ebf4041a05b089b0997a228d14
2024-05-13 13:59:09 +00:00
Tagir Valeev
0e644d03a3 [java-highlighting] Incomplete model (IDEA-353117) improvements
Annotations; casts; modules; fix accidental negation

GitOrigin-RevId: 5fee6394cd39b066c1c05b1af93f4fdc9d554b82
2024-05-08 19:27:19 +00:00
Tagir Valeev
deb33bbc1d [java-highlighting] IDEA-353117 Error highlighting in the incomplete project model
First draft

GitOrigin-RevId: e9dbfd1d6c42fe92f43686e465c11201b07cf3d4
2024-05-07 18:33:41 +00:00