8408 Commits

Author SHA1 Message Date
Bas Leijdekkers
9a906a8753 Java: inner class accessing local variable or parameter can't be static (IDEA-375602)
(cherry picked from commit 1b16d1388c09d51009b288ede89e73d156364619)

IJ-CR-168593

GitOrigin-RevId: 7ff7cfa95cdc674c5b1d32a572eec0b95bbfb58d
2025-08-11 15:06:55 +00:00
Mikhail Pyltsin
c472de17e7 [java-inspection] IDEA-376232 JEP 512: 'safe delete' for 'args' in main method in the compact source file at the first place in the list of suggested quick-fixes
- use normal by default

(cherry picked from commit 774eb7a28c0e2ccb794312e3fc0b225aff17da7c)

GitOrigin-RevId: 3e94886091d96b2848848aa0ddc543c315fc2e06
2025-08-04 17:39:34 +00:00
Mikhail Pyltsin
7b4509504b [java-inspection] IDEA-376232 JEP 512: 'safe delete' for 'args' in main method in the compact source file at the first place in the list of suggested quick-fixes
- return ordered quick-fixes unused inspections

(cherry picked from commit b4abe529ad318430466b3e3e9d39dd2d12916a3e)

GitOrigin-RevId: 58d37e7cf5fac5425e4b15aa27cd7c5a6a69e175
2025-08-04 17:39:33 +00:00
Mikhail Pyltsin
3e2d137fdf [java] IJ-CR-167924 IDEA-371865 Inspection to convert 'System.out'<->'IO'
- add array case

(cherry picked from commit fb6b84584ef3778f9b03216d3df57bfea1433b84)


(cherry picked from commit 75d20e2763b7b7506ccab939805cd9d18aa3d745)

IJ-MR-169535

GitOrigin-RevId: 8268a8491f2be9eedca68f0d75f71ac61e6f7795
2025-08-04 12:58:50 +00:00
Mikhail Pyltsin
d3b08c4011 [java] IJ-CR-167924 IDEA-371865 Inspection to convert 'System.out'<->'IO'
- add case for several qualifiers

(cherry picked from commit e422d2f595e29a3ff3f56f01dbbc6fa7c52d9e8d)


(cherry picked from commit 9c9de1fd8fb36723bec6c894426267aa03742be6)

IJ-MR-169535

GitOrigin-RevId: 988ca7a3fa9775dac4aee1468f8a2ba26907bfe4
2025-08-04 12:58:50 +00:00
Mikhail Pyltsin
cae5987ba6 [java] IJ-CR-167924 IDEA-371865 Inspection to convert 'System.out'<->'IO'
- extract "java.lang.IO"
- tests for allowUnresolved
- more reliable works with varargs

(cherry picked from commit 8376baaa86afa3806cb096cffd42e9ed0db0d451)


(cherry picked from commit 78c8b1aed86c1414989a5a83b9e7d54ca5ed83e0)

IJ-MR-169535

GitOrigin-RevId: 704e1b94c19dbf07d5371b8989164070db2cd860
2025-08-04 12:58:50 +00:00
Mikhail Pyltsin
fdab4d3999 [java] IDEA-371865 Inspection to convert 'System.out'<->'IO'
- fixes for comments
- simplified replacement
- support char[]
- support ImplicitArrayToStringInspection

(cherry picked from commit 49f9f829821a498259aa53ebb12cd0b0007f1238)


(cherry picked from commit 5f4445631fa55911d98477066d3821423c37ec11)

IJ-MR-169535

GitOrigin-RevId: cf93370312fc5fbe632eb73ca8840d157732da50
2025-08-04 12:58:50 +00:00
Mikhail Pyltsin
50d43c5da8 [java-inspections] IDEA-374922 Highlight the second main method as unused (part of IDEA-372969 WIP)
(cherry picked from commit 11bc0dcd62d29f94270781ea5a79f4665575d0a9)


(cherry picked from commit 03652b1251e91b2245979593f2fb47f734da8c68)

IJ-MR-169535

GitOrigin-RevId: cd310f32c68c96d1cdb5cb81d67952c56c571933
2025-08-04 12:58:50 +00:00
Bas Leijdekkers
89671dc01a Java: use consistent naming, avoid context record (IJ-CR-166762)
(cherry picked from commit f02c73ea73a915660388a65b3a30de2f3b13b2d8)


(cherry picked from commit 575f4a13537f7dc0ab58eb485708a047c1eb78c9)

