Commit Graph

499 Commits

Author SHA1 Message Date
Mikhail Pyltsin
4a85e6d59e IJ-CR-140269 [java] M IDEA-355777 Support implicit imports
- ImplicitlyImportedElement is introduced

GitOrigin-RevId: f258f32d330c462bea62c77d6217cf40caf0d051
2024-07-19 19:51:57 +00:00
SirYwell
b22bb694b4 [java-inspections] Remove redundant checks
PR#2804
Reviewed-by: Tagir Valeev <tagir.valeev@jetbrains.com>

GitOrigin-RevId: 1cdce1a99e78603f8727f9a0a2cd10d8e51211f3
2024-07-17 14:41:06 +00:00
Bas Leijdekkers
0274790972 Java: replace with string concatenation should be available when STR processor is not resolved (IDEA-356408)
for "String template can be concatenated string" inspection

GitOrigin-RevId: a996bb1220b5af4b120ba1fd7f6c2ce0859ca41b
2024-07-17 13:55:15 +00:00
SirYwell
f49ee04957 [java-inspections] Fix false warnings on signature polymorphic method lookup
PR#2804
Reviewed-by: Tagir Valeev <tagir.valeev@jetbrains.com>

GitOrigin-RevId: 28a1abe7b3d83e40737df88c5ce1d39933858755
2024-07-17 09:49:37 +00:00
Mikhail Pyltsin
ecff6e161b IJ-CR-138822 [java-highlighting] IDEA-355777 Support JEP 477: implicit imports
- cache implicit static references
- extract ImplicitlyImportedStaticMember into a separate file

GitOrigin-RevId: 105a69ce72b4722f0d32d1d858c426e96b73f9c5
2024-07-05 13:55:46 +00:00
Mikhail Pyltsin
ee1495d613 [java-inspections] IDEA-355916 Support JEP 477 Update ImplicitToExplicit inspection
- first part. update for implicit static imports

GitOrigin-RevId: 8c0fdf1c8ebd424a80e53b93c707fba02a07448a
2024-07-04 20:24:54 +00:00
Mikhail Pyltsin
847a369e5d [java-inspections] IDEA-355900 JEP 477 Convert to implicit class should not be suggested if the class is annotated
GitOrigin-RevId: 748b90d19a74d0023573448557286433c9300646
2024-07-04 15:45:39 +00:00
Tagir Valeev
19fb624028 [java] Use PsiUtil.getContainingClass instead of ClassUtils.getContainingClass
GitOrigin-RevId: f8a6abc7358a2c39dc4c50deaabe14c676f0977c
2024-06-26 11:52:02 +00:00
Bas Leijdekkers
774c6c6d42 Java: fix "Variable assigned to itself" inspection quick-fix operator assignment bug (IDEA-306674)
GitOrigin-RevId: 92f5ab3b782cd0a2e6af8f83ff80de64f000c3bf
2024-06-21 09:13:06 +00:00
Bas Leijdekkers
c4c6723e5a Java: don't warn when fix is not possible (part of IDEA-306674)
for "Variable is assigned to itself" inspection

GitOrigin-RevId: e2b630232fcc34b3d441689193e4daf169920192
2024-06-21 09:13:06 +00:00
Bas Leijdekkers
36aebe5484 Java: use JavaPsiStringTemplateUtil.isStrTemplate() (IJ-CR-136837)
GitOrigin-RevId: f92c09fcb88689d489cd794b96ee91b5e9895fe7
2024-06-21 09:13:06 +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
Bas Leijdekkers
19bcdae73f Java: quick fix should insert empty string when need to convert expression to string concatenation (IJ-CR-136837)
GitOrigin-RevId: aab43eb95b7bd05f70d1b187f2b0619a437bc21e
2024-06-18 19:20:03 +00:00
Bas Leijdekkers
dd0e596d3d Java: replace with text block should not be available on non-string literals (IDEA-354921)
GitOrigin-RevId: b86751e38c0349fcafd72ed04b39ed5283c2c06a
2024-06-14 13:20:41 +00:00
Tagir Valeev
b483d35d43 [java-inspections] Do not report redundant record constructor if it's declared as throwing
Throws on record canonical constructor is not allowed, so let users first solve that problem
Fixes EA-1021434 - IOE: BasicJavaParserUtil.parseFragment

