Commit Graph

7471 Commits

Author SHA1 Message Date
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
Bas Leijdekkers
0cae65939b Java: improve incompatible types reporting
- only report type with "anonymous" prefix when the left side is anonymous
- use short names in the tool tip when fq names would be identical as well
- use error color for the entire type name, including the anonymous prefix

GitOrigin-RevId: f1555687adb0ab9e7c5850719165a7a508ecf181
2024-02-11 16:31:14 +00:00
Aleksey Dobrynin
c45e172247 [java, fix] JavaModuleSystem.isAccessible should respect alternative resolve mode. IDEA-343532
GitOrigin-RevId: fd121157e893f10212ee347e8f16c49c69bf1b52
2024-02-09 10:00:13 +00:00
Mikhail Pyltsin
756e1d020e [java-highlighting] IJ-CR-119726 IDEA-306108 Assignment to a variable with non-denotable type: confusing error message and useless quick-fix
- use standard library

GitOrigin-RevId: a2e708ba695103d70ce8d107c50bd7a35229f062
2024-02-08 19:47:16 +00:00
Tagir Valeev
ea2b70a2d1 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
JavaFeature.EFFECTIVELY_FINAL

GitOrigin-RevId: d52ab73d7d24745b149b5a4704f1dee55e4179f0
2024-02-08 10:08:09 +00:00
Tagir Valeev
72890668ad [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Rename STREAMS to STREAM_OPTIONAL; use features instead of isLanguageLevel8OrHigher

GitOrigin-RevId: 36f56560f6c7ca626a268d8b07da86497f2501a0
2024-02-08 10:08:04 +00:00
Tagir Valeev
6a6eb357d8 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Remove methods PsiUtil.isLanguageLevelXOrHigher for X > 9
There are only a few use sites not covered by existing features (usually checking whether some API exists). It's better to avoid shortcut to motivate people using features.

GitOrigin-RevId: 0149bf5badec79e77b7fe2066ad4ac7277d21ecb
2024-02-08 10:07:59 +00:00
Tagir Valeev
340c4d40ba [java] IDEA-345355 Refactor HighlightingFeature (in progress)
JavaFeature.isAvailable moved to PsiUtil, as we cannot get PsiElement language level inside frontback-api module

GitOrigin-RevId: 8092b1f55f0d90af5bc570f2fb49cdf9ef94485a
2024-02-08 10:07:48 +00:00
Tagir Valeev
cd071eaae4 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Use more JavaFeatures; unify soft keyword processing in JavaLexer and in ForwardCompatibilityInspection

GitOrigin-RevId: f99ac1a35ec4b6b33716b2ace32ee0483f952c54
2024-02-08 10:07:43 +00:00
Tagir Valeev
d0d82eba52 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Declare new features: SERIAL_ANNOTATION, NESTMATES, ALWAYS_STRICTFP, COLLECTION_FACTORIES, INNER_NOT_CAPTURE_THIS, STRING_SWITCH
Use more features instead of explicit Java levels

GitOrigin-RevId: e90a96501c218ed44faebb7c882770b50477b6e1
2024-02-08 10:07:38 +00:00
Tagir Valeev
87c2a93f10 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Remove JavaFeature.isFeatureSupported() in favor of isAvailable()
Rename getLevel() into getMinimumLevel()
Avoid use of getMinimumLevel() where possible
Javadocs

GitOrigin-RevId: 4354821d8cfcf88cc1c3830b0e3cb3f221a5c122
2024-02-08 10:07:33 +00:00
Tagir Valeev
7625b3c7a2 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Merge JavaLanguageFeature into JavaFeature

GitOrigin-RevId: 212b31d072450df03fc9eeeeb2cf0861b2b32bc1
2024-02-08 10:07:28 +00:00
Tagir Valeev
d8ab6ce154 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
HighlightingFeature deprecated for removal

GitOrigin-RevId: d6ec9098a415931b457e675466eaf994e7860c0b
2024-02-08 10:07:23 +00:00
Tagir Valeev
d8aa739e97 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Use JavaLanguageFeature instead of HighlightingFeature

GitOrigin-RevId: ad24840c3e810521c82da3873ec42aa3fadb4c0d
2024-02-08 10:07:18 +00:00
Tagir Valeev
a7674dca70 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Create JavaLanguageFeature; move HighlightingFeature functionality there; move preview highlighting related utilities to new PreviewFeatureUtil class

GitOrigin-RevId: 116bcc9feb6fb40a0bd6a25ba10c2f35b41ffea6
2024-02-08 10:07:12 +00:00
Tagir Valeev
6adc9a28d7 [java-dfa] AssertJ: recognize describedAs and as methods in Descriptable superclass (IDEA-209246)
GitOrigin-RevId: f1374bfa5a5a3fb81763cb07206d36172712a1e6
2024-02-08 10:07:02 +00:00
Tagir Valeev
d469c59435 [java-inspections] IDEA-345255 Duplicate condition: improve detection of &&-chains
GitOrigin-RevId: e6b504e7665921e66c17690f6a144fb36dcd8124
2024-02-07 19:28:52 +00:00
Vladimir Krivosheev
1742d30135 IJPL-594 update fastutil 8.5.11 -> 8.5.13
GitOrigin-RevId: d1668b1b7d439f9d65972d45324f92c3d43f9918
2024-02-07 17:02:20 +00:00
Bas Leijdekkers
9619e7ca58 Java: fix false positive regression in "If with identical branches" inspection
GitOrigin-RevId: 4d8dd82890019a4d1a48f98b982e5f2f9821b5ab
2024-02-07 15:14:34 +00:00
Georgii Ustinov
3891baf2cf [Java. Logging] Simple logger generator implementation
IDEA-331693

GitOrigin-RevId: b7d8cfc3499501305dabfa31c6ba2957f55ea679
2024-02-07 13:30:03 +00:00
Tagir Valeev
cd74781a9d [java-inspections] IDEA-345238 Duplicate conditions: respect mutation signature
GitOrigin-RevId: b9271196151e985b5147b9264ea73d8e3118b59a
2024-02-07 00:30:20 +00:00
Alexey Kudravtsev
32a0b64911 memory optimization: do not allocate empty arrays (part of KTIJ-27475 Investigate Kotlin plugin excessive memory usage)
GitOrigin-RevId: 25de43af6bcce77ad6507809b7cf83ae4e41b44b
2024-02-06 22:38:26 +00:00
Tagir Valeev
f5e5a146b3 [java-intentions] Disable 'Fix method 'setContent' parameters with bounded wildcards' on lombok synthetic method
Fixes EA-1047484 - UOE: SyntheticElement.findSameElementInCopy

GitOrigin-RevId: 9938bcddef97c91bbb01dc1df308fbffc40b8ac2
2024-02-06 21:35:12 +00:00
Tagir Valeev
3f4201aae8 [java-intentions] Disable 'initialize variable fix' for record component
Fixes EA-893719 - UOE: SyntheticElement.findSameElementInCopy

GitOrigin-RevId: 6e5d54c1b32f2c7cb0621bba1b4a6ef02de4b8f8
2024-02-06 21:35:03 +00:00
Tagir Valeev
e5558c1da6 [java] Handle possible NPE in methodBody()
May help EA-943069 - NPE: MethodData$methodBody$0.invoke

GitOrigin-RevId: f5928a8df3497bfe0d7f925aaf4897e890e08436
2024-02-06 21:34:53 +00:00
Dmitriy.Panov
0ac04fe3af Revert "memory optimization: do not allocate empty arrays"
This reverts commit 08ac71e2aedbaddc5e4407d4e0bca0e27532ce6b.

GitOrigin-RevId: ae84129718ce76840eb97b8d92100d1a19e13b34
2024-02-05 23:42:14 +01:00
Mikhail Pyltsin
4948c8af8c [java-highlighting] IDEA-344235 support calls with checked exceptions for instanceOf patterns
GitOrigin-RevId: 15d80e2f3028bd59c1ec9a73a7a3af4c1c5f1027
2024-02-05 19:22:52 +00:00
Alexey Kudravtsev
10e13bfa5d memory optimization: do not allocate empty arrays
GitOrigin-RevId: 08ac71e2aedbaddc5e4407d4e0bca0e27532ce6b
2024-02-05 19:01:27 +00:00
Bas Leijdekkers
283c537664 Java: fix equivalence checking for (labeled) break and continue statements
GitOrigin-RevId: 928edb7ca6a9dcec2b3fdbc3eb0da3c0bb4d4d85
2024-02-05 18:10:33 +00:00
Mikhail Pyltsin
23805a0f41 [java-inspections] IJ-CR-125254 IDEA-339062 support switch expression in light inference
- fix tests
- return null if there is a throw statement

GitOrigin-RevId: 79f9efb659b1d56b82f4a8300461cbd2c802f870
2024-02-05 17:45:37 +00:00
Bas Leijdekkers
723aa42a98 Java: String Template support for "if statement with identical branches" inspection (IDEA-345050)
GitOrigin-RevId: fdf61967daa472961f913714343a85c7bc971777
2024-02-05 11:38:54 +00:00
Bas Leijdekkers
91c973204b Java: "'if' statement with identical branches" warn on if with just a method call (IDEA-345050)
GitOrigin-RevId: f4c34993e096d5006e9f363335468b596c28598c
2024-02-05 11:38:51 +00:00
Bas Leijdekkers
11ef5878e8 Java: "'if' statement with identical branches" inspection cleanup
GitOrigin-RevId: 09e7c71623aa4886f230c3db7cee5f9b103ce181
2024-02-05 11:38:48 +00:00
Bas Leijdekkers
45b7fca0a8 Java: recognize unnecessarily qualified static access when member is from a super class (IDEA-342646)
GitOrigin-RevId: d6a64afd32c184ab4556cdfb1a6c5b1a14d37b58
2024-02-03 19:52:26 +00:00
Mikhail Pyltsin
5feda4ce24 [java-inspections] IDEA-339062 support switch expression in light inference
GitOrigin-RevId: b6bb4be8cf412536cf76a9b24efaf23e0f2e8053
2024-02-02 18:54:12 +00:00
Mikhail Pyltsin
e467d25f90 [java-completion] IJ-CR-124074 IDEA-342465 support correctness for completion
- rollback changes for `createDeleteDefaultFix`

GitOrigin-RevId: 2bd379fe147da2ef83dca1efdc6af381e0b57c56
2024-02-02 16:39:17 +00:00
Aleksey Dobrynin
4be08d597b [java, completion] Support completions for jigsaw modules for classes outside of current module dependencies. IDEA-341664
GitOrigin-RevId: a8d08f94e3f34188e8c6ee29ab26c1fc9c376d49
2024-02-02 15:18:52 +00:00
Tagir Valeev
b762f7eb10 [java] OptionalUtil.isJdkOptionalClassName: contract
GitOrigin-RevId: 1b1c9f5f44c5993291d45f475450fc4d3f03aee1
2024-02-02 10:28:58 +00:00
Alexandr Suhinin
a94069ddc9 IDEA-343555: use default inheritance and non-static highlighting in dumb mode
GitOrigin-RevId: fd064e9f12a17cb16e7234ba6e07868a1f6919ef
2024-02-01 17:00:47 +00:00
Aleksey Dobrynin
0d8b737e97 [java, kotlin, quickfix] Add dependency in a single step while using Jigsaw modules. IDEA-341660
GitOrigin-RevId: 7c0ad3a4079ca76c1f1afb4147498e0ae08cc449
2024-01-30 14:29:06 +00:00
Alexandr Suhinin
4578c1991f IDEA-343555 [highlighting]: highlight java annotations and try alternative resolve in dumb mode for other references
GitOrigin-RevId: 257c078c2cc912d7989bace8f1e9ea3faba497a2
2024-01-30 13:39:56 +00:00
Tagir Valeev
04ab76833e [java-dfa] Fix nullability of nested generic patterns (IDEA-339860)
GitOrigin-RevId: 3c035ab282515ad39b0fdff167d8105297c48515
2024-01-30 13:12:18 +00:00
Yuriy Artamonov
c3e84ecbb8 [jpa] IDEA-344309 Do not compute persistent class roles for unrelated classes for Spring Boot modules without persistence XML
GitOrigin-RevId: aabf3e9e4261ed6457e2ce27b6339cd57286516b
2024-01-29 23:45:56 +00:00
Tagir Valeev
0385834f13 [jvm-inspections] Fix EmptyMethod compatibility with Kotlin
1. Fix suppression handling for Kotlin in global inspections
2. Fix RefMethodImpl#hasBody for top-level Kotlin functions
3. Move to JVM module
4. Add Kotlin tests
Fixes IDEA-330737 @file:Suppress("EmptyMethod") does not work

GitOrigin-RevId: 83f383e06754f510b6a99e35751263017734bb26
2024-01-29 19:42:30 +00:00
Bas Leijdekkers
1ed298893c Java: use PsiNewExpression.isArrayCreation() (IJ-CR-124100)
GitOrigin-RevId: 09e635051dc0ee3b3f747bf0e00c2c8bdd437289
2024-01-27 11:44:54 +00:00
Tagir Valeev
9b7cfa29d0 [java-dfa] stopOnCast introduced to fix 'Find the cause' (apparently, it needs no-stop-on-cast mode)
GitOrigin-RevId: 593229e0ac7bdf77fe884a02c7e1fd0681c3b01b
2024-01-26 22:02:12 +00:00
Tagir Valeev
434301c3b9 [java-dfa] Stop analysis completely after impossible cast outside of try-catch
Improves UnreachableCodeInspection

GitOrigin-RevId: 87a98ad8c3c0ca544e86c9bb1c98267dc939a728
2024-01-26 22:02:05 +00:00
Tagir Valeev
7b77a3c1ad [java-dfa] Correctly unbox variables for contract check
Fixes IDEA-343951 Warning about boolean value is always true is wrong

GitOrigin-RevId: 365f32fc0ff0fc293bf2608e3b0ad1bb3b58f040
2024-01-26 22:01:45 +00:00
Tagir Valeev
99b3a9a6b0 [java-dfa] DfaUtil: pattern variables used
GitOrigin-RevId: eb0850925e14aedd144f56da09f1eb474163a4e9
2024-01-26 22:01:39 +00:00
Tagir Valeev
ee4e7f7456 [java-dfa] DfaCallArguments#toString
GitOrigin-RevId: 6ceeb117796a4b678c9c603c687d4a84880ea05e
2024-01-26 22:01:32 +00:00