IJ-MR-169535

GitOrigin-RevId: b876e505412cd2b75f7d3e53f006ec3cc91fd425
2025-08-04 12:58:49 +00:00
Bas Leijdekkers
9d345bbb34 Java: report local class instantiation from a different static context (IDEA-372971)
(cherry picked from commit 6bc936ee3dd849db2db187b03edac58f4c9b2c73)


(cherry picked from commit 18853b7d75a40f6a8761489a5655602be915a1ba)

IJ-MR-169535

GitOrigin-RevId: 058ac27f8f0ef5c605c962e596711dafb1eeb5fc
2025-08-04 12:58:49 +00:00
Tagir Valeev
ec0da951fe [java-analysis] Remove old algorithm for determining type nullability
Now, new one could be used which is more correct
Fixes IDEA-375493 Nullability of generic type with several bounds depends on bounds order


(cherry picked from commit 24e8aab73704d9b2b5ea7e47215bfeeadaed2f26)

IJ-CR-168211

GitOrigin-RevId: 0e1c558d93eeaba4054da535520411df8ac7b24f
2025-07-07 17:49:49 +00:00
Tagir Valeev
e79d3d8824 [java-highlighting] IDEA-374968 Red code in ConcurrentSkipListMap.java
(cherry picked from commit cfb9b5cbf965190668e9cb4cb9ed102f26fcd3f7)

IJ-CR-166980

GitOrigin-RevId: 529629a073d5107bd13a12203f0528b49e3b5613
2025-06-26 14:43:03 +00:00
Tagir Valeev
94f84681ac [java-inspections] Redundant cast: do not report if there's a change in compilation errors within the parents
Fixes IDEA-372049 Erroneous RedundantCast inspection on varargs with nested calls
Fixes IDEA-361212 Redundant cast false positive: method call type changes

GitOrigin-RevId: d999fccd9a491445502e48bbab3f0b828ca98f6a
2025-06-16 18:45:28 +00:00
Tagir Valeev
73943d0839 [java-dfa] Simplify Mutability computation using external annotations
GitOrigin-RevId: 6570f36a8fa94ca14f4341875b5b980c7124641a
2025-06-16 15:03:39 +00:00
Bas Leijdekkers
e6e401fbe1 Java: don't produce NUL characters in Convert to Markdown documentation output (IDEA-374488)
GitOrigin-RevId: b96d7cc559b0ffbc5130131961b8a530b9baba9c
2025-06-14 22:43:28 +00:00
Vladimir Krivosheev
b935234c91 IJ-MR-162467 don't export intellij.platform.projectModel
GitOrigin-RevId: 11c0bf5ca0f3a6d892658a2b149d85cace9aa2b8
2025-06-14 13:00:48 +00:00
Vladimir Krivosheev
ef0323d07c IJ-MR-162467 don't export intellij.platform.core
GitOrigin-RevId: 05f350c1c087be1bf9b46d8bdac5345a65f55958
2025-06-13 21:52:48 +00:00
Tagir Valeev
b56c24001e [java-inspections] Report incompatible instantiation
Fixes 'nice to have' parts of IDEA-372223 Nullability inference for generic parameters

GitOrigin-RevId: fe9490c352ee417b8a4146076632ef42790a4d25
2025-06-12 12:11:23 +00:00
Tagir Valeev
4466a6556b [java-analysis] Use type nullability in DFA
Fixes IDEA-372347 Java type inference should respect nullability
Fixes IDEA-368244 Unexpected warnings when using @Nullable generic type bounds in @NullMarked context
Fixes IDEA-372223 Nullability inference for generic parameters
Fixes IDEA-367232 'Argument might be null' warning on JSpecify nullable enum

GitOrigin-RevId: 12745f82e22fadb35e23ad73f330501146c86b86
2025-06-12 12:11:23 +00:00
Bart van Helvert
08b951455a [jvm] Fix empty method inspection on default method
#IDEA-374417 Fixed

GitOrigin-RevId: 49be25fd495b89b522fa839e1cda17f09b64468e
2025-06-12 11:54:49 +00:00
Tagir Valeev
31caeebf56 [java-dfa] AllNotNullInliner: cosmetic fixes after review
GitOrigin-RevId: 23157de98e76a5e6fc11ad50be27368c601c9ce3
2025-06-11 12:05:41 +00:00
Tagir Valeev
ee1c23f88b [java-dfa] Native support of ObjectUtils.{all,any}[not]Null methods
Fixes IDEA-373254 Recognized ObjectUtils.allNotNull method in data flow inspection
(at least, my understanding of it)

