Commit Graph

7719 Commits

Author SHA1 Message Date
Bas Leijdekkers
fb700afa0e Java: don't warn about infinite recursion on red code
GitOrigin-RevId: b136b315a1213d2526581b7281bbc81161dfb57e
2024-06-28 17:14:56 +00:00
Bas Leijdekkers
6916b6b005 Java: better error message when there are more arguments than parameters (IDEA-336129)
GitOrigin-RevId: a17a5f0f3878b9baf211737a614d1aa1a5103d31
2024-06-28 17:14:56 +00:00
Tagir Valeev
229eff0461 Raw type and other warnings fixed
GitOrigin-RevId: cde52de8987d2a995c4d2861f3b77356d79f3dd4
2024-06-28 16:52:24 +00:00
Tagir Valeev
2909ce4932 [java-intentions] RemoveAllUnusedImportsFix: support static imports; tests
Fixes IDEA-353352 "Remove unused imports" does nothing for static imports

GitOrigin-RevId: ae20983342012414568af9ca68db67994832443c
2024-06-28 11:03:18 +00:00
Tagir Valeev
e9c60004b1 [java-inspections] Result of call ignored: Avoid false-positives in fragments (like debugger evaluation)
Fixes IDEA-355461 "Result is ignored" inspection triggered in evaluate and log