GitOrigin-RevId: 13a55e9bcf1d7d66d8b810cceef9ee5ec3f3e14d
2024-06-11 13:02:06 +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
Bas Leijdekkers
4777c9dd1b new "String template can be concatenated string" inspection (IDEA-349463)
GitOrigin-RevId: 84871569e435e1f1cd5c06814781739baf977cae
2024-06-07 14:19:07 +00:00
Tagir Valeev
65765e4893 [java] Replace ReferencesSearch with VariableAccessUtils where possible
GitOrigin-RevId: 9da932c0ddbea78f590e578e0ff7a9baaf49cc75
2024-05-23 10:43:10 +00:00
Mikhail Pyltsin
6ba54ec2b8 [java-inspection] IDEA-310469 Java inspection for "Pattern variable can be used" does not find all cases
- support an inverted case

GitOrigin-RevId: 34c4a732331778cf158e84425a7d61df4dc6ee53
2024-05-10 17:26:16 +00:00
Mikhail Pyltsin
45160db0df [java-highlighting] IDEA-352588 Support JEP 455: highlighting for switch with primitives
GitOrigin-RevId: 06636352b202037ec3400b2f9763e101d8ed6042
2024-04-29 21:17:42 +00:00
Mikhail Pyltsin
8416740b8c [java-dfa] Support JEP 455: IDEA-352186 dfa for primitives in patterns
GitOrigin-RevId: 2033b095f35f02222aa40f43d37e07b0019c4324
2024-04-29 21:17:42 +00:00
Mikhail Pyltsin
66f310ed19 [java-inspections] DFA widening is allowed in JDK21
GitOrigin-RevId: 4e79fb03a5a7b3e9454af956b19dd16b437c54b0
2024-04-24 11:16:03 +00:00
Tagir Valeev
053d59f113 [java-psi] Move JavaLexer utility methods to PsiUtil to make them accessible from java-psi-api
GitOrigin-RevId: 88a728c1d021f703dc9f882e1f9213cd8477ed7a
2024-04-19 17:41:51 +00:00
Tagir Valeev
29d3dd73c0 [java-inspections] OverwrittenFieldAnalyzer: do not build maps if there are no field accesses
GitOrigin-RevId: 08a36e2ca92e21fb42c8afca8b7a1880b1a6dcd3
2024-04-19 09:51:50 +00:00
Mikhail Pyltsin
74e210570e [java] Pattern variable can be used mass cleanup
GitOrigin-RevId: 46452d7711435b63fca78af3a6f634bcec862139
2024-04-18 14:03:54 +00:00
Mikhail Pyltsin
d8f8800d93 IJ-CR-131028 [java-inspection] IDEA-310469 Java inspection for "Pattern variable can be used" does not find all cases
- rename option

GitOrigin-RevId: 26dc0cfa17c438aa8e41fcc9d52d764573814021
2024-04-14 18:28:41 +00:00
Tagir Valeev
2ca2ae1758 [java-inspections] ReplaceInefficientStreamCountInspection: support cs.chars().count()
Part of IDEA-351174 String .chars().count() to be suggested as .length()

GitOrigin-RevId: e5f25e8dbfbfd36a855caf37869f31209356dce8
2024-04-11 14:46:25 +00:00
Mikhail Pyltsin
00351758c5 [java-inspection] IDEA-310469 Java inspection for "Pattern variable can be used" does not find all cases
- support more cases

GitOrigin-RevId: 28301b79d4c4acd343a35474d1ab44096dcea8cd
2024-04-09 15:49:16 +00:00
Tagir Valeev
2b2886db0c [java-inspections] A little bit deeper analysis in Arrays.asList in Java9CollectionFactoryInspection
IDEA-347171 False positive from List.of intention

GitOrigin-RevId: 0eb4b04ad3134c2a74f07d84e96286d8eeb50cce
2024-04-09 09:41:32 +00:00
Tagir Valeev
f943967aec [java-inspections] Minor fixes for IDEA-346242 Add 'minimal java version' clause automatically to inspection descriptions
1. Add features to assertion inspections
2. Remove redundant feature message from HTML descriptions
3. Display Java 1.3 and Java 1.4 version properly
4. Display several features when necessary

GitOrigin-RevId: 133b46152ad8376a37aa4fd847bedf38d45f3135
2024-04-05 10:20:31 +00:00
Tagir Valeev
5428775b85 [indexing] Remove progress indicator from PsiSearchHelper.isCheapEnoughToSearch and at use sites
Was unused