GitOrigin-RevId: 5bf63072a84b22a3a5de58d53c8521f1296a0fd1
2025-06-10 11:20:40 +00:00
Vladimir Krivosheev
539d5197ad don't export intellij.platform.util.diff
GitOrigin-RevId: 2b25166fd986c0b897636a290a97f1b2927352ce
2025-06-09 21:02:56 +00:00
Bart van Helvert
d942ea174c [jvm] Fix RefMethodImpl hasBody check for Kotlin accessors
#KTIJ-34354 Fixed

GitOrigin-RevId: 926aab275ad24453f34287cccfe6d9621bf57aee
2025-06-09 20:00:17 +00:00
Bas Leijdekkers
9ae32a8adb Java: better mutability check for record components (IDEA-371018)
GitOrigin-RevId: e4f351bcc297d41857406d177df00ff2696a7bfd
2025-06-09 14:24:43 +00:00
Vladimir Krivosheev
982fba0b33 IJ-MR-162467 don't export intellij.platform.concurrency
GitOrigin-RevId: 5cd5a6506d69bfd384f21fc5a79d1f12a172a074
2025-06-08 20:43:51 +00:00
Bas Leijdekkers
0a60753921 Java: don't report casts of constants (IDEA-373869)
in "Constant expression can be evaluated" inspection

GitOrigin-RevId: aa1bac4aef1e306c5c9671b9cdf3aca638feb95b
2025-06-05 20:37:31 +00:00
Vladimir Krivosheev
2d5aaf391b IJ-MR-162467 don't export intellij.xml.psi
GitOrigin-RevId: d4ca928b7dc468451c0047bd35f1f60c1199207a
2025-06-05 14:33:17 +00:00
Nikolay Chashnikov
c2d557e204 [java] API cleanup: mark for removal deprecated unused API (IJPL-178044)
GitOrigin-RevId: 2aa137195af375b84adec0b7c350d6ae256eef53
2025-06-04 12:36:57 +00:00
Vladimir Krivosheev
65fe061584 IJ-MR-162467 don't export intellij.platform.analysis
GitOrigin-RevId: fcbcb68010b58cb507fee2c47473758b999e471b
2025-06-04 11:16:33 +00:00
Mikhail Pyltsin
f79bb18278 [java-import] IJ-CR-163032 IDEA-369199 Preserve module imports even if they are not used
- always highlight unused imports in the hierarchy

GitOrigin-RevId: 26b7fb22931e4b37e45f7c5ee5940d1cfed2a03d
2025-06-04 07:38:18 +00:00
Bas Leijdekkers
c24735c611 Java: fix "Add braces to 'else' statement" not showing before 'for' (IDEA-372262)
GitOrigin-RevId: c305cd5df439ea2c1ea6d796dc1b57a16a87ba36
2025-06-03 20:14:33 +00:00
Tagir Valeev
96974e33ba [java-inspections] checkNullableNotNullInstantiationConflict: use createTypeFromText to preserve nullity
Part of IDEA-372347 Java type inference should respect nullability

GitOrigin-RevId: 433069762b1c7a5dff4b64f9708154a812137cd4
2025-05-30 18:51:30 +00:00
Tagir Valeev
211321c88a [java-dfa] Do not check nullability match for primitive methodref return types
DfaPsiUtil returns UNKNOWN nullability for primitive types, but in future we may return NOT_NULL, which is technically more correct. On the other hand, here implicit unboxing is possible, and it's already handled elsewhere, so we won't need an extra warning.
Part of IDEA-372347 Java type inference should respect nullability

GitOrigin-RevId: b864bfc4995a9b5e0e6a13cba807bd8b5b7d04ca
2025-05-30 18:51:30 +00:00
Vladimir Krivosheev
ab69d8455c IJ-MR-162467 don't export intellij.platform.indexing
GitOrigin-RevId: 5065d7f10610d024e4a89a379be3de68caf55dc3
2025-05-29 17:55:17 +00:00
Nikolay Chashnikov
527e6577b9 [java] API cleanup: remove unused deprecated API scheduled for removal (IJPL-178044)
GitOrigin-RevId: d40c483b7b18fd193da4345ae9c8c472f355d47e
2025-05-28 23:37:49 +00:00
Tagir Valeev
6dd081fd22 [java-highlighting] IDEA-373426 When highlighting an error in method arguments, navigate (via F2) inside the parentheses
GitOrigin-RevId: 760549be13f4c78c66c9074e3de8be34cf0f3a51
2025-05-26 15:22:29 +00:00
Tagir Valeev
09df3539c0 [java-inspections] RedundantCastUtil: check qualifier chain
Fixes IDEA-370995 Generic cast is marked as redundant when necessary.

