Commit Graph

513 Commits

Author SHA1 Message Date
Tagir Valeev
bad69926e7 [java-inspections] Class can be record: fix Javadoc refs as well (IDEA-356432)
GitOrigin-RevId: 3dc09d1554037b46773b05b973b4a5905e5b3fe5
2024-10-14 15:13:57 +00:00
Mikhail Pyltsin
066fa7fe85 [java-inspections] IDEA-360279 Narrow the scope for ImplicitToExplicitClassBackwardMigrationInspection
GitOrigin-RevId: 7d1e2b8da9983291201eb214f9437c68aaa12b87
2024-10-08 16:45:11 +00:00
Mikhail Pyltsin
a9a1a18b94 [java-inspections] IDEA-357275 "Convert class to record" quickfix throws IOE when inherit compiled class
GitOrigin-RevId: 3fef0a37b006d12b2728b98454071d0fd7d3b24f
2024-10-07 18:58:01 +00:00
Tagir Valeev
1de7339d44 [java-inspections] Class can be record: automatically use accessors if the fields are not accessible
Fixes IDEA-356432 'Convert to record class' could handle public fields more intelligent

GitOrigin-RevId: c1c458275e808e3c95e2a24a9a8c1919ac25011b
2024-10-04 17:21:43 +00:00
Bas Leijdekkers
2f23d849ea Java: fix "Duplicate branches in 'switch'" inspection false positive on method reference (IDEA-355483)
GitOrigin-RevId: 0d5e06632a349494f05b79dab40d37988fdd7412
2024-10-03 18:24:19 +00:00
Bas Leijdekkers
772de1b8c2 Java: cleanup in DuplicateBranchesInSwitchInspection
GitOrigin-RevId: b7adfb9113ed15f46b25da935b9ee9ec66af6fb8
2024-10-03 18:24:19 +00:00
Bas Leijdekkers
d74484e368 Java: enable "Record pattern can be used" by default at warning level (IDEA-359690)
and make it a cleanup tool.

GitOrigin-RevId: 3bb400491d44ab901660d900c6ce73e76bdf6261
2024-09-25 21:53:25 +00:00
Tagir Valeev
ac0c57748b [java-inspections] IDEA-346005 Add new inspection: Unnecessary keySet() call
GitOrigin-RevId: d1f1db0ae939017a8550b91cd8742dc222a8db99
2024-09-17 07:28:39 +00:00
Tagir Valeev
8ed70be46d [java-inspections] IDEA-359031 Preview API use warning: ignore imports
GitOrigin-RevId: d9ba762be3f03f60372a70471f4c04efc26a9a66
2024-09-11 12:08:36 +00:00
Tagir Valeev
cf460af83e [java-inspections] IDEA-358770 Stream/Optional desugaring: support Predicate.not
GitOrigin-RevId: af9cdb5e674406bbbe94a746e85a662a590a4d3d
2024-09-05 12:54:57 +00:00
Bas Leijdekkers
0c4fc2ab23 Java: don't suggest to "Replace with text block" a text block (IDEA-358449)
GitOrigin-RevId: 4db08b1a6a9e5bb3c957e23af185e6df1f757c47
2024-09-02 21:52:50 +00:00
Tagir Valeev
cd2be32f62 [java-inspections] Java9CollectionFactoryInspection: copyOf: respect declared nullity of source collection
Fixes IDEA-349386 Don't suggest List/Set/Map.copyOf when elements are annotated @Nullable

GitOrigin-RevId: f2c1298394f204732437d304f68272f6cf406cc0
2024-08-29 18:27:57 +00:00
Mikhail Pyltsin
d3b39b27a9 [java-inspection] IDEA-357079 Convert switch expression to old style switch with boolean selector: do not add default branch
GitOrigin-RevId: c02a9cd74b36adbf1e46c012cce3ef4c490c4eb9
2024-08-02 22:53:47 +00:00
Mikhail Pyltsin
d186699847 [java-inspection] IDEA-355916 update implicit<->explicit classes inspections
- tests
- optimize imports
- ReplaceOnDemandImportIntention supports module imports

GitOrigin-RevId: 228135179fc26f44064dd196ae70326fd91fb3ee
2024-07-26 12:44:48 +00:00
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