GitOrigin-RevId: e3870ff2b90d9297896caceb3b566098ee324c6d
2024-06-27 11:21:13 +00:00
Mikhail Pyltsin
246f6ab1cc [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- fix NullableManager, when it can't find annotation in type
- fix nullability for `switch`

GitOrigin-RevId: c8a369f4ccf07297e520ec837b13cb9dbf49a67f
2024-06-26 20:34:48 +00:00
Bart van Helvert
0232d76e56 [java] Implement getName for implicit classes
GitOrigin-RevId: 069362cff5ebee9eaf5e75d566097a2deaed8e8f
2024-06-26 18:23:10 +00:00
Alexey Kudravtsev
a0f3cf4983 rename for clarity
GitOrigin-RevId: b54d94a8ad8fd26010e9a57f9ee71ff9bff33b2d
2024-06-26 14:28:19 +00:00
sergey.vasiliev
71c18c7a81 IDEA-355383 Services should be package-private by default
GitOrigin-RevId: 193b22c92254ca7354821122ac663aed74c16ab2
2024-06-26 13:38:12 +00:00
Tagir Valeev
172b663b9d [java] ExpressionUtils.getEffectiveQualifier: cosmetic
GitOrigin-RevId: ba65a05b1d26c48748044b29f7ff0d83099c8b77
2024-06-26 11:52:02 +00:00
Tagir Valeev
19fb624028 [java] Use PsiUtil.getContainingClass instead of ClassUtils.getContainingClass
GitOrigin-RevId: f8a6abc7358a2c39dc4c50deaabe14c676f0977c
2024-06-26 11:52:02 +00:00
Tagir Valeev
180c1fe1e9 [java-dfa] AssertJInliner: partially support contains* methods
GitOrigin-RevId: cb4954a6a869cf11f0741db06560f3f5c2a7b7c7
2024-06-25 18:26:16 +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
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
Tagir Valeev
523c1c854a [java-incomplete-model] Move IncompleteModelUtil to java-psi-impl
GitOrigin-RevId: 41d51684cd2c2f11cb955c05a13cc273fc99e5b5
2024-06-25 09:23:05 +00:00
Tagir Valeev
fd852723f9 [java-analysis] Move ClassUtils.getContainingClass to PsiUtil
May be useful from java-psi-impl

GitOrigin-RevId: e72a08c60168139d6f9509aa4597bf77e953716d
2024-06-25 09:23:05 +00:00
Bas Leijdekkers
2fce834c88 Move registry key to Java plugin (IJ-CR-137130)
GitOrigin-RevId: eb6da35f1760cc93aebed16c46bdc48f08e97353
2024-06-24 19:20:28 +00:00
Mikhail Pyltsin
5c719214e3 IJ-CR-137428 [java-completion] IDEA-355252 Don't suggest deconstruction with incorrect name
- use JavaCodeStyleManager

GitOrigin-RevId: 140a4b58a6d0f12a14219bd3f48091d61d187b0c
2024-06-24 14:54:59 +00:00
Mikhail Pyltsin
09c7c9e6e8 IJPF-CR-23473 [java-generation] IDEA-344399 generate annotation based on type_use option
-fix wording

GitOrigin-RevId: d29bb07acb1c739a3fc5d7563b89b6c52d5bfec2
2024-06-21 18:07:32 +00:00
Tagir Valeev
b038d3db65 [java-inspections] NullableStuffInspectionBase: fix record constructor support
GitOrigin-RevId: defcd306c9f5a32c027cbc2105ac3224878de452
2024-06-21 17:47:17 +00:00
Mikhail Pyltsin
aec277cf21 IJ-CR-137428 [java-completion] IDEA-355252 Don't suggest deconstruction with incorrect name
- extend VariableNameGenerator

GitOrigin-RevId: b6c1455ff9e01ae898219410cba45a5c5c669703
2024-06-21 13:47:15 +00:00
Mikhail Pyltsin
44ab4b02ba [java-inspections] EA-1288620 record deconstruction can be broken in inspections
- check that record deconstructions have correct numbers of components
- optimize `unwrapSealedTypes` a bit
- fix type

GitOrigin-RevId: 554ca9fbde5b37023924056418e9a25c2006b2c8
2024-06-20 18:50:13 +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
6acadcb4f0 [java-inspections] IDEA-355111 "Parameter annotated @Nonnull should not receive 'null' as an argument" can support records
GitOrigin-RevId: a3f557fe842cc7c57cdae150d87f474eab07315e
2024-06-19 15:08:14 +00:00
Tagir Valeev
440654c48f Pattern variable can be used fixes; other warning fixes
GitOrigin-RevId: 49f37e7f5d748be50ee66fdf66a5c9b98b1b7432
2024-06-18 19:55:23 +00:00
Tagir Valeev
3fd0f4975d Pattern variable can be used fixes; other warning fixes
GitOrigin-RevId: 4965216d1872b439970db33dbe2864d5aab9606e
2024-06-18 19:55:23 +00:00
Tagir Valeev
522f2ab43e [i18n] Fix internationalization warnings
GitOrigin-RevId: 7b4a959cf215d79d86d6d9a7727f0fc054097517
2024-06-18 13:46:50 +00:00
Tagir Valeev
191e65634e [java-analysis] ProjectBytecodeAnalysis: do not rewrite null->x contract with _->x if notnull parameter was inferred
Fixes IDEA-354381 Unreachable code inspection fails when using Streamable.of()
Unfortunately, the test does not differentiate the bug. I failed to write a good test in a reasonable amount of time. Nevertheless, the original issue is fixed.

GitOrigin-RevId: 55b0f169c93d1cef9453c3eb88959ea4832a917a
2024-06-18 12:26:39 +00:00
Mikhail Pyltsin
9bf2727703 [java-generation] IJ-MR-136429 IDEA-344399 generate annotation based on type_use option
- fix non-standard-root-packages
- introduce project descriptors

GitOrigin-RevId: 41db7240e29fbfed81957df2d68e2de29c573ef2
2024-06-17 21:14:57 +00:00
Mikhail Pyltsin
2023228d8c [java-generation] IDEA-344399 generate annotation based on type_use option
- extracted new option
- reuse this option in MissortedModifiersInspection
- override uses this option too

GitOrigin-RevId: 39f3f72991240753c86c7f80df865728aa9743ad
2024-06-17 21:14:57 +00:00
Tagir Valeev
a550238d23 [java-inspections] RedundantThrowsDeclarationInspection: cosmetic
GitOrigin-RevId: 27d94b7261d67a743b52d90a43692ca896406582
2024-06-17 13:22:21 +00:00
Tagir Valeev
0fbc75af31 [java-dfa] AssertJInliner: support more intermediate ops
Fixes IDEA-354935 Using `withFailMessage()` on assertJ assertion triggers "'Optional.get()' without 'isPresent()' check" warning

GitOrigin-RevId: 35b6be2f36ee911451d12c32c2ad406fdd601296
2024-06-14 16:10:44 +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
d0e4f5f297 [java-analysis] Analysis: warning fixed
prev instanceof CallResultValue was (correctly) marked as 'always true', likely based on the previous curr.getClass() == prev.getClass() condition

GitOrigin-RevId: 5473a7c96030777e87de22e1425f296bbeaa2221
2024-06-14 16:05:02 +00:00
Bas Leijdekkers
708999dee9 Java: fix rename duplicate class quick-fix exception (IDEA-354587)
GitOrigin-RevId: 934023ec1e68c240cc2bd315ee6493d36311c110
2024-06-14 13:20:40 +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
Louis Vignier
7f7380dc70 [java] Add dedicated method for counting member usages in JavaTelescope
IJ-CR-135678

GitOrigin-RevId: b1baf89c994e9ce7fae6fe2c284ce13c9e8e139c
2024-06-14 08:36:16 +00:00
Tagir Valeev
db93e999ad [java-inspections] IDEA-354559 "Replace with pattern variable" false postive after mutation
GitOrigin-RevId: c6cef9441121dd21705494933c00ca4e63d5fbf3
2024-06-13 14:49:43 +00:00
Tagir Valeev
44a2c98274 [java-analysis] ControlFlowUtils.nextExecutedStatement: fix NPE
EA-984584 - NPE: ControlFlowUtils.nextExecutedStatement

GitOrigin-RevId: ca977a8d3cc60bfb7903ff472f4d61e721141c88
2024-06-11 18:03:46 +00:00
Tagir Valeev
d50f41f7ae [java-dfa] Restrict the result of CustomMethodHandler when qualifier is restricted
Fixes EA-1080132 - ISE: MethodCallInstruction.getMethodResultValue (String.trim, Enum.name)

GitOrigin-RevId: 3ab2fe4fac1d9333d0a61198d2614eead74a173c
2024-06-11 18:03:40 +00:00
Tagir Valeev
7b58c73e68 [java-intentions] RemoveNewKeywordFix: remove outer parameter list
Fixes EA-1067463 - IOE: BasicJavaParserUtil.parseFragment

GitOrigin-RevId: 790bf935afe2f0bf9e39ef4e1c1ae59dd599df63
2024-06-11 13:02:00 +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
ebe984524e [java-inspections] ScheduledThreadPoolExecutorWithZeroCoreThreadsInspection: fix NPE in case of no qualifier
Fixes EA-1243433 - NPE: DfaUtil.getDataflowContext

GitOrigin-RevId: e807a5e9675a9fbbc454fd29be661a878efcf04f
2024-06-10 18:11:38 +00:00
Tagir Valeev
f09dbab1e3 [java-inspections] LengthOneStringsInConcatenationInspection: repeat condition to avoid exception under concurrent write
EA-1260878 - IAE: PsiLiteralUtil.charLiteralString

GitOrigin-RevId: 3e8ce64ce37925b021c4d0aa90ef758d5b9e285a
2024-06-10 18:11:08 +00:00
Tagir Valeev
a26d25a99f [java-dfa] Do not report array as immutable if it's passed to pure methods that return unmodifiable object
The object may be only shallowly unmodifiable

GitOrigin-RevId: 41c0a0b46fc80169ff334d6337d9f8708e689448
2024-06-10 18:10:55 +00:00
Bas Leijdekkers
7602930457 Java: Don't consider class used when a member is implicitly used (IDEA-281800)
in editor only, disabled by default

GitOrigin-RevId: 92972eeb90efa1b2918440a65dd5195d17fbc959
2024-06-09 23:54:51 +00:00
Tagir Valeev
bbbda8b6af [incomplete-project-model] Better processing of overloaded methods
GitOrigin-RevId: b5348e9a75486c5bb75b49fd3e415743cb026952
2024-06-07 18:19:54 +00:00