GitOrigin-RevId: 98f5e2b1f48f54fc15d54cbbf73ff549f96fca6a
2024-03-20 14:28:13 +00:00
Tagir Valeev
aed276dfd3 [java-inspections] Use LocalRefUseInfo in more contexts to avoid extra PSI traversals
GitOrigin-RevId: 0dae53843eebe7232460cad1c809223342824cd2
2024-03-20 14:22:13 +00:00
Tagir Valeev
37e7478c3c [java-inspections] IDEA-344097 'collect(maxBy())' can be replaced with 'max()' replacement produces code that can not be compiled
GitOrigin-RevId: ba45e04a5946a73949d9d3afb15d764df2376d98
2024-03-14 19:34:55 +00:00
Tagir Valeev
3ed2f12a89 [java] JavaFeature.OBJECTS_CLASS
GitOrigin-RevId: 99e54a5f42368279b20fca9388f420cd6e24dee2
2024-03-14 19:34:45 +00:00
Tagir Valeev
d18c733fe1 [java] Use more Java features
GitOrigin-RevId: d0690e949f311dc53bdfe5ff63140e2ef15e4d55
2024-03-14 19:34:40 +00:00
Bas Leijdekkers
59d72ca4ae [java] handle char literals better (IDEA-348632)
for "String template can be used" inspection

GitOrigin-RevId: 587573e95c08504af0e77a497e9abbbc743d1089
2024-03-10 15:30:33 +00:00
Aleksey Dobrynin
c9d2c80dab [java, inspection, fix] do not fill in a module descriptor twice
GitOrigin-RevId: d5a2d6e23154c8fdef3dc03b8de698e955d40945
2024-03-08 18:49:41 +00:00
Tagir Valeev
214a868993 [java-analysis] SimplifyOptionalCallChainsInspection: cosmetic
GitOrigin-RevId: b4e6376ca1aba2b7798abc1ae7debe52bb8d280f
2024-03-08 15:17:04 +00:00
Yann Cébron
297191c9cb [java] WrapperTypeMayBePrimitiveInspection: remove static init
GitOrigin-RevId: d44bb347404dbb7e7e7d63974fa6a57d62ce86bd
2024-03-06 19:11:22 +00:00
Aleksey Dobrynin
0141f07298 [java] fix naming IJ-CR-122859
GitOrigin-RevId: 4ac18d742ba487d8fc2e48a90188833eca1b178a
2024-03-01 22:56:28 +00:00
Tagir Valeev
d89c17fc59 [kotlin-dfa] Move inspection.data.flow.warn.when.reading.a.value.guaranteed.to.be.constant to JavaAnalysisBundle
Preparatory step for KTIJ-28908 Convert "Constant conditions" inspection to K2

GitOrigin-RevId: 68798782d260f8245947423efd936ae82bde841c
2024-02-24 12:22:09 +00:00
Aleksey Dobrynin
b2010f620b [java, inspection] Change inspection name (Auto-add -> Fill in). Refactoring. (IJ-CR-126295)
GitOrigin-RevId: b3ac08c0c18442a1343c636e9ce404979f1210cf
2024-02-19 21:06:53 +00:00
Aleksey Dobrynin
1714ca86b3 [java, inspection] generate necessary requires for empty module-info.java file. IDEA-341665
GitOrigin-RevId: 47bce7db3bc4429cdfd78bbb3518e8fea1cc80b8
2024-02-16 11:31:15 +00:00
Tagir Valeev
64327f79d6 [java-inspections] IDEA-346242 Add 'minimal java version' clause automatically to inspection descriptions, based on the required feature(s)
GitOrigin-RevId: 50a25148d4d36c46e9552b3123d1ef966b40a2c2
2024-02-15 15:28:00 +00:00
Tagir Valeev
1b105a0cf2 [java-inspection] IDEA-344750 Warning the usage of Stream.count() may have side-effects as per Javadoc apiNote for Java 8+
GitOrigin-RevId: cee842e9966051f95d86f83c8e8509a08fb48c64
2024-02-15 13:23:36 +00:00
Tagir Valeev
bf85acba82 [java] More JavaFeature uses
Also: new JavaFeatures (ASSERTIONS, ENUMS, PRIVATE_INTERFACE_METHODS)

GitOrigin-RevId: f073845a77730b486afa56317e2c12ff044f5425
2024-02-12 19:12:43 +00:00
Tagir Valeev
e90c911b82 [java-inspections] SequencedCollectionMethodCanBeUsedInspection: fix accidental reversed boolean
GitOrigin-RevId: 6f080f4d6a9a7c3e0ac1dd573ac3cd41ba236c55
2024-02-08 10:08:29 +00:00
Tagir Valeev
2b41a7f753 [java] A little bit more of JavaFeature uses
GitOrigin-RevId: ffb3c336a16500a53000a8fbd6aa793fffd6befc
2024-02-08 10:08:19 +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