GitOrigin-RevId: 5fe5107150e1cde4373c0b9fd95aaeb5e9e087ba
2025-05-26 14:05:04 +00:00
Tagir Valeev
ddc812cd28 [java-inspections] RedundantCastInspection: recheck that the cast is redundant in fix
This might be important if 'fix all' is applied and two casts are redundant individually, but not together

GitOrigin-RevId: 90e26e9e1a04a88ef50bb87e2f981c4ee1c154f1
2025-05-26 14:05:04 +00:00
Tagir Valeev
002f45f937 [java-dfa] Switching on expression of unknown type should not mark branches as unreachable
Fixes IDEA-371191 Unhelpful "unreachable switch label" warning

GitOrigin-RevId: d3e92efc518590ed7c5b7219b9ba0378c292507d
2025-05-23 16:06:16 +00:00
Nikolay Chashnikov
d039e59e88 [java] report access to package-private members declared in production code from tests (IDEA-372858)
GitOrigin-RevId: 6f046186e0f0a587e1aaab31dd55b9f76a28db96
2025-05-19 10:03:24 +00:00
Alexey Kudravtsev
89f928d3e7 fix after "fix visibility" global refactoring (highlighting pass factories)
GitOrigin-RevId: 9902d48768bab6994b68c0871cf1051a5968ff51
2025-05-16 15:08:15 +00:00
Tagir Valeev
38fe7ad147 [java-intentions] Disable AddAnnotationTargetFix if target file is non-Java (IDEA-371124)
GitOrigin-RevId: e0a2b37965d3b24c8b7310f5cc61bec8999f59f5
2025-05-16 12:27:32 +00:00
Alexey Kudravtsev
6d1f55f160 cleanup: rename file to psiFile to distinguish from VirtualFile
GitOrigin-RevId: e718eac8ba2d2177787ae941d8525b3c154d10fc
2025-05-16 02:54:06 +00:00
Vladimir Krivosheev
ba225ba21c update bazel files
GitOrigin-RevId: 5dabe601be67c9e7614ba87022a6c7bebadf69df
2025-05-15 16:17:46 +00:00
Tagir Valeev
745eef9189 [java-psi] Support single-source file roots in various places (IDEA-368975)
GitOrigin-RevId: 2045de1f99ece67fe63a09f131664511167baf4a
2025-05-15 15:54:39 +00:00
Marat Dinmukhametov
fb807be02b [http-client] IJPL-179625 Using full computed url for HttpClient request generation
If there is no full url information, we will use resolved version

GitOrigin-RevId: c20a364561f5ecbb56d8e519558fbd9205d94edc
2025-05-15 09:59:56 +00:00
Marat Dinmukhametov
5621f8be9e Revert "[http-client, microservices] IJPL-179625 ignoreSupPathContext for correct generation requests with query parameters"
This reverts commit c637114044d68ed1ad78ef796ac6a77e8acf4a79.

GitOrigin-RevId: c2e9e3991bb16072725f78fe101c055e3e3d5ed2
2025-05-15 09:59:56 +00:00
Marat Dinmukhametov
ce8c8bf9e3 [http-client, microservices] IJPL-179625 ignoreSupPathContext for correct generation requests with query parameters
ignoreSupPathContext is just a workaround for generating requests with query parameters. It would be better if we could use the full URL representation for HttpRequest generation, because right now there's no way to include URL information (e.g., query parameters) on the left side of the context

GitOrigin-RevId: 88b22b60ff322c6c10d34cd089c6731359f5de98
2025-05-15 09:59:55 +00:00
Marat Dinmukhametov
f3df8ba421 [http-client, microservices-jvm] IJPL-179625 The URL part of MicroservicesJvm was moved to Java
Because HttpClient will be in Android Studio. It needs access to this API to have implementations of HTTP clients (Ktor, Retrofit, OkHttp) in Android Studio.

GitOrigin-RevId: 30771b08ec0a1642ca010cde8513703abc0f7b0f
2025-05-15 09:59:55 